Test Failed
Pull Request — master (#48)
by Jan
03:24
created

openscap_report.scap_results_parser.description_parser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 41.67%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 16
ccs 5
cts 12
cp 0.4167
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A DescriptionParser.get_full_description() 0 9 2
1 1
from lxml import etree
2
3 1
from .namespaces import NAMESPACES
4
5
6 1
class DescriptionParser():
7 1
    @staticmethod
8 1
    def get_full_description(item):
9
        description = item.find(".//xccdf:description", NAMESPACES)
10
        if description is None:
11
            return None
12
        str_description = etree.tostring(description).decode()
13
        start_tag_description = str_description.find(">") + 1
14
        end_tag_description = str_description.rfind("</")
15
        return str_description[start_tag_description:end_tag_description].replace("html:", "")
16