openscap_report.scap_results_parser.parsers.oval_state_parser   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 22
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A OVALStateParser.get_state() 0 9 1
A OVALStateParser.__init__() 0 2 1
1
# Copyright 2022, Red Hat, Inc.
2
# SPDX-License-Identifier: LGPL-2.1-or-later
3
4 1
from ..data_structures import OvalState
5 1
from .oval_endpoint_information_parser import OVALEndpointInformation
6 1
from .shared_static_methods_of_parser import SharedStaticMethodsOfParser
7
8
9 1
class OVALStateParser(OVALEndpointInformation):
10 1
    def __init__(self, states):
11 1
        self.states = states
12
13 1
    def get_state(self, state_id):
14 1
        xml_state = self.states[state_id]
15 1
        state_dict = {
16
            "state_id": xml_state.attrib.get("id"),
17
            "comment": xml_state.attrib.get("comment", ""),
18
            "state_type": SharedStaticMethodsOfParser.get_key_of_xml_element(xml_state),
19
            "state_data": self._get_items(xml_state),
20
        }
21
        return OvalState(**state_dict)
22