BlueBrain/BluePyOpt

View on GitHub
bluepyopt/ephys/create_hoc.py

Summary

Maintainability
D
1 day
Test Coverage

Function _generate_parameters has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

def _generate_parameters(parameters, location_order, loc_desc):
    """Create a list of parameters that need to be added to the hoc template"""
    param_locations = defaultdict(list)
    global_params = {}
    for param in parameters:
Severity: Minor
Found in bluepyopt/ephys/create_hoc.py - About 6 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

File create_hoc.py has 296 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'''create a hoc file from a set of BluePyOpt.ephys parameters'''

# pylint: disable=R0914

import os
Severity: Minor
Found in bluepyopt/ephys/create_hoc.py - About 3 hrs to fix

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

    def _loc_desc(location, param_or_mech):
        """Generate Neuron location description for HOC template"""
    
        if isinstance(param_or_mech, Mechanism):
            if isinstance(param_or_mech, NrnMODMechanism):
    Severity: Minor
    Found in bluepyopt/ephys/create_hoc.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 create_hoc has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_hoc(mechs,
    Severity: Major
    Found in bluepyopt/ephys/create_hoc.py - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          for loc in locs:
                              param_locations[loc].append(param)
      
      
      Severity: Major
      Found in bluepyopt/ephys/create_hoc.py - About 45 mins to fix

        Function _get_template_params has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def _get_template_params(
        Severity: Minor
        Found in bluepyopt/ephys/create_hoc.py - About 45 mins to fix

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

          def _generate_channels_by_location(mechs, location_order, loc_desc):
              """Create a OrderedDictionary of all channel mechs for hoc template."""
              channels = OrderedDict((location, []) for location in location_order)
              point_channels = OrderedDict((location, []) for location in location_order)
              for mech in mechs:
          Severity: Minor
          Found in bluepyopt/ephys/create_hoc.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