redbrick/useradm

View on GitHub

Showing 84 of 413 total issues

File useradm.py has 1720 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: iso8859-15 -*-
# --------------------------------------------------------------------------- #
# MODULE DESCRIPTION                                                          #
# --------------------------------------------------------------------------- #
"""RedBrick command line user administration interface."""
Severity: Major
Found in useradm/useradm.py - About 4 days to fix

File rbuserdb.py has 1105 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# --------------------------------------------------------------------------- #
# MODULE DESCRIPTION                                                          #
# --------------------------------------------------------------------------- #
"""RedBrick User Database Module; contains RBUserDB class."""
import crypt
Severity: Major
Found in useradm/rbuserdb.py - About 2 days to fix

RBUserDB has 97 functions (exceeds 20 allowed). Consider refactoring.
Open

class RBUserDB:
    """Class to interface with user database."""
    valid_shells = None
    backup_shells = None

Severity: Major
Found in useradm/rbuserdb.py - About 1 day to fix

File rrs.py has 729 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# --------------------------------------------------------------------------- #
# MODULE DESCRIPTION                                                          #
# --------------------------------------------------------------------------- #
"""RedBrick Registration System CGI."""

Severity: Major
Found in useradm/rrs.py - About 1 day to fix

Function html_form has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
Open

def html_form():
    """Output HTML form for current mode."""

    global usr

Severity: Minor
Found in useradm/rrs.py - About 1 day 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 checkdb has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
Open

def checkdb():
    """Check database for inconsistencies."""

    uidNumbers = {}
    re_mail = re.compile(r'.+@.*dcu\.ie', re.I)
Severity: Minor
Found in useradm/useradm.py - About 1 day 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 sync has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
Open

def sync():
    """Synchronise accounts (i.e. no changes are made to userdb) after an
    offline update to user database with RRS. Needs rrs.log to process
    renames and password resets for existing accounts.

Severity: Minor
Found in useradm/useradm.py - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

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

    udb = RBUserDB()
    udb.connect()
Severity: Minor
Found in scripts/rebuild_userdb_reserved.py - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

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

    ldaphost = 'atlas.dcu.ie'
    
Severity: Minor
Found in attic/rebuild_userdb_staff.py - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

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

    atexit.register(shutdown)

Severity: Minor
Found in useradm/useradm.py - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function renew has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

def renew():
    """Renew user."""

    usr = RBUser()
    curusr = RBUser()
Severity: Minor
Found in useradm/useradm.py - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function stats has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def stats(self):
        """Print database statistics on standard output."""
        usertypes = {}
        categories = ('paid', 'unpaid', 'nonpay', 'newbie', 'signed_paid',
                      'signed_unpaid', 'signed_nonpay', 'signed_newbie',
Severity: Minor
Found in useradm/rbuserdb.py - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function search has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

def search():
    """Search user and/or DCU databases."""

    raise RBFatalError("NOT IMPLEMENTED YET")

Severity: Minor
Found in useradm/useradm.py - About 4 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function ask has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

def ask(prompt, default=None, optional=0, hints=None):
    """Ask a question using given prompt and return user's answer.

    A default answer maybe provided which is returned if no answer is given
    (i.e. user hits RETURN).
Severity: Minor
Found in useradm/useradm.py - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

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

    voted = {}

Severity: Minor
Found in scripts/vote.py - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function get_usertype has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

def get_usertype(usr):
    """Get usertype."""

    usr.oldusertype = usr.usertype

Severity: Minor
Found in useradm/useradm.py - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function add has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def add():
    """Add a new user."""

    usr = RBUser()
    get_usertype(usr)
Severity: Minor
Found in useradm/useradm.py - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function yesno has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def yesno(prompt, default=None):
    """Prompt for confirmation to a question. Returns boolean."""

    global INPUT_INSTRUCTIONS
    if INPUT_INSTRUCTIONS:
Severity: Minor
Found in useradm/useradm.py - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function search has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

def search():
    """Search user and/or DCU databases."""

    global okay

Severity: Minor
Found in useradm/rrs.py - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

RBAccount has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class RBAccount:
    """Class to interface with Unix accounts."""

    def __init__(self):
        """Create new RBAccount object."""
Severity: Minor
Found in useradm/rbaccount.py - About 2 hrs to fix
Severity
Category
Status
Source
Language