BlueBrain/BluePyOpt

View on GitHub

Showing 233 of 415 total issues

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

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

    """CMA Optimisation class"""
    
    """
    Copyright (c) 2016-2022, EPFL/Blue Brain Project
    
    
    Severity: Minor
    Found in bluepyopt/deapext/optimisationsCMA.py - About 3 hrs to fix

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

        def create_param_fields_list():
            """Create fields for param.json"""
        
            import collections
            param_configs = json.load(open('parameters.json'))
        Severity: Minor
        Found in examples/l5pc/create_tables.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

        File simulators.py has 290 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """Simulator classes"""
        
        # pylint: disable=W0511
        
        import ctypes
        Severity: Minor
        Found in bluepyopt/ephys/simulators.py - About 2 hrs to fix

          Function do_setup has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
          Open

          def do_setup():
              """Main VCS-independent setup function for installing Versioneer."""
              root = get_root()
              try:
                  cfg = get_config_from_root(root)
          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 __init__ has 23 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(
          Severity: Major
          Found in bluepyopt/ephys/efeatures.py - About 2 hrs to fix

            Function extract_nrn_seclists has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                def extract_nrn_seclists(icell, seclists):
                    '''Extract section lists from an instantiated cell (axon replacement)
            
                    Args:
                        icell (): Instantiated cell model in the NEURON simulator.
            Severity: Minor
            Found in bluepyopt/ephys/morphologies.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 main has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            def main():
                """Main"""
            
                fixed_params = json.load(open('fixed_params.json'))
                params = json.load(open('params.json'))
            Severity: Minor
            Found in examples/l5pc/convert_params.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 get_versions has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_versions(verbose=False):
                """Get the project version from whatever source is available.
            
                Returns dict with two keys: 'version' and 'full'.
                """
            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_feature has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def calculate_feature(
                        self,
                        responses,
                        raise_warnings=False,
                        return_waveforms=False,
            Severity: Minor
            Found in bluepyopt/ephys/efeatures.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 instantiate_iclamp_stimuli has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                def instantiate_iclamp_stimuli(self, decor, use_labels=False):
                    """Instantiate iclamp stimuli"""
            
                    for i, stim in enumerate(self.stimuli):
                        if not isinstance(stim, stimuli.SynapticStimulus):
            Severity: Minor
            Found in bluepyopt/ephys/protocols.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 instantiate_locations has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                def instantiate_locations(self, label_dict):
                    """Instantiate protocol (stimuli/recordings) locations on label_dict"""
            
                    stim_rec_labels = []
            
            
            Severity: Minor
            Found in bluepyopt/ephys/protocols.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 run_command has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
                            env=None):
                """Call the given command(s)."""
                assert isinstance(commands, list)
                p = None
            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 time_above_threshold has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            def time_above_threshold(protocol, param):
                """Compute time spent by calcium above the potentiation and depression
                thresholds.
            
                :param protocol: stdputil.Protocol
            Severity: Minor
            Found in examples/graupnerbrunelstdp/stdputil.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 run_command has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            def run_command(
                commands, args, cwd=None, verbose=False, hide_stderr=False, env=None
            ):
                """Call the given command(s)."""
                assert isinstance(commands, list)
            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 get_extra_params has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            def get_extra_params(loc, mechs):
                extra_params = {
                    p['param_name']: p['type'] for p in all_parameters
                    if p['type'] == 'global'
                    }
            Severity: Minor
            Found in examples/l5pc/l5pc_validate_neuron_arbor_pm.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_parameters has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

            def create_parameters(param_configs):
                parameters = []
            
                for param_config in param_configs:
                    if 'value' in param_config:
            Severity: Minor
            Found in examples/l5pc/l5pc_model.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 run has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def run(
                        self,
                        cell_model,
                        param_values,
                        sim=None,
            Severity: Minor
            Found in bluepyopt/ephys/protocols.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 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

            Severity
            Category
            Status
            Source
            Language