BlueBrain/BluePyOpt

View on GitHub
bluepyopt/ephys/efeatures.py

Summary

Maintainability
D
2 days
Test Coverage

File efeatures.py has 525 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""eFeature classes"""

"""
Copyright (c) 2016-2020, EPFL/Blue Brain Project

Severity: Major
Found in bluepyopt/ephys/efeatures.py - About 1 day to fix

    Function __init__ has 23 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in bluepyopt/ephys/efeatures.py - About 2 hrs to fix

      Function calculate_feature has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def calculate_feature(
                  self,
                  responses,
                  raise_warnings=False,
                  return_waveforms=False,
      Severity: Minor
      Found in bluepyopt/ephys/efeatures.py - About 2 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 __init__ has 16 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Major
      Found in bluepyopt/ephys/efeatures.py - About 2 hrs to fix

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

            def _setup_efel(self):
                """Set up efel before extracting the feature"""
        
                import efel
                efel.reset()
        Severity: Minor
        Found in bluepyopt/ephys/efeatures.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 _construct_efel_trace has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def _construct_efel_trace(self, responses):
                """Construct trace that can be passed to eFEL"""
        
                trace = {}
                if '' not in self.recording_names:
        Severity: Minor
        Found in bluepyopt/ephys/efeatures.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 calculate_score has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def calculate_score(self, responses, trace_check=False):
                """Calculate the score"""
        
                if (
                        responses[self.recording_names[""].replace("soma.v",
        Severity: Minor
        Found in bluepyopt/ephys/efeatures.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 _setup_efel has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _setup_efel(self):
                """Set up efel before extracting the feature"""
        
                import efel
        
        
        Severity: Minor
        Found in bluepyopt/ephys/efeatures.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

        Avoid too many return statements within this function.
        Open

                    return feature_value, mean_wf
        Severity: Major
        Found in bluepyopt/ephys/efeatures.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return feature_value
          Severity: Major
          Found in bluepyopt/ephys/efeatures.py - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status