Showing 42 of 105 total issues
Avoid deeply nested control flow statements. Open
while lines and \
(lines[0].strip() == '' or
lines[0].startswith('#')):
removed.append(lines.pop(0).strip())
Avoid deeply nested control flow statements. Open
if new_lines[-1].strip():
f.write(linesep) # last empty line
f.close()
Function coverage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def coverage(pkg=basename(getcwd()), test_dir=TEST_PATH,
Avoid deeply nested control flow statements. Open
if lines:
new_lines = new_header + ['', ''] + lines
else:
new_lines = new_header
Avoid deeply nested control flow statements. Open
if last.get(file, '') == str(getmtime(file)):
this[file] = str(getmtime(file))
log(LEVEL-1,
ICONS[""] +
"no file header update required for %s" % file)
Function do
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def do(pkg=basename(getcwd()), commit=None, tag=None, header=None,
push=None, remote=None, remote_usr=None, remote_pwd=None,
deploy=None, pypi_usr=None, pypi_pwd=None, archive=None, cleanup=None,
path=None, env=None, **kwargs):
"""run deploy process"""
- 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 coverage_coverage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def coverage_coverage(pkg=basename(getcwd()), test_dir=TEST_PATH,
Avoid deeply nested control flow statements. Open
if removed and removed[0].startswith('#!'):
new_header[0] = removed[0]
# add new header
if lines:
Consider simplifying this complex logical expression. Open
if venv:
# clear virtual environment folder
del_tree(venv)
# create virtual environment
env = create_venv(pkg, venv_path=venv, path=project_path, venv=env)
Function shell
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def shell(command, level=LEVEL, path=getcwd(), venv=None,
Function module
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def module(mdl, command='', level=LEVEL, path=getcwd(), venv=None):
Function start_demo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def start_demo(demo=DEMO_PATH, verbosity=0, exit_status=0, env=None, **kwargs):
Function tag_git
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def tag_git(tag, msg='few', level=LEVEL, path=getcwd(), venv=None):
Function python
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def python(command, level=LEVEL, path=getcwd(), venv=None,
Function coverage_pytest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def coverage_pytest(test_dir=TEST_PATH,
Function script
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def script(cmd, imports=(), level=LEVEL, path=getcwd(), venv=None):
Function coverage_test
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def coverage_test(test_dir=TEST_PATH,
Function del_tree
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def del_tree(*paths, level=LEVEL):
for f in paths:
if exists(f):
if isdir(f):
log(level, 'remove tree below %s' % f)
- 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
Avoid too many return
statements within this function. Open
return failure_exit(exit_status, command)
Function do
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def do(c='', m='', f='', stdin='', arg=(), env=None, **kwargs):
cmd = ''
if c:
cmd = '-c "' + c + '"'
if m:
- 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"