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:
- Read upRead up
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
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):
- Read upRead up
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,
Avoid deeply nested control flow statements. Open
for loc in locs:
param_locations[loc].append(param)
Function _get_template_params
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_template_params(
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:
- Read upRead up
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"