BlueBrain/BluePyOpt

View on GitHub

Showing 415 of 415 total issues

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

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 139..143
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

File morphologies.py has 334 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Morphology classes"""

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

Severity: Minor
Found in bluepyopt/ephys/morphologies.py - About 4 hrs to fix

    File evaluator.py has 333 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Copyright (c) 2016-2020, EPFL/Blue Brain Project
    
     This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt>
    
    
    Severity: Minor
    Found in examples/thalamocortical-cell/CellEvalSetup/evaluator.py - About 4 hrs to fix

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

                  try:
                      papermill.execute_notebook(
                          'l5pc_validate_neuron_arbor.ipynb',
                          target_file,
                          parameters=dict(mechanism_defs=mechanism_defs,
      Severity: Major
      Found in examples/l5pc/l5pc_validate_neuron_arbor_pm.py and 1 other location - About 3 hrs to fix
      examples/l5pc/l5pc_validate_neuron_arbor_pm.py on lines 154..169

      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 73.

      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

          try:
              papermill.execute_notebook(
                  'l5pc_validate_neuron_arbor.ipynb',
                  target_file,
                  parameters=dict(mechanism_defs=mechanism_defs,
      Severity: Major
      Found in examples/l5pc/l5pc_validate_neuron_arbor_pm.py and 1 other location - About 3 hrs to fix
      examples/l5pc/l5pc_validate_neuron_arbor_pm.py on lines 194..209

      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 73.

      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

      Function define_parameters has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

      def define_parameters(params_filename):
          """Define parameters"""
      
          parameters = []
      
      
      Severity: Minor
      Found in examples/thalamocortical-cell/CellEvalSetup/template.py - About 3 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

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

          for i in xrange(len(dt)):
              p = stdputil.Protocol(
                  ['post', 'post', 'pre'],
                  [11.5e-3, -dt[i] * 1e-3],
                  5.0, 100.0)
      Severity: Major
      Found in examples/graupnerbrunelstdp/test_stdputil.py and 1 other location - About 3 hrs to fix
      examples/graupnerbrunelstdp/test_stdputil.py on lines 52..57

      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 71.

      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

          for i in xrange(len(dt)):
              p = stdputil.Protocol(
                  ['post', 'post', 'pre'],
                  [11.5e-3, -dt[i] * 1e-3],
                  5.0, 30.0)
      Severity: Major
      Found in examples/graupnerbrunelstdp/test_stdputil.py and 1 other location - About 3 hrs to fix
      examples/graupnerbrunelstdp/test_stdputil.py on lines 38..43

      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 71.

      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 not hasattr(sim.neuron.h, self.name):
                  self.icell = self.create_empty_cell(
                      self.name,
                      sim=sim,
                      seclist_names=self.seclist_names,
      Severity: Major
      Found in bluepyopt/ephys/models.py and 1 other location - About 3 hrs to fix
      bluepyopt/ephys/models.py on lines 230..237

      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 69.

      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 not hasattr(sim.neuron.h, self.name):
                  self.icell = self.create_empty_cell(
                      self.name,
                      sim=sim,
                      seclist_names=self.seclist_names,
      Severity: Major
      Found in bluepyopt/ephys/models.py and 1 other location - About 3 hrs to fix
      bluepyopt/ephys/models.py on lines 764..772

      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 69.

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

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

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

            for i in range(1, k + 1):
                j = numpy.arange(1, i)
                alpha.append(numpy.prod((k - j) / (nrP - j) / i))
        Severity: Major
        Found in bluepyopt/deapext/hype.py and 1 other location - About 3 hrs to fix
        bluepyopt/deapext/hype.py on lines 69..71

        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 68.

        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

            for i in range(1, k + 1):
                j = numpy.arange(1, i)
                alpha.append(numpy.prod((k - j) / (Ps - j) / i))
        Severity: Major
        Found in bluepyopt/deapext/hype.py and 1 other location - About 3 hrs to fix
        bluepyopt/deapext/hype.py on lines 99..101

        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 68.

        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

        Function _create_sim_desc has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def _create_sim_desc(self, param_values,
                                 ignored_globals=(), template=None,
                                 disable_banner=False,
                                 template_dir=None,
                                 extra_params=None,
        Severity: Minor
        Found in bluepyopt/ephys/models.py - About 3 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 stimulus_definition in protocol_definition['stimuli']:
                            stimuli.append(ephys.stimuli.NrnSquarePulse(
                                step_amplitude=stimulus_definition['amp'],
                                step_delay=stimulus_definition['delay'],
                                step_duration=stimulus_definition['duration'],
        Severity: Major
        Found in examples/thalamocortical-cell/CellEvalSetup/evaluator.py and 1 other location - About 3 hrs to fix
        examples/l5pc/l5pc_evaluator.py on lines 111..117

        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 67.

        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 stimulus_definition in protocol_definition['stimuli']:
                    stimuli.append(ephys.stimuli.NrnSquarePulse(
                        step_amplitude=stimulus_definition['amp'],
                        step_delay=stimulus_definition['delay'],
                        step_duration=stimulus_definition['duration'],
        Severity: Major
        Found in examples/l5pc/l5pc_evaluator.py and 1 other location - About 3 hrs to fix
        examples/thalamocortical-cell/CellEvalSetup/evaluator.py on lines 139..145

        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 67.

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

        # -*- coding: utf-8 -*-
        """
        Created on Wed Jun 12 17:33:41 2013.
        
        Utility functions for calcium-based STDP using simplified calcium model as in
        Severity: Minor
        Found in examples/graupnerbrunelstdp/stdputil.py - About 3 hrs to fix

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

                  if self.use_scoop:
                      if self.map_function:
                          raise Exception(
                              "Impossible to use scoop is providing self defined map "
                              "function: %s" % self.map_function
          Severity: Major
          Found in bluepyopt/deapext/optimisationsCMA.py and 1 other location - About 3 hrs to fix
          bluepyopt/deapext/optimisations.py on lines 240..251

          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 65.

          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 self.use_scoop:
                      if self.map_function:
                          raise Exception(
                              'Impossible to use scoop is providing self '
                              'defined map function: %s' %
          Severity: Major
          Found in bluepyopt/deapext/optimisations.py and 1 other location - About 3 hrs to fix
          bluepyopt/deapext/optimisationsCMA.py on lines 229..241

          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 65.

          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