Passed
Pull Request — master (#55)
by Jan
06:29
created

openscap_report.scap_results_parser.parsers.description_parser   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 16
ccs 12
cts 12
cp 1
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 1
        description = item.find(".//xccdf:description", NAMESPACES)
10 1
        if description is None:
11 1
            return None
12 1
        str_description = etree.tostring(description).decode()
13 1
        start_tag_description = str_description.find(">") + 1
14 1
        end_tag_description = str_description.rfind("</")
15
        return str_description[start_tag_description:end_tag_description].replace("html:", "")
16