BlueBrain/BluePyOpt

View on GitHub

Showing 233 of 415 total issues

Function main has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def main():  # pylint: disable=too-many-statements
    """Main"""
    args = get_parser().parse_args()

    if args.verbose > 2:
Severity: Minor
Found in examples/l5pc/opt_l5pc.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 visit_Call has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def visit_Call(self, node):
        func = node.func
        if isinstance(func, ast.Attribute):
            if isinstance(func.value, ast.Name):
                if func.value.id == 'math':
Severity: Minor
Found in bluepyopt/ephys/parameterscalers/acc_iexpr.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 git_get_keywords has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def git_get_keywords(versionfile_abs):
    """Extract version information from the given file."""
    # the code embedded in _version.py can just fetch the value of these
    # keywords. When used from setup.py, we don't want to import _version.py,
    # so we do it with a regexp instead. This function is not used from
Severity: Minor
Found in versioneer.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 create_acc has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def create_acc(
    mechs,
    parameters,
    morphology=None,
    morphology_dir=None,
Severity: Minor
Found in bluepyopt/ephys/create_acc.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 git_pieces_from_vcs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
    """Get version from 'git describe' in the root of the source tree.

    This only gets called if the git-archive 'subst' keywords were *not*
    expanded, and _version.py hasn't already been rewritten with a short
Severity: Minor
Found in bluepyopt/_version.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 git_versions_from_keywords has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def git_versions_from_keywords(keywords, tag_prefix, verbose):
    """Get version information from git keywords."""
    if not keywords:
        raise NotThisMethod("no keywords at all, weird")
    date = keywords.get("date")
Severity: Minor
Found in bluepyopt/_version.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 define_fitness_calculator has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def define_fitness_calculator(protocols):
    """Define fitness calculator"""

    feature_definitions = json.load(
        open(
Severity: Minor
Found in examples/l5pc/l5pc_evaluator.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 git_versions_from_keywords has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def git_versions_from_keywords(keywords, tag_prefix, verbose):
    """Get version information from git keywords."""
    if not keywords:
        raise NotThisMethod("no keywords at all, weird")
    date = keywords.get("date")
Severity: Minor
Found in versioneer.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 git_pieces_from_vcs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
    """Get version from 'git describe' in the root of the source tree.

    This only gets called if the git-archive 'subst' keywords were *not*
    expanded, and _version.py hasn't already been rewritten with a short
Severity: Minor
Found in versioneer.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 calculate_features has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

def calculate_features(
    waveforms,
    sampling_frequency,
    upsample=None,
    feature_names=None,
Severity: Minor
Found in bluepyopt/ephys/extra_features_utils.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

File mechanisms.py has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
Mechanism classes

Theses classes represent mechanisms in the model
"""
Severity: Minor
Found in bluepyopt/ephys/mechanisms.py - About 2 hrs to fix

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

        def __init__(
    Severity: Major
    Found in examples/thalamocortical-cell/CellEvalSetup/evaluator.py - About 2 hrs to fix

      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 create_feature_fields has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        def create_feature_fields():
            """Create fields for param.json"""
        
            features = json.load(open('features.json'))
        
        
        Severity: Minor
        Found in examples/l5pc/create_tables.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 eaAlphaMuPlusLambdaCheckpoint has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        def eaAlphaMuPlusLambdaCheckpoint(
                population,
                toolbox,
                mu,
                cxpb,
        Severity: Minor
        Found in bluepyopt/deapext/algorithms.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 hypesub has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        def hypesub(la, A, actDim, bounds, pvec, alpha, k):
            """HypE algorithm sub function"""
        
            h = numpy.zeros(la)
            i = numpy.argsort(A[:, actDim - 1])
        Severity: Minor
        Found in bluepyopt/deapext/hype.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 run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

            def run(
                self,
                max_ngen=0,
                cp_frequency=1,
                cp_period=None,
        Severity: Minor
        Found in bluepyopt/deapext/optimisationsCMA.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 eaAlphaMuPlusLambdaCheckpoint has 14 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def eaAlphaMuPlusLambdaCheckpoint(
        Severity: Major
        Found in bluepyopt/deapext/algorithms.py - About 1 hr to fix

          Function halfwidth has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          def halfwidth(waveforms, sampling_frequency, return_idx=False):
              """
              Width of waveform at its half of amplitude.
              If the peak precedes the trough, halfwidth is negative.
          
          
          Severity: Minor
          Found in bluepyopt/ephys/extra_features_utils.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 plot_validation has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def plot_validation(opt, parameters):
              """Plot validation"""
          
              soma_loc = ephys.locations.NrnSeclistCompLocation(
                  name='soma',
          Severity: Minor
          Found in examples/l5pc/l5pc_analysis.py - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language