BlueBrain/BluePyOpt

View on GitHub

Showing 415 of 415 total issues

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 extra_features_utils.py has 407 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Extra features functions"""

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

Severity: Minor
Found in bluepyopt/ephys/extra_features_utils.py - About 5 hrs to fix

    File _version.py has 391 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # This file helps to compute a version number in source trees obtained from
    # git-archive tarball (such as those provided by githubs download-from-tag
    # feature). Distribution tarballs (built by setup.py sdist) and build
    # directories (produced by setup.py build) will contain a much shorter file
    # that just contains the computed version number.
    Severity: Minor
    Found in bluepyopt/_version.py - About 5 hrs to fix

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          if 'holding' in protocol_definition['stimuli']:
              holding_definition = protocol_definition[
                  'stimuli']['holding']
              holding_stimulus = ephys.stimuli.NrnSquarePulse(
                  step_amplitude=holding_definition['amp'],
      Severity: Major
      Found in examples/thalamocortical-cell/CellEvalSetup/evaluator.py and 1 other location - About 5 hrs to fix
      examples/thalamocortical-cell/CellEvalSetup/evaluator.py on lines 55..65

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 90.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      def render_git_describe_long(pieces):
          """TAG-DISTANCE-gHEX[-dirty].
      
          Like 'git describe --tags --dirty --always -long'.
          The distance/hash is unconditional.
      Severity: Major
      Found in bluepyopt/_version.py and 1 other location - About 5 hrs to fix
      versioneer.py on lines 1425..1442

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 90.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

      def render_git_describe_long(pieces):
          """TAG-DISTANCE-gHEX[-dirty].
      
          Like 'git describe --tags --dirty --always -long'.
          The distance/hash is unconditional.
      Severity: Major
      Found in versioneer.py and 1 other location - About 5 hrs to fix
      bluepyopt/_version.py on lines 442..459

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 90.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          if 'holding' in protocol_definition['stimuli']:
              holding_definition = protocol_definition[
                  'stimuli']['holding']
              holding_stimulus = ephys.stimuli.NrnSquarePulse(
                  step_amplitude=holding_definition['amp'],
      Severity: Major
      Found in examples/thalamocortical-cell/CellEvalSetup/evaluator.py and 1 other location - About 5 hrs to fix
      examples/thalamocortical-cell/CellEvalSetup/evaluator.py on lines 88..98

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 90.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      File stimuli.py has 362 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """Stimuli classes"""
      
      """
      Copyright (c) 2016-2020, EPFL/Blue Brain Project
      
      
      Severity: Minor
      Found in bluepyopt/ephys/stimuli.py - About 4 hrs to fix

        Function create_protocols has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        def create_protocols(protocol_definitions, do_replace_axon=None, sim='nrn'):
        
            protocols = {}
        
            if sim == 'nrn':
        Severity: Minor
        Found in examples/l5pc/l5pc_evaluator.py - About 4 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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            for i in range(3):
                dirname = os.path.basename(root)
                if dirname.startswith(parentdir_prefix):
                    return {
                        "version": dirname[len(parentdir_prefix) :],
        Severity: Major
        Found in versioneer.py and 1 other location - About 4 hrs to fix
        bluepyopt/_version.py on lines 116..124

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 81.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            for i in range(3):
                dirname = os.path.basename(root)
                if dirname.startswith(parentdir_prefix):
                    return {"version": dirname[len(parentdir_prefix):],
                            "full-revisionid": None,
        Severity: Major
        Found in bluepyopt/_version.py and 1 other location - About 4 hrs to fix
        versioneer.py on lines 1218..1230

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 81.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        def render_pep440_pre(pieces):
            """TAG[.post.devDISTANCE] -- No -dirty.
        
            Exceptions:
            1: no tags. 0.post.devDISTANCE
        Severity: Major
        Found in bluepyopt/_version.py and 2 other locations - About 4 hrs to fix
        bluepyopt/_version.py on lines 356..370
        versioneer.py on lines 1324..1337

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 80.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        def render_pep440_pre(pieces):
            """TAG[.post.devDISTANCE] -- No -dirty.
        
            Exceptions:
            1: no tags. 0.post.devDISTANCE
        Severity: Major
        Found in versioneer.py and 2 other locations - About 4 hrs to fix
        bluepyopt/_version.py on lines 340..353
        bluepyopt/_version.py on lines 356..370

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 80.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        def render_pep440_minor(pieces):
            """TAG[.DISTANCE] . No -dirty
        
            Exceptions:
            1: no tags. 0.DISTANCE
        Severity: Major
        Found in bluepyopt/_version.py and 2 other locations - About 4 hrs to fix
        bluepyopt/_version.py on lines 340..353
        versioneer.py on lines 1324..1337

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 80.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            def get_population(self, to_space):
                """Returns the population in the original parameter space"""
                pop = copy.deepcopy(self.population)
                for i, ind in enumerate(pop):
                    for j, v in enumerate(ind):
        Severity: Major
        Found in bluepyopt/deapext/CMA_SO.py and 2 other locations - About 4 hrs to fix
        bluepyopt/deapext/CMA_MO.py on lines 211..217
        bluepyopt/deapext/CMA_MO.py on lines 219..225

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 79.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            def get_population(self, to_space):
                """Returns the population in the original parameter space"""
                pop = copy.deepcopy(self.population)
                for i, ind in enumerate(pop):
                    for j, v in enumerate(ind):
        Severity: Major
        Found in bluepyopt/deapext/CMA_MO.py and 2 other locations - About 4 hrs to fix
        bluepyopt/deapext/CMA_MO.py on lines 219..225
        bluepyopt/deapext/CMA_SO.py on lines 191..197

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 79.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

            def get_parents(self, to_space):
                """Returns the population in the original parameter space"""
                pop = copy.deepcopy(self.parents)
                for i, ind in enumerate(pop):
                    for j, v in enumerate(ind):
        Severity: Major
        Found in bluepyopt/deapext/CMA_MO.py and 2 other locations - About 4 hrs to fix
        bluepyopt/deapext/CMA_MO.py on lines 211..217
        bluepyopt/deapext/CMA_SO.py on lines 191..197

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 79.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if arg_names is None:
                row = df['buffers'][0]
                count = len(sqlitedb._convert_bufs(row[3])[0])
                arg_names = ['arg_%02d' % i for i in range(count)]
        Severity: Major
        Found in examples/l5pc/tasks2dataframe.py and 1 other location - About 4 hrs to fix
        examples/l5pc/tasks2dataframe.py on lines 46..49

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 77.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            if result_names is None:
                row = df['result_buffers'][0]
                count = len(sqlitedb._convert_bufs(row[0])[0])
                result_names = ['res_%02d' % i for i in range(count)]
        Severity: Major
        Found in examples/l5pc/tasks2dataframe.py and 1 other location - About 4 hrs to fix
        examples/l5pc/tasks2dataframe.py on lines 31..34

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 77.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            axes = fig.add_axes(
                (box['left'] + left_margin,
                 box['bottom'] + bottom_margin,
                 box['width'] - left_margin - right_margin,
                 box['height'] - bottom_margin - top_margin))
        Severity: Major
        Found in examples/l5pc/l5pc_analysis.py and 2 other locations - About 4 hrs to fix
        examples/l5pc/l5pc_analysis.py on lines 202..206
        examples/l5pc/l5pc_analysis.py on lines 279..283

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 76.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language