openscap_report.scap_results_parser.data_structures.oval_definition   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Test Coverage

Coverage 93.33%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 30
ccs 14
cts 15
cp 0.9333
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A OvalDefinition.as_dict() 0 2 1
1
# Copyright 2022, Red Hat, Inc.
2
# SPDX-License-Identifier: LGPL-2.1-or-later
3
4 1
from typing import List
5
6 1
from openscap_report.dataclasses import asdict, dataclass, field
7
8 1
from .oval_node import OvalNode
9 1
from .oval_reference import OvalReference
10
11 1
OVAL_DEFINITION_JSON_KEYS = [
12
    "definition_id",
13
    "title",
14
    "description",
15
    "version",
16
]
17
18
19 1
@dataclass
20 1
class OvalDefinition:
21 1
    definition_id: str
22 1
    title: str
23 1
    description: str = ""
24 1
    version: str = ""
25 1
    references: List[OvalReference] = field(default_factory=list)
26 1
    oval_tree: OvalNode = None
27
28 1
    def as_dict(self):
29
        return asdict(self)
30