Ensembl/ensembl-hive

View on GitHub

Showing 446 of 446 total issues

Cyclomatic complexity is too high in method param_substitute. (16)
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 by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method __job_life_cycle. (12)
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 by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in method test_job_param. (10)
Open

    def test_job_param(self):
        class FakeRunnableWithParams(BaseRunnable):
            def __init__(self, d):
                self._BaseRunnable__params = eHive.Params.ParamContainer(d)
                self.input_job = Job()
Severity: Minor
Found in wrappers/python3/eHive/Process.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in class RunnableTest. (10)
Open

class RunnableTest(unittest.TestCase):
    def test_job_param(self):
        class FakeRunnableWithParams(BaseRunnable):
            def __init__(self, d):
                self._BaseRunnable__params = eHive.Params.ParamContainer(d)
Severity: Minor
Found in wrappers/python3/eHive/Process.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

Cyclomatic complexity is too high in method subst_all_hashpairs. (8)
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 by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in function __main. (8)
Open

def __main():
    seed_params = [
        ('alpha' , 2),
        ('beta' , 5),
        ('delta' , '#expr( #alpha#*#beta# )expr#'),
Severity: Minor
Found in wrappers/python3/eHive/Params.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

    Cyclomatic complexity is too high in method subst_one_hashpair. (7)
    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 by radon

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    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

              Line too long (100 > 79 characters)
              Open

                      return 'Cannot substitute elements in objects of type "{0}"'.format(str(type(self.args[0])))
              Severity: Minor
              Found in wrappers/python3/eHive/Params.py by pep8

              Limit all lines to a maximum of 79 characters.

              There are still many devices around that are limited to 80 character
              lines; plus, limiting windows to 80 characters makes it possible to
              have several windows side-by-side.  The default wrapping on such
              devices looks ugly.  Therefore, please limit all lines to a maximum
              of 79 characters. For flowing long blocks of text (docstrings or
              comments), limiting the length to 72 characters is recommended.
              
              Reports error E501.

              Line too long (97 > 79 characters)
              Open

                          if structure[0] == '#' and structure[-1] == '#' and structure.count('#', 1, -1) == 0:
              Severity: Minor
              Found in wrappers/python3/eHive/Params.py by pep8

              Limit all lines to a maximum of 79 characters.

              There are still many devices around that are limited to 80 character
              lines; plus, limiting windows to 80 characters makes it possible to
              have several windows side-by-side.  The default wrapping on such
              devices looks ugly.  Therefore, please limit all lines to a maximum
              of 79 characters. For flowing long blocks of text (docstrings or
              comments), limiting the length to 72 characters is recommended.
              
              Reports error E501.
              Severity
              Category
              Status
              Source
              Language