Showing 66 of 1,425 total issues

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

    def _get_base_query(self, record_type):
        '''
        Set up a query object containing the logic which is common for
        all users of this DbUnloader.
        '''
Severity: Minor
Found in apel/db/unloader.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 get_ur has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_ur(self):
        '''
        Returns the SummaryRecord in AUR format.  See
        https://twiki.cern.ch/twiki/bin/view/EMI/ComputeAccounting

Severity: Minor
Found in apel/db/records/summary.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 runprocess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def runprocess(db_config_file, config_file, log_config_file):
    '''Parse the configuration file and start the loader.'''

    # Read configuration from file
    cp = ConfigParser.ConfigParser()
Severity: Minor
Found in bin/dbloader.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 check_empty_dirs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def check_empty_dirs(q):
    empty_dirs = []
    path = q.path
    print "Checking path %s " % path
    for item in os.listdir(path):
Severity: Minor
Found in scripts/msg_status.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 _normalise_memory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _normalise_memory(self, mem):
        """Strip unit prefix and return memory size as int in KB."""

        # Accepted prefixes and their power of 1024 relative to KB.
        unit_prefixes = {'K': 0, 'M': 1, 'G': 2, 'T': 3, 'P': 4}
Severity: Minor
Found in apel/parsers/slurm.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 get_ur has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_ur(self):
        '''
        Returns the NormalisedSummaryRecord in AUR format. See
        https://twiki.cern.ch/twiki/bin/view/EMI/ComputeAccounting

Severity: Minor
Found in apel/db/records/normalised_summary.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

Severity
Category
Status
Source
Language