BlueBrain/BluePyOpt

View on GitHub
bluepyopt/ephys/create_acc.py

Summary

Maintainability
F
4 days
Test Coverage

File create_acc.py has 772 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""create JSON/ACC files for Arbor from a set of BluePyOpt.ephys parameters"""

# pylint: disable=R0914

import io
Severity: Major
Found in bluepyopt/ephys/create_acc.py - About 1 day to fix

    Function _translate_mech has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        def _translate_mech(cls, mech_name, mech_params, arb_cats):
            """Translate NMODL mechanism to Arbor ACC format
    
            Args:
                mech_name (): NMODL mechanism name (suffix)
    Severity: Minor
    Found in bluepyopt/ephys/create_acc.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

    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 create_acc has 13 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def create_acc(
    Severity: Major
    Found in bluepyopt/ephys/create_acc.py - About 1 hr to fix

      Function _separate_global_properties has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _separate_global_properties(cls, loc, mechs):
              """Separates global properties from a label-specific dict of mechanisms
      
              Args:
                  loc (): An Arbor label describing the location
      Severity: Minor
      Found in bluepyopt/ephys/create_acc.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 create_acc has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def create_acc(
          mechs,
          parameters,
          morphology=None,
          morphology_dir=None,
      Severity: Minor
      Found in bluepyopt/ephys/create_acc.py - About 1 hr to fix

        Function _read_templates has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def _read_templates(template_dir, template_filename):
            """Expand Jinja2 template filepath with glob and
            return dict of target filename -> parsed template"""
            if template_dir is None:
                template_dir = (
        Severity: Minor
        Found in bluepyopt/ephys/create_acc.py - About 55 mins 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 _load_catalogue_meta has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _load_catalogue_meta(cat_dir):
                """Load mechanism catalogue metadata from NMODL files
        
                Args:
                    cat_dir (): Path to directory with NMODL files of catalogue
        Severity: Minor
        Found in bluepyopt/ephys/create_acc.py - About 55 mins 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 write_acc has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def write_acc(
        Severity: Major
        Found in bluepyopt/ephys/create_acc.py - About 50 mins to fix

          Function format has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def format(cls, param, mechs):
                  """Find a parameter's mechanism and convert name to Arbor format
          
                  Args:
                      param (): A parameter in Neuron format
          Severity: Minor
          Found in bluepyopt/ephys/create_acc.py - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                                  if isinstance(mech_param, RangeIExpr):
                                      remaining_mech_params.append(
                                          RangeIExpr(
                                              name=mech_param.name,
                                              value=None,
          Severity: Major
          Found in bluepyopt/ephys/create_acc.py - About 45 mins to fix

            Function _load_mech_catalogue_meta has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def _load_mech_catalogue_meta(cls, ext_catalogues):
                    """Load metadata of external and Arbor's built-in mechanism catalogues
            
                    Args:
                        ext_catalogues (): Mapping of catalogue name to directory
            Severity: Minor
            Found in bluepyopt/ephys/create_acc.py - About 25 mins 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 write_acc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def write_acc(
                output_dir,
                cell,
                parameters,
                template_filename="acc/*_template.jinja2",
            Severity: Minor
            Found in bluepyopt/ephys/create_acc.py - About 25 mins 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

            There are no issues that match your filters.

            Category
            Status