apel/db/records/summary.py

Summary

Maintainability
F
4 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
Severity: Info
Found in apel/db/records/summary.py by bandit

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/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 class SummaryRecord. (7)
Open

class SummaryRecord(Record):
    '''
    Class to represent one summary record.

    It knows about the structure of the MySQL table and the message format.
Severity: Minor
Found in apel/db/records/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 SummaryRecord in AUR format.  See
        https://twiki.cern.ch/twiki/bin/view/EMI/ComputeAccounting

Severity: Minor
Found in apel/db/records/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 49 lines of code (exceeds 25 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 1 hr to fix

    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/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 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

    Too many branches (13/12)
    Open

        def _check_fields(self):
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

    Too many local variables (22/15)
    Open

        def get_ur(self):
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

    Too many statements (69/50)
    Open

        def get_ur(self):
    Severity: Info
    Found in apel/db/records/summary.py by pylint

    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/summary.py and 1 other location - About 1 day to fix
    apel/db/records/normalised_summary.py on lines 87..97

    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/summary.py and 1 other location - About 5 hrs to fix
    apel/db/records/normalised_summary.py on lines 104..114

    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/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/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 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/summary.py and 1 other location - About 3 hrs to fix
    apel/db/records/normalised_summary.py on lines 160..164

    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/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/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

    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('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/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/normalised_summary.py on lines 228..231
    apel/db/records/summary.py on lines 214..217

    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('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/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/normalised_summary.py on lines 228..231
    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/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/normalised_summary.py on lines 166..169

    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

            wall.appendChild(doc.createTextNode('PT'+str(self.get_field('WallDuration'))+'S'))
    Severity: Major
    Found in apel/db/records/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/normalised_summary.py on lines 216..216
    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/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/normalised_summary.py on lines 216..216
    apel/db/records/summary.py on lines 198..198

    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

    Too many blank lines (2)
    Open

        def _check_fields(self):
    Severity: Minor
    Found in apel/db/records/summary.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    Line too long (81 > 79 characters)
    Open

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

    Expected 2 blank lines, found 1
    Open

    class SummaryRecord(Record):
    Severity: Minor
    Found in apel/db/records/summary.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    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/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/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

            service_level.setAttribute('urf:type', self.get_field('ServiceLevelType'))
    Severity: Minor
    Found in apel/db/records/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

                                "ServiceLevel", "NodeCount", "Processors", "EarliestEndTime", "LatestEndTime",
    Severity: Minor
    Found in apel/db/records/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/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

            service_level.appendChild(doc.createTextNode(str(self.get_field('ServiceLevel'))))
    Severity: Minor
    Found in apel/db/records/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.

    Too many blank lines (2)
    Open

            # Check that the EarliestEndTime and LatestEndTime fall within the right
    Severity: Minor
    Found in apel/db/records/summary.py by pep8

    Separate top-level function and class definitions with two blank lines.

    Method definitions inside a class are separated by a single blank
    line.
    
    Extra blank lines may be used (sparingly) to separate groups of
    related functions.  Blank lines may be omitted between a bunch of
    related one-liners (e.g. a set of dummy implementations).
    
    Use blank lines in functions, sparingly, to indicate logical
    sections.
    
    Okay: def a():\n    pass\n\n\ndef b():\n    pass
    Okay: def a():\n    pass\n\n\nasync def b():\n    pass
    Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
    Okay: default = 1\nfoo = 1
    Okay: classify = 1\nfoo = 1
    
    E301: class Foo:\n    b = 0\n    def bar():\n        pass
    E302: def a():\n    pass\n\ndef b(n):\n    pass
    E302: def a():\n    pass\n\nasync def b(n):\n    pass
    E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
    E303: def a():\n\n\n\n    pass
    E304: @decorator\n\ndef a():\n    pass
    E305: def a():\n    pass\na()
    E306: def a():\n    def b():\n        pass\n    def c():\n        pass

    Continuation line under-indented for visual indent
    Open

                        "CpuDuration", "NumberOfJobs"]
    Severity: Minor
    Found in apel/db/records/summary.py by pep8

    Continuation lines indentation.

    Continuation lines should align wrapped elements either vertically
    using Python's implicit line joining inside parentheses, brackets
    and braces, or using a hanging indent.
    
    When using a hanging indent these considerations should be applied:
    - there should be no arguments on the first line, and
    - further indentation should be used to clearly distinguish itself
      as a continuation line.
    
    Okay: a = (\n)
    E123: a = (\n    )
    
    Okay: a = (\n    42)
    E121: a = (\n   42)
    E122: a = (\n42)
    E123: a = (\n    42\n    )
    E124: a = (24,\n     42\n)
    E125: if (\n    b):\n    pass
    E126: a = (\n        42)
    E127: a = (24,\n      42)
    E128: a = (24,\n    42)
    E129: if (a or\n    b):\n    pass
    E131: a = (\n    42\n 24)

    Line too long (89 > 79 characters)
    Open

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

                                "VOGroup", "VORole", "SubmitHost", "InfrastructureType", "ServiceLevelType",
    Severity: Minor
    Found in apel/db/records/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/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/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/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 (87 > 79 characters)
    Open

                raise InvalidRecordException("Month specified in record is in the future.")
    Severity: Minor
    Found in apel/db/records/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):
    Severity: Info
    Found in apel/db/records/summary.py by pylint

    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):
    Severity: Info
    Found in apel/db/records/summary.py by pylint

    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())
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

    standard import from xml.dom.minidom import Document should be placed before from apel.db.records import Record, InvalidRecordException
    Open

    from xml.dom.minidom import Document
    Severity: Info
    Found in apel/db/records/summary.py by pylint

    Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports)

    Unnecessary parens after 'not' keyword
    Open

                if not (month_start <= earliest_end <= month_end):
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

    Line too long (102/100)
    Open

            latest_text = time.strftime('%Y-%m-%dT%H:%M:%SZ', self.get_field('LatestEndTime').timetuple())
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

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

            ur = doc.createElement('aur:SummaryRecord')
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

    Line too long (106/100)
    Open

                                "ServiceLevel", "NodeCount", "Processors", "EarliestEndTime", "LatestEndTime",
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

    Line too long (104/100)
    Open

                                "VOGroup", "VORole", "SubmitHost", "InfrastructureType", "ServiceLevelType",
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

    Wrong continued indentation (add 14 spaces).
    Open

                        "CpuDuration", "NumberOfJobs"]
    Severity: Info
    Found in apel/db/records/summary.py by pylint

    TODO CpuDuration, NumberOfJobs] ^ |

    standard import import time should be placed before from apel.db.records import Record, InvalidRecordException
    Open

    import time
    Severity: Info
    Found in apel/db/records/summary.py by pylint

    Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports)

    standard import from datetime import datetime should be placed before from apel.db.records import Record, InvalidRecordException
    Open

    from datetime import datetime
    Severity: Info
    Found in apel/db/records/summary.py by pylint

    Used when PEP8 import order is not respected (standard imports first, then third-party libraries, then local imports)

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

            rc = self._record_content
    Severity: Info
    Found in apel/db/records/summary.py by pylint

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

    There are no issues that match your filters.

    Category
    Status