etz69/irhelper

View on GitHub
irhelper.py

Summary

Maintainability
C
1 day
Test Coverage

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

def main():
    if os.geteuid() == 0:
        exit("You must not run this code with root privileges")

    if args.debug:
Severity: Minor
Found in irhelper.py - About 5 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 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def main():
    if os.geteuid() == 0:
        exit("You must not run this code with root privileges")

    if args.debug:
Severity: Major
Found in irhelper.py - About 2 hrs to fix

Function memoize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def memoize(func):
    if os.path.exists(CACHE_FILE) and args.cache:
        debug("Using local cache ..")
        with open(CACHE_FILE) as f:
            cache = pickle.load(f)
Severity: Minor
Found in irhelper.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

There are no issues that match your filters.

Category
Status