Showing 14 of 25 total issues
Function grep
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def grep(expr,
files,
line_numbers=False,
filenames=False,
color=False,
- Read upRead up
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
File cli.py
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
from __future__ import print_function, unicode_literals
from __future__ import print_function
import os
import sys
import unitils
Function ls
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def ls(argv=None, out=sys.stdout, err=sys.stderr):
argv = sys.argv[1:] if argv is None else argv
parser = argparse.ArgumentParser(
prog="ls.py",
description="A Simplified ls-like utility",
- Read upRead up
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 find
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def find(path=".", name=None, iname=None, ftype="*"):
"""Search for files in a directory heirarchy.
This is dramatically different from the GNU version of
find. There is no Domain Specific language.
- Read upRead up
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 _gather_output
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _gather_output(counts,
lines,
byte_count,
chars,
words,
- Read upRead up
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 head
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def head(argv=None, out=sys.stdout, err=sys.stderr):
argv = sys.argv[1:] if argv is None else argv
parser = argparse.ArgumentParser(
prog="head.py",
description="A Simplified head-like utility",
- Read upRead up
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 page
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def page(text):
"""Page through text on a terminal. Similar to more.
:param text: The text to page through
:type text: str
- Read upRead up
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 grep
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def grep(expr,
Function which
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def which(cmd, _all=False):
"""Search the PATH for the first occurance of cmd.
:param cmd: The command for which to search
:param _all: If True, all occurances of cmd on the PATH will be returned
- Read upRead up
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 wc
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def wc(files,
Function head
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def head(files, lines=10, verbose=False, quiet=False):
"""Read the first 10 lines (by default) of each file in files.
As this is supposed to imitate the behavior of head, but also
be used as a Python callable, some liberties have been taken
- Read upRead up
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 _gather_output
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _gather_output(counts,
Function system_call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def system_call(
Function cat
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cat(files, number=False):
"""iterate through each file in files and yield each line in turn.
:param files: The files to concatenate
:param number: If True, yield two-tuples of (line_number, line)
- Read upRead up
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"