apel/db/records/normalised_summary.py

Summary

Maintainability
F
5 days
Test Coverage

Using Document to parse untrusted XML data is known to be vulnerable to XML attacks. Replace Document with the equivalent defusedxml package, or make sure defusedxml.defuse_stdlib() is called.
Open

from xml.dom.minidom import Document

Cyclomatic complexity is too high in method _check_fields. (13)
Open

    def _check_fields(self):
        '''
        Add extra checks to the ones in the parent class.
        '''

Severity: Minor
Found in apel/db/records/normalised_summary.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 get_ur has 51 lines of code (exceeds 25 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: Major
Found in apel/db/records/normalised_summary.py - About 2 hrs to fix

    Cyclomatic complexity is too high in class NormalisedSummaryRecord. (7)
    Open

    class NormalisedSummaryRecord(Record):
        '''
        Class to represent one normalised summary record.
    
        A normalised summary record is the same as a summary record except
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 get_ur. (7)
    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 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 _check_fields has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def _check_fields(self):
            '''
            Add extra checks to the ones in the parent class.
            '''
    
    
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 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

    Too many branches (13/12)
    Open

        def _check_fields(self):

    Used when a function or method has too many branches, making it hard to follow.

    Too many local variables (23/15)
    Open

        def get_ur(self):

    Used when a function or method has too many local variables.

    Too many statements (71/50)
    Open

        def get_ur(self):

    Used when a function or method has too many statements. You should then split it in smaller functions / methods.

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            try:
                # A bit convoluted for finding the first second in the next month.
                if (int(rc['Month']) == 12):
                    next_month_year = int(rc['Year']) + 1
                    next_month = 1
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 1 other location - About 1 day to fix
    apel/db/records/summary.py on lines 80..90

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 126.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            try:
                earliest_end = rc['EarliestEndTime']
                latest_end = rc['LatestEndTime']
                if not (month_start <= earliest_end <= month_end):
                    raise InvalidRecordException("EarliestEndTime is not within stated month.")
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 1 other location - About 5 hrs to fix
    apel/db/records/summary.py on lines 102..112

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 93.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

            if self.get_field('VOGroup') is not None:
                vogroup = doc.createElement('urf:GroupAttribute')
                vogroup.setAttribute('urf:type', 'vo-group')
                vogroup.appendChild(doc.createTextNode(self.get_field('VOGroup')))
                user_id.appendChild(vogroup)
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 8 other locations - About 3 hrs to fix
    apel/db/records/job.py on lines 213..217
    apel/db/records/job.py on lines 219..223
    apel/db/records/job.py on lines 225..229
    apel/db/records/normalised_summary.py on lines 177..181
    apel/db/records/storage.py on lines 179..183
    apel/db/records/storage.py on lines 185..189
    apel/db/records/summary.py on lines 165..169
    apel/db/records/summary.py on lines 171..175

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

            if self.get_field('urf:GlobalUserName') is not None:
                global_user_name = doc.createElement('urf:GlobalUserName')
                global_user_name.appendChild(doc.createTextNode(self.get_field('GlobalUserName')))
                global_user_name.setAttribute('urf:type', 'opensslCompat')
                user_id.appendChild(global_user_name)
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 1 other location - About 3 hrs to fix
    apel/db/records/summary.py on lines 154..158

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 9 locations. Consider refactoring.
    Open

            if self.get_field('VORole') is not None:
                vorole = doc.createElement('urf:GroupAttribute')
                vorole.setAttribute('urf:type', 'vo-role')
                vorole.appendChild(doc.createTextNode(self.get_field('VORole')))
                user_id.appendChild(vorole)
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 8 other locations - About 3 hrs to fix
    apel/db/records/job.py on lines 213..217
    apel/db/records/job.py on lines 219..223
    apel/db/records/job.py on lines 225..229
    apel/db/records/normalised_summary.py on lines 171..175
    apel/db/records/storage.py on lines 179..183
    apel/db/records/storage.py on lines 185..189
    apel/db/records/summary.py on lines 165..169
    apel/db/records/summary.py on lines 171..175

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

            if self.get_field('NodeCount') > 0:
                ncount = doc.createElement('aur:NodeCount')
                ncount.appendChild(doc.createTextNode(str(self.get_field('NodeCount'))))
                ur.appendChild(ncount)
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 5 other locations - About 2 hrs to fix
    apel/db/records/job.py on lines 274..277
    apel/db/records/job.py on lines 279..282
    apel/db/records/normalised_summary.py on lines 223..226
    apel/db/records/summary.py on lines 214..217
    apel/db/records/summary.py on lines 219..222

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 61.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 6 locations. Consider refactoring.
    Open

            if self.get_field('Processors') > 0:
                procs = doc.createElement('aur:Processors')
                procs.appendChild(doc.createTextNode(str(self.get_field('Processors'))))
                ur.appendChild(procs)
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 5 other locations - About 2 hrs to fix
    apel/db/records/job.py on lines 274..277
    apel/db/records/job.py on lines 279..282
    apel/db/records/normalised_summary.py on lines 228..231
    apel/db/records/summary.py on lines 214..217
    apel/db/records/summary.py on lines 219..222

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 61.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

            if self.get_field('urf:Group') is not None:
                group = doc.createElement('urf:Group')
                group.appendChild(doc.createTextNode(self.get_field('VO')))
                user_id.appendChild(group)
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 4 other locations - About 2 hrs to fix
    apel/db/records/job.py on lines 208..211
    apel/db/records/job.py on lines 231..234
    apel/db/records/job.py on lines 298..301
    apel/db/records/summary.py on lines 160..163

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 57.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            ncpu.appendChild(doc.createTextNode('PT'+str(self.get_field('NormalisedCpuDuration'))+'S'))
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 7 other locations - About 55 mins to fix
    apel/db/records/job.py on lines 247..247
    apel/db/records/job.py on lines 252..252
    apel/db/records/normalised_summary.py on lines 204..204
    apel/db/records/normalised_summary.py on lines 208..208
    apel/db/records/normalised_summary.py on lines 212..212
    apel/db/records/summary.py on lines 198..198
    apel/db/records/summary.py on lines 202..202

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            wall.appendChild(doc.createTextNode('PT'+str(self.get_field('WallDuration'))+'S'))
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 7 other locations - About 55 mins to fix
    apel/db/records/job.py on lines 247..247
    apel/db/records/job.py on lines 252..252
    apel/db/records/normalised_summary.py on lines 208..208
    apel/db/records/normalised_summary.py on lines 212..212
    apel/db/records/normalised_summary.py on lines 216..216
    apel/db/records/summary.py on lines 198..198
    apel/db/records/summary.py on lines 202..202

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            cpu.appendChild(doc.createTextNode('PT'+str(self.get_field('CpuDuration'))+'S'))
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 7 other locations - About 55 mins to fix
    apel/db/records/job.py on lines 247..247
    apel/db/records/job.py on lines 252..252
    apel/db/records/normalised_summary.py on lines 204..204
    apel/db/records/normalised_summary.py on lines 212..212
    apel/db/records/normalised_summary.py on lines 216..216
    apel/db/records/summary.py on lines 198..198
    apel/db/records/summary.py on lines 202..202

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

            nwall.appendChild(doc.createTextNode('PT'+str(self.get_field('NormalisedWallDuration'))+'S'))
    Severity: Major
    Found in apel/db/records/normalised_summary.py and 7 other locations - About 55 mins to fix
    apel/db/records/job.py on lines 247..247
    apel/db/records/job.py on lines 252..252
    apel/db/records/normalised_summary.py on lines 204..204
    apel/db/records/normalised_summary.py on lines 208..208
    apel/db/records/normalised_summary.py on lines 216..216
    apel/db/records/summary.py on lines 198..198
    apel/db/records/summary.py on lines 202..202

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Line too long (87 > 79 characters)
    Open

                raise InvalidRecordException("Month specified in record is in the future.")
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (90 > 79 characters)
    Open

            wall.appendChild(doc.createTextNode('PT'+str(self.get_field('WallDuration'))+'S'))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (89 > 79 characters)
    Open

                    raise InvalidRecordException("LatestEndTime is not within stated month.")
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (99 > 79 characters)
    Open

            ncpu.appendChild(doc.createTextNode('PT'+str(self.get_field('NormalisedCpuDuration'))+'S'))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (84 > 79 characters)
    Open

                ncount.appendChild(doc.createTextNode(str(self.get_field('NodeCount'))))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (88 > 79 characters)
    Open

            cpu.appendChild(doc.createTextNode('PT'+str(self.get_field('CpuDuration'))+'S'))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (91 > 79 characters)
    Open

                    raise InvalidRecordException("EarliestEndTime is not within stated month.")
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (106 > 79 characters)
    Open

            earliest_text = time.strftime('%Y-%m-%dT%H:%M:%SZ', self.get_field('EarliestEndTime').timetuple())
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (81 > 79 characters)
    Open

                raise InvalidRecordException("Invalid values for month and/or year.")
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (101 > 79 characters)
    Open

            nwall.appendChild(doc.createTextNode('PT'+str(self.get_field('NormalisedWallDuration'))+'S'))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (94 > 79 characters)
    Open

                    raise InvalidRecordException("LatestEndTime is earlier than EarliestEndTime.")
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (84 > 79 characters)
    Open

                procs.appendChild(doc.createTextNode(str(self.get_field('Processors'))))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (94 > 79 characters)
    Open

                global_user_name.appendChild(doc.createTextNode(self.get_field('GlobalUserName')))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (80 > 79 characters)
    Open

            # Check that the EarliestEndTime and LatestEndTime fall within the right
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (80 > 79 characters)
    Open

            cpu.appendChild(doc.createTextNode(str(self.get_field('NumberOfJobs'))))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (80 > 79 characters)
    Open

                                "VOGroup", "VORole", "SubmitHost", "Infrastructure",
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (82 > 79 characters)
    Open

            subhost.appendChild(doc.createTextNode(str(self.get_field('SubmitHost'))))
    Severity: Minor
    Found in apel/db/records/normalised_summary.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 (102 > 79 characters)
    Open

            latest_text = time.strftime('%Y-%m-%dT%H:%M:%SZ', self.get_field('LatestEndTime').timetuple())
    Severity: Minor
    Found in apel/db/records/normalised_summary.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.

    Unnecessary parens after 'if' keyword
    Open

                if (int(rc['Month']) == 12):

    Used when a single item in parentheses follows an if, for, or other keyword.

    Unnecessary parens after 'not' keyword
    Open

                if not (month_start <= latest_end <= month_end):

    Used when a single item in parentheses follows an if, for, or other keyword.

    Line too long (106/100)
    Open

            earliest_text = time.strftime('%Y-%m-%dT%H:%M:%SZ', self.get_field('EarliestEndTime').timetuple())

    Used when a line is longer than a given number of characters.

    Variable name rc doesn't conform to snake_case naming style
    Open

            rc = self._record_content

    Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

    Variable name ur doesn't conform to snake_case naming style
    Open

            ur = doc.createElement('aur:SummaryRecord')

    Used when the name doesn't conform to naming rules associated to its type (constant, variable, class...).

    Line too long (101/100)
    Open

            nwall.appendChild(doc.createTextNode('PT'+str(self.get_field('NormalisedWallDuration'))+'S'))

    Used when a line is longer than a given number of characters.

    Unnecessary parens after 'not' keyword
    Open

                if not (month_start <= earliest_end <= month_end):

    Used when a single item in parentheses follows an if, for, or other keyword.

    Missing module docstring
    Open

    # Copyright 2014 The Science and Technology Facilities Council

    Used when a module has no docstring.Empty modules do not require a docstring.

    Line too long (102/100)
    Open

            latest_text = time.strftime('%Y-%m-%dT%H:%M:%SZ', self.get_field('LatestEndTime').timetuple())

    Used when a line is longer than a given number of characters.

    There are no issues that match your filters.

    Category
    Status