Passed
Pull Request — master (#156)
by Jan
04:02
created

JsonToHtml.prepare_parser()   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nop 1
dl 0
loc 3
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1 1
from ..converter import Converter
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
introduced by
import missing from __future__ import absolute_import
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
7 1
class JsonToHtml(ClientHtmlOutput, ClientJsonInput):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
Bug introduced by
The method _get_lines_of_wanted_not_selected_rules which was declared abstract in the super-class Client
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
Bug introduced by
The method get_only_fail_rule which was declared abstract in the super-class Client
was not overridden.

Methods which raise NotImplementedError should be overridden in concrete child classes.

Loading history...
8 1
    def __init__(self, args):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
9 1
        super().__init__(args)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
10 1
        self.oval_tree = None
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
11
12 1
    def _get_message(self):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
13 1
        return {
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
14
            'description': 'Client for visualization of JSON created by command arf-to-json',
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (93/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
15
            'source_filename': 'JSON file',
16
        }
17
18 1
    def load_json_to_oval_tree(self, rule):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
introduced by
Missing function or method docstring
Loading history...
19 1
        dict_of_tree = self.json_data_file[rule]
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
20 1
        try:
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
21 1
            return restore_dict_to_tree(dict_of_tree)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 12 tabs, expected 3
Loading history...
22 1
        except Exception:
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
23 1
            raise ValueError('Data is not valid for OVAL tree.')
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 12 tabs, expected 3
Loading history...
introduced by
Consider explicitly re-raising using the 'from' keyword
Loading history...
24
25 1
    def create_dict_of_oval_node(self, oval_node):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
introduced by
Missing function or method docstring
Loading history...
26 1
        converter = Converter(oval_node)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
27 1
        return converter.to_JsTree_dict(self.hide_passing_tests)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
28
29 1
    def create_dict_of_rule(self, rule):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
introduced by
Missing function or method docstring
Loading history...
30 1
        self.oval_tree = self.load_json_to_oval_tree(rule)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
31 1
        return self.create_dict_of_oval_node(self.oval_tree)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
32
33 1
    def _put_to_dict_oval_trees(self, dict_oval_trees, rule):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
34 1
        dict_oval_trees[rule.replace(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
35
            self.start_of_file_name, '')] = self.create_dict_of_rule(rule)
36
37 1
    def _get_src_for_one_graph(self, rule):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
38 1
        return self.get_save_src(rule.replace(self.start_of_file_name, ''))
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
39
40 1
    def prepare_parser(self):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
41 1
        super().prepare_parser()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
42
        self.prepare_args_when_output_is_html()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
43