lighthouse_garden.__main__.get_arguments()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 21
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 21
rs 9.65
c 0
b 0
f 0
cc 1
nop 1
1
#!/usr/bin/env python3
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
# -*- coding: future_fstrings -*-
3
4
import argparse, sys, os
0 ignored issues
show
introduced by
Multiple imports on one line (argparse, sys, os)
Loading history...
5
from collections import defaultdict
0 ignored issues
show
Unused Code introduced by
Unused defaultdict imported from collections
Loading history...
6
# Workaround for ModuleNotFoundError
7
sys.path.append(os.getcwd())
8
from lighthouse_garden import illuminate
0 ignored issues
show
introduced by
Import "from lighthouse_garden import illuminate" should be placed at the top of the module
Loading history...
9
10
11
def main(args={}):
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...
12
    """
13
    Main entry point for the command line. Parse the arguments and call to the main process.
14
    :param args:
15
    :return:
16
    """
17
    args = get_arguments(args)
18
    illuminate.Lighthouse(
19
        verbose=args.verbose,
20
        config_file=args.config,
21
        clear=args.clear
22
    )
23
24
25
def get_arguments(args):
0 ignored issues
show
Unused Code introduced by
The argument args seems to be unused.
Loading history...
26
    """
27
    Parses and returns script arguments
28
    :param args:
29
    :return:
30
    """
31
    parser = argparse.ArgumentParser(prog='lighthouse_garden', description='Monitoring performance data by lighthouse.')
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (120/100).

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

Loading history...
32
    parser.add_argument('-v', '--verbose',
33
                        help='Enable extended console output',
34
                        required=False,
35
                        action='store_true')
36
    parser.add_argument('-c', '--config',
37
                        help='Path to config file',
38
                        required=False,
39
                        type=str)
40
    parser.add_argument('--clear',
41
                        help='Clear all performance data and reset the application',
42
                        required=False,
43
                        action='store_true')
44
45
    return parser.parse_args()
46
47
48
if __name__ == "__main__":
49
    main()
50