redbrick/useradm

View on GitHub
attic/rebuild_userdb_students.py

Summary

Maintainability
A
2 hrs
Test Coverage

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

def main():
    """Program entry function."""

    ldaphost = 'atlas.dcu.ie'
    
Severity: Minor
Found in attic/rebuild_userdb_students.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

Error: Missing parentheses in call to 'print'. Did you mean print('userdb/students:', end=" ")? (<unknown>, line 22)</unknown>
Open

    print 'userdb/students:',
Severity: Minor
Found in attic/rebuild_userdb_students.py by radon

We encountered an error attempting to analyze this line.

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

            name = '%s %s' % (attr['givenName'][0], attr['sn'][0])
Severity: Major
Found in attic/rebuild_userdb_students.py and 1 other location - About 1 hr to fix
attic/rebuild_userdb_staff.py on lines 85..88

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 38.

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

Indentation contains tabs
Open

    ldaphost = 'atlas.dcu.ie'
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Unexpected spaces around keyword / parameter equals
Open

    dbh = pgdb.connect(database = 'userdb')
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Don't use spaces around the '=' sign in function arguments.

Don't use spaces around the '=' sign when used to indicate a
keyword argument or a default parameter value, except when
using a type annotation.

Okay: def complex(real, imag=0.0):
Okay: return magic(r=real, i=imag)
Okay: boolean(a == b)
Okay: boolean(a != b)
Okay: boolean(a <= b)
Okay: boolean(a >= b)
Okay: def foo(arg: int = 42):
Okay: async def foo(arg: int = 42):

E251: def complex(real, imag = 0.0):
E251: return magic(r = real, i = imag)
E252: def complex(real, image: float=0.0):

Indentation contains tabs
Open

    cur.execute('delete from students')
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    for i in students:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            # character is the year (1, 2, 3, 4, X, O, C, etc.) and the rest is the
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            # course name. Uppercase course & year for consistency.
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            #
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            if ids.has_key(id):
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

.has_key() is deprecated, use 'in'
Open

            if ids.has_key(id):
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

The {}.has_key() method is removed in Python 3: use the 'in' operator.

Okay: if "alph" in d:\n    print d["alph"]
W601: assert d.has_key('alph')

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

            # Construct their full name from first name ('givenName') followed by
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    ids = {}
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        try:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                continue
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            email = attr['mail'][0]
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    l.simple_bind_s('', '') # anonymous bind
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    total = 0
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

            
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

            # Cycle through each 'cn' attribute value until we find one that is a
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

            
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

    """Program entry function."""
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Ambiguous variable name 'l'
Open

    l = ldap.open(ldaphost)
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Never use the characters 'l', 'O', or 'I' as variable names.

In some fonts, these characters are indistinguishable from the
numerals one and zero. When tempted to use 'l', use 'L' instead.

Okay: L = 0
Okay: o = 123
Okay: i = 42
E741: l = 0
E741: O = 123
E741: I = 42

Variables can be bound in several other contexts, including class
and function definitions, 'global' and 'nonlocal' statements,
exception handlers, and 'with' and 'for' statements.
In addition, we have a special handling for function parameters.

Okay: except AttributeError as o:
Okay: with lock as L:
Okay: foo(l=12)
Okay: for a in foo(l=12):
E741: except AttributeError as O:
E741: with lock as l:
E741: global I
E741: nonlocal l
E741: def foo(l):
E741: def foo(l=12):
E741: l = foo(l=12)
E741: for l in range(10):
E742: class I(object):
E743: def l(x):

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

    print 'Purge.',
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    print 'Populate.',
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    #
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    pass
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            cur.execute(insert_student, (id, name, email, course, year))
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        except KeyError:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

            # Extract course & year from 'l' attribute value. Assumes last
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

            
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

            for j in attr['cn']:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Block comment should start with '# '
Open

            #    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Separate inline comments by at least two spaces.

An inline comment is a comment on the same line as a statement.
Inline comments should be separated by at least two spaces from the
statement. They should start with a # and a single space.

Each line of a block comment starts with a # and a single space
(unless it is indented text inside the comment).

