HunterMcGushion/hyperparameter_hunter

View on GitHub
hyperparameter_hunter/keys/makers.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function handle_complex_types has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_complex_types(self):
        """Locate complex types in :attr:`parameters`, create hashes for them, add lookup entries
        linking their original values to their hashes, then update their values in
        :attr:`parameters` to their hashes to facilitate Description saving"""
        dataframe_hashes = {}
Severity: Minor
Found in hyperparameter_hunter/keys/makers.py - About 3 hrs 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 does_key_exist has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def does_key_exist(self):
        """Check that 1) there is a file for :attr:`cross_experiment_key.key`, 2) the aforementioned
        file contains the key :attr:`key`, and 3) the value at :attr:`key` is a non-empty list

        Returns
Severity: Minor
Found in hyperparameter_hunter/keys/makers.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

Avoid too many return statements within this function.
Open

            return (key, value)
Severity: Major
Found in hyperparameter_hunter/keys/makers.py - About 30 mins to fix

    Function validate_environment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_environment(self):
            """Check that the currently active Environment is suitable"""
            if G.Env is None:
                raise EnvironmentInactiveError("")
            if not all([hasattr(G.Env, _) for _ in ["result_paths", "cross_experiment_key"]]):
    Severity: Minor
    Found in hyperparameter_hunter/keys/makers.py - About 25 mins 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

    There are no issues that match your filters.

    Category
    Status