Passed
Push — master ( 6428d5...bc0e9d )
by Matěj
90:12 queued 26s
created

oval_graph.command_line_client.json_to_html   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 39
dl 0
loc 59
ccs 35
cts 35
cp 1
rs 10
c 0
b 0
f 0
wmc 11

10 Methods

Rating   Name   Duplication   Size   Complexity  
A JsonToHtml._put_to_dict_oval_trees() 0 3 1
A JsonToHtml.get_only_fail_rule() 0 6 1
A JsonToHtml.create_dict_of_oval_node() 0 3 1
A JsonToHtml._get_rows_of_unselected_rules() 0 5 1
A JsonToHtml.load_json_to_oval_tree() 0 6 2
A JsonToHtml._get_src_for_one_graph() 0 2 1
A JsonToHtml.__init__() 0 4 1
A JsonToHtml._get_message() 0 4 1
A JsonToHtml.create_dict_of_rule() 0 3 1
A JsonToHtml.prepare_parser() 0 3 1
1 1
from ..converter import Converter
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2 1
from ..oval_node import restore_dict_to_tree
3 1
from .client_html_output import ClientHtmlOutput
4 1
from .client_json_input import ClientJsonInput
5
6 1
START_OF_FILE_NAME = 'graph-of-'
7
8
9 1
class JsonToHtml(ClientHtmlOutput, ClientJsonInput):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
10 1
    def __init__(self, args):
11 1
        super().__init__(args)
12 1
        self.hide_passing_tests = self.arg.hide_passing_tests
13 1
        self.oval_tree = None
14
15 1
    def get_only_fail_rule(self, rules):
16
        """
17
        Function processes array of matched IDs of rules in selected file.
18
        Function retunes array of failed matched IDs of rules in selected file.
19
        """
20 1
        raise NotImplementedError
21
22 1
    def _get_rows_of_unselected_rules(self):
23
        """
24
        Function retunes array of rows where is not selected IDs of rules in selected file.
25
        """
26 1
        raise NotImplementedError
27
28 1
    def _get_message(self):
29 1
        return {
30
            'description': 'Client for visualization of JSON created by command arf-to-json',
31
            'source_filename': 'JSON file',
32
        }
33
34 1
    def load_json_to_oval_tree(self, rule):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
35 1
        dict_of_tree = self.json_data_file[rule]
36 1
        try:
37 1
            return restore_dict_to_tree(dict_of_tree)
38 1
        except Exception:
39 1
            raise ValueError('Data is not valid for OVAL tree.')
0 ignored issues
show
introduced by
Consider explicitly re-raising using the 'from' keyword
Loading history...
40
41 1
    def create_dict_of_oval_node(self, oval_node):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
42 1
        converter = Converter(oval_node)
43 1
        return converter.to_JsTree_dict(self.hide_passing_tests)
44
45 1
    def create_dict_of_rule(self, rule):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
46 1
        self.oval_tree = self.load_json_to_oval_tree(rule)
47 1
        return self.create_dict_of_oval_node(self.oval_tree)
48
49 1
    def _put_to_dict_oval_trees(self, dict_oval_trees, rule):
50 1
        dict_oval_trees[rule.replace(
51
            START_OF_FILE_NAME, '')] = self.create_dict_of_rule(rule)
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable START_OF_FILE_NAME does not seem to be defined.
Loading history...
52
53 1
    def _get_src_for_one_graph(self, rule):
54 1
        return self.get_save_src(rule.replace(START_OF_FILE_NAME, ''))
55
56 1
    def prepare_parser(self, parser):
57 1
        super().prepare_parser(parser)
58
        self.prepare_args_when_output_is_html(parser)
59