Okay: x = x + 1  # Increment x
Okay: x = x + 1    # Increment x
Okay: # Block comment
E261: x = x + 1 # Increment x
E262: x = x + 1  #Increment x
E262: x = x + 1  #  Increment x
E265: #Block comment
E266: ### Block comment

Indentation contains tabs
Open

            total += 1
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    students = l.search_s('ou=students,o=dcu', ldap.SCOPE_SUBTREE, 'objectclass=person', ('givenName', 'sn', 'mail', 'l', 'cn'))
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    # Add new entries.
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

            else:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            name = '%s %s' % (attr['givenName'][0], attr['sn'][0])
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Unexpected spaces around keyword / parameter equals
Open

    dbh = pgdb.connect(database = 'userdb')
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Don't use spaces around the '=' sign in function arguments.

Don't use spaces around the '=' sign when used to indicate a
keyword argument or a default parameter value, except when
using a type annotation.

Okay: def complex(real, imag=0.0):
Okay: return magic(r=real, i=imag)
Okay: boolean(a == b)
Okay: boolean(a != b)
Okay: boolean(a <= b)
Okay: boolean(a >= b)
Okay: def foo(arg: int = 42):
Okay: async def foo(arg: int = 42):

E251: def complex(real, imag = 0.0):
E251: return magic(r = real, i = imag)
E252: def complex(real, image: float=0.0):

Indentation contains tabs
Open

    print 'userdb/students:',
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

    dbh = pgdb.connect(database = 'userdb')
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    cur = dbh.cursor()
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    #
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                else:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    print '[%d].' % len(students),
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

        
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

                except ValueError:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    # Delete all existing entries.
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    insert_student = 'INSERT INTO students (id, name, email, course, year) VALUES (%d, %s, %s, %s, %s)'
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            course = attr['l'][0][:-1].upper() or 'N/A'
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    id = int(j)
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                # No ID number found! Skip this ldap entry.
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Line too long (125 > 100 characters)
Open

    students = l.search_s('ou=students,o=dcu', ldap.SCOPE_SUBTREE, 'objectclass=person', ('givenName', 'sn', 'mail', 'l', 'cn'))
Severity: Minor
Found in attic/rebuild_userdb_students.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.

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

            #    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

At least two spaces before inline comment
Open

    l.simple_bind_s('', '') # anonymous bind
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Separate inline comments by at least two spaces.

An inline comment is a comment on the same line as a statement.
Inline comments should be separated by at least two spaces from the
statement. They should start with a # and a single space.

Each line of a block comment starts with a # and a single space
(unless it is indented text inside the comment).

Okay: x = x + 1  # Increment x
Okay: x = x + 1    # Increment x
Okay: # Block comment
E261: x = x + 1 # Increment x
E262: x = x + 1  #Increment x
E262: x = x + 1  #  Increment x
E265: #Block comment
E266: ### Block comment

Indentation contains tabs
Open

            # number (which can only be the id number).
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                try:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                continue
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Trailing whitespace
Open

            #    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            year = attr['l'][0][-1].upper() or 'N/A'
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                    break
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

        
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    l = ldap.open(ldaphost)
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

            #
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

                ids[id] = 1
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            # their surname ('sn').
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Expected 2 blank lines, found 1
Open

def main():
Severity: Minor
Found in attic/rebuild_userdb_students.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

Indentation contains tabs
Open

    print 'Search',
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            attr = i[1]
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            else:
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

            pass
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    l.unbind()
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    main()
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

    dbh.commit()
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    dbh.close()
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Blank line contains whitespace
Open

    
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

Trailing whitespace is superfluous.

The warning returned varies on whether the line itself is blank,
for easier filtering for those who want to indent their blank lines.

Okay: spam(1)\n#
W291: spam(1) \n#
W293: class Foo(object):\n    \n    bang = 12

Indentation contains tabs
Open

    print 'Done [%d/%d].' % (total, len(students))
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

Indentation contains tabs
Open

    cur.execute('END; VACUUM ANALYZE students')
Severity: Minor
Found in attic/rebuild_userdb_students.py by pep8

On new projects, spaces-only are strongly recommended over tabs.

Okay: if True:\n    return
W191: if True:\n\treturn

There are no issues that match your filters.

Category
Status