Ensembl/ensembl-hive

View on GitHub

Showing 11 of 446 total issues

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

    def subst_all_hashpairs(self, structure, callback):
        """
        Parse "structure" and replace all the pairs of hashes by the result of calling callback() on the pair content
        #expr()expr# are treated differently by calling subst_one_hashpair()
        The result is a string (like structure)
Severity: Minor
Found in wrappers/python3/eHive/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

File Process.py has 254 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import eHive.Params

import os
import sys
import json
Severity: Minor
Found in wrappers/python3/eHive/Process.py - About 2 hrs to fix

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

        def param_substitute(self, structure):
            """
            Take any structure and replace the pairs of hashes with the values of the parameters / expression they represent
            Compatible types: numbers, strings, lists, dictionaries (otherwise, ParamSubstitutionException is raised)
            """
    Severity: Minor
    Found in wrappers/python3/eHive/Params.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 subst_one_hashpair has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def subst_one_hashpair(self, inside_hashes, is_expr):
            """
            Run the parameter substitution for a single pair of hashes.
            Here, we only need to handle #expr()expr#, #func:params# and #param_name#
            as each condition has been parsed in the other methods
    Severity: Minor
    Found in wrappers/python3/eHive/Params.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 __main has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def __main():
        seed_params = [
            ('alpha' , 2),
            ('beta' , 5),
            ('delta' , '#expr( #alpha#*#beta# )expr#'),
    Severity: Minor
    Found in wrappers/python3/eHive/Params.py - About 1 hr to fix

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

          def __job_life_cycle(self, config):
              """Job's life-cycle. See GuestProcess for a description of the protocol to communicate with the parent"""
              self.__print_debug("__life_cycle")
      
              # Params
      Severity: Minor
      Found in wrappers/python3/eHive/Process.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 __main has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def __main():
          seed_params = [
              ('alpha' , 2),
              ('beta' , 5),
              ('delta' , '#expr( #alpha#*#beta# )expr#'),
      Severity: Minor
      Found in wrappers/python3/eHive/Params.py - About 35 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 too many return statements within this function.
      Open

                          return structure
      Severity: Major
      Found in wrappers/python3/eHive/Params.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return self.subst_all_hashpairs(structure, lambda middle_param: self.subst_one_hashpair(middle_param, False) )
        Severity: Major
        Found in wrappers/python3/eHive/Params.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return self.subst_one_hashpair(structure[1:-1], True)
          Severity: Major
          Found in wrappers/python3/eHive/Params.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                            return self.subst_one_hashpair(structure[1:-1], False)
            Severity: Major
            Found in wrappers/python3/eHive/Params.py - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language