lighthouse_garden.illuminate.Lighthouse.__init__()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 24
rs 9.65
c 0
b 0
f 0
cc 2
nop 5
1
#!/usr/bin/env python3
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# -*- coding: future_fstrings -*-
3
4
from lighthouse_garden.utility import info, system
5
from lighthouse_garden.lighthouse import process
6
from lighthouse_garden.export import render
7
8
9
class Lighthouse:
10
    """
11
    Fetch lighthouse performance data.
12
    """
13
    def __init__(self,
0 ignored issues
show
Bug Best Practice introduced by
The default value {} might cause unintended side-effects.

Objects as default values are only created once in Python and not on each invocation of the function. If the default object is modified, this modification is carried over to the next invocation of the method.

# Bad:
# If array_param is modified inside the function, the next invocation will
# receive the modified object.
def some_function(array_param=[]):
    # ...

# Better: Create an array on each invocation
def some_function(array_param=None):
    array_param = array_param or []
    # ...
Loading history...
14
                 config_file=None,
15
                 verbose=False,
16
                 clear=False,
17
                 config={}
18
                 ):
19
        """
20
        Initialization
21
        :param config_file: String
22
        :param verbose: Boolean
23
        :param clear: Boolean
24
        :param config:
25
        """
26
        info.print_header()
27
        system.check_args(config_file=config_file,
28
                          verbose=verbose)
29
        system.check_config(config)
30
        if not clear:
31
            system.check_lighthouse_version()
32
            process.fetch_data()
33
            render.generate_dashboard()
34
            info.print_footer()
35
        else:
36
            system.clear_data()
37
0 ignored issues
show
coding-style introduced by
Trailing newlines
Loading history...
38