1 | #!/usr/bin/env python3 |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
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
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 []
# ...
![]() |
|||
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
|
|||
38 |