Passed
Pull Request — master (#129)
by Jan
06:43 queued 02:42
created

oval_graph.arf_to_html.ArfToHtml.prepare_parser()   A

Complexity

Conditions 1

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 4
nop 1
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
'''
2
    This file contains a class for command arf-to-graph
3
'''
4
5
from .client import Client
6
from .converter import Converter
7
from ._builder_html_graph import BuilderHtmlGraph
8
from .xml_parser import XmlParser
9
10
11
class ArfToHtml(Client):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
12
    def _set_attributes(self):
13
        self.all_in_one = self.arg.all_in_one
14
        self.all_rules = True if self.all_in_one else self.arg.all
15
        self.display_html = True if self.out is None else self.arg.display
16
        self.show_failed_rules = self.arg.show_failed_rules
17
        self.show_not_selected_rules = self.arg.show_not_selected_rules
18
        self.html_builder = BuilderHtmlGraph(self.parts, self.verbose)
0 ignored issues
show
Bug introduced by
It seems like a value for argument all_in_one is missing in the constructor call.
Loading history...
19
        self.xml_parser = XmlParser(self.source_filename)
20
21
    def _get_message(self):
22
        MESSAGES = {
0 ignored issues
show
Coding Style Naming introduced by
Variable name "MESSAGES" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
23
            'description': 'Client for visualization of SCAP rule evaluation results',
24
            'source_filename': 'ARF scan file',
25
        }
26
        return MESSAGES
27
28
    def create_dict_of_rule(self, rule_id):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
29
        converter = Converter(self.xml_parser.get_oval_tree(rule_id))
30
        return converter.to_JsTree_dict(self.hide_passing_tests)
31
32
    def _put_to_dict_oval_trees(self, dict_oval_trees, rule):
33
        dict_oval_trees[rule] = self.create_dict_of_rule(rule)
34
35
    def _get_src_for_one_graph(self, rule):
36
        return self.get_save_src(rule + self.date)
37
38
    def prepare_parser(self):
39
        super().prepare_parser()
40
        self.prepare_args_when_output_is_html()
41
        self.prepare_args_when_user_can_list_in_rules()
42