HunterMcGushion/hyperparameter_hunter

View on GitHub
hyperparameter_hunter/environment.py

Summary

Maintainability
C
1 day
Test Coverage

Environment has 37 functions (exceeds 20 allowed). Consider refactoring.
Open

class Environment:
    DEFAULT_PARAMS = dict(
        environment_params_path=None,
        results_path=None,
        target_column="target",
Severity: Minor
Found in hyperparameter_hunter/environment.py - About 4 hrs to fix

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

        def format_result_paths(self):
            """Remove paths contained in file_blacklist, and format others to prepare for saving results"""
            if self.file_blacklist == "ALL" or self.results_path is None:
                return
    
    
    Severity: Minor
    Found in hyperparameter_hunter/environment.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 validate_file_blacklist has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def validate_file_blacklist(blacklist):
        """Validate contents of blacklist. For most values, the corresponding file is saved upon
        completion of the experiment. See the "Notes" section below for details on some special cases
    
        Parameters
    Severity: Minor
    Found in hyperparameter_hunter/environment.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 experiment_callbacks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def experiment_callbacks(self, value):
            if not isinstance(value, list):
                self._experiment_callbacks = [value]
            else:
                self._experiment_callbacks = value
    Severity: Minor
    Found in hyperparameter_hunter/environment.py - About 55 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

    Function validate_parameters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_parameters(self):
            """Ensure the provided parameters are valid and properly formatted"""
            #################### metrics_params/metrics ####################
            if (self.metrics is not None) and ("metrics" in self.metrics_params.keys()):
                raise ValueError(
    Severity: Minor
    Found in hyperparameter_hunter/environment.py - About 45 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

    Function results_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def results_path(self, value):
            self._results_path = value
            if self._results_path is None:
                G.warn("Received results_path=None. Results will not be stored at all.")
            elif isinstance(self._results_path, str):
    Severity: Minor
    Found in hyperparameter_hunter/environment.py - About 35 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