IBM/pytorchpipe

View on GitHub
ptp/configuration/config_parsing.py

Summary

Maintainability
A
3 hrs
Test Coverage

Function recurrent_config_parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def recurrent_config_parse(configs_to_parse: list, configs_parsed: list, abs_config_path: str):
    """
    Parses names of configuration files in a recursive manner, i.e. \
    by looking for ``default_config`` sections and trying to load and parse those \
    files one by one.
Severity: Minor
Found in ptp/configuration/config_parsing.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get_value_list_from_dictionary has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def get_value_list_from_dictionary(key, parameter_dict, accepted_values = []):
    """
    Parses parameter values retrieved from a given parameter dictionary using key.
    Optionally, checks is all values are accepted.

Severity: Minor
Found in ptp/configuration/config_parsing.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function export_experiment_configuration_to_yml has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def export_experiment_configuration_to_yml(logger, log_dir, filename, config_interface_obj, user_confirm):
Severity: Minor
Found in ptp/configuration/config_parsing.py - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status