Fixed: sorting bug
This commit is contained in:
parent
de1e861ce7
commit
ac7627a948
|
@ -112,7 +112,7 @@ def code_quality(top=10, verbose=True, details=False, fix=False, filename=None):
|
||||||
fix = coerce_bool(fix)
|
fix = coerce_bool(fix)
|
||||||
end = int(top) if int(top) else -1
|
end = int(top) if int(top) else -1
|
||||||
|
|
||||||
with hide('warnings', 'running'): # pylint: disable=not-context-manager
|
with hide('warnings', 'running', 'stdout'): # pylint: disable=not-context-manager
|
||||||
with virtualenv(VENV_ROOT):
|
with virtualenv(VENV_ROOT):
|
||||||
if filename:
|
if filename:
|
||||||
filename = os.path.abspath(filename)
|
filename = os.path.abspath(filename)
|
||||||
|
@ -123,7 +123,10 @@ def code_quality(top=10, verbose=True, details=False, fix=False, filename=None):
|
||||||
file_list = [filename]
|
file_list = [filename]
|
||||||
else:
|
else:
|
||||||
with cd(PROJECT_ROOT): # pylint: disable=not-context-manager
|
with cd(PROJECT_ROOT): # pylint: disable=not-context-manager
|
||||||
file_list = run('find . -name "*.py"').split("\n")
|
file_list = [
|
||||||
|
os.path.abspath(i.rstrip('\r'))
|
||||||
|
for i in run('find . -name "*.py"').split("\n")
|
||||||
|
]
|
||||||
|
|
||||||
if fix:
|
if fix:
|
||||||
for path_to_file in file_list:
|
for path_to_file in file_list:
|
||||||
|
@ -137,6 +140,7 @@ def code_quality(top=10, verbose=True, details=False, fix=False, filename=None):
|
||||||
# Sort and slice
|
# Sort and slice
|
||||||
for item in sorted(
|
for item in sorted(
|
||||||
results,
|
results,
|
||||||
|
reverse=True,
|
||||||
key=lambda x: x['total_violations']
|
key=lambda x: x['total_violations']
|
||||||
)[:end]:
|
)[:end]:
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user