Changed the pretty names of the result statuses and corrected variable names to match.
This commit is contained in:
parent
4be818cf25
commit
9da1bb3dbb
5 changed files with 67 additions and 67 deletions
2
TODO
2
TODO
|
|
@ -8,7 +8,6 @@ Todo
|
||||||
- Need to use conventional version numbers for pypi. See pep0440.
|
- Need to use conventional version numbers for pypi. See pep0440.
|
||||||
- Add ESC as an alternative to 'q' for quit. If looking at Help, ESC should just
|
- Add ESC as an alternative to 'q' for quit. If looking at Help, ESC should just
|
||||||
exit the help screen.
|
exit the help screen.
|
||||||
- Statuses' pretty names and variable names don't match.
|
|
||||||
- Report on python doctests. (also coverage of)
|
- Report on python doctests. (also coverage of)
|
||||||
- Treat any compressed file as though it is uncompressed. But the metadata tool
|
- Treat any compressed file as though it is uncompressed. But the metadata tool
|
||||||
should still report on the original compressed file.
|
should still report on the original compressed file.
|
||||||
|
|
@ -155,6 +154,7 @@ Done
|
||||||
- Simplify coloring of mccabe. Just color functions with complexity greater than 10.
|
- Simplify coloring of mccabe. Just color functions with complexity greater than 10.
|
||||||
- Add rich LSCOLORS if the environment variable is not set.
|
- Add rich LSCOLORS if the environment variable is not set.
|
||||||
- Use perldoc on pod files.
|
- Use perldoc on pod files.
|
||||||
|
- Statuses' pretty names and variable names don't match.
|
||||||
|
|
||||||
A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps
|
A-syntax, B-tests, C-auto docs, D-lint, E-coverage, F-profile, G-tidy, H-import deps
|
||||||
A B C D E F G H
|
A B C D E F G H
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
│ [0m[38;2;255;255;255m[48;2;100;100;100m [0m[38;2;255;255;255m[48;2;0;0;0m│
|
│ [0m[38;2;255;255;255m[48;2;100;100;100m [0m[38;2;255;255;255m[48;2;0;0;0m│
|
||||||
│Statuses: [0m[38;2;255;255;255m[48;2;100;100;100m [0m[38;2;255;255;255m[48;2;0;0;0m│
|
│Statuses: [0m[38;2;255;255;255m[48;2;100;100;100m [0m[38;2;255;255;255m[48;2;0;0;0m│
|
||||||
│ Normal [0m[38;2;255;255;255m[48;2;100;100;100m [0m[38;2;255;255;255m[48;2;0;0;0m│
|
│ Normal [0m[38;2;255;255;255m[48;2;100;100;100m [0m[38;2;255;255;255m[48;2;0;0;0m│
|
||||||
│ [0m[38;2;0;255;0m[48;2;0;0;0m [0m[38;2;255;255;255m[48;2;0;0;0m No problems │
|
│ [0m[38;2;0;255;0m[48;2;0;0;0m [0m[38;2;255;255;255m[48;2;0;0;0m Ok │
|
||||||
│ [0m[38;2;255;0;0m[48;2;0;0;0m [0m[38;2;255;255;255m[48;2;0;0;0m Problems │
|
│ [0m[38;2;255;0;0m[48;2;0;0;0m [0m[38;2;255;255;255m[48;2;0;0;0m Problem │
|
||||||
│ [0m[38;2;100;100;100m[48;2;0;0;0m [0m[38;2;255;255;255m[48;2;0;0;0m Not applicable │
|
│ [0m[38;2;100;100;100m[48;2;0;0;0m [0m[38;2;255;255;255m[48;2;0;0;0m Not applicable │
|
||||||
│[0m[38;2;255;255;255m[48;2;100;100;100m [0m[38;2;255;255;255m[48;2;0;0;0m │
|
│[0m[38;2;255;255;255m[48;2;100;100;100m [0m[38;2;255;255;255m[48;2;0;0;0m │
|
||||||
└──────────────────────────────────────┘[0m
|
└──────────────────────────────────────┘[0m
|
||||||
120
tools.py
120
tools.py
|
|
@ -33,40 +33,40 @@ import termstr
|
||||||
|
|
||||||
class Status:
|
class Status:
|
||||||
|
|
||||||
success = 1
|
ok = 1
|
||||||
failure = 2
|
problem = 2
|
||||||
info = 3
|
normal = 3
|
||||||
error = 4
|
error = 4
|
||||||
placeholder = 5
|
not_applicable = 5
|
||||||
running = 6
|
running = 6
|
||||||
empty = 7
|
pending = 7
|
||||||
paused = 8
|
paused = 8
|
||||||
|
|
||||||
|
|
||||||
_STATUS_COLORS = [(Status.success, termstr.Color.green),
|
_STATUS_COLORS = [(Status.ok, termstr.Color.green),
|
||||||
(Status.failure, termstr.Color.red),
|
(Status.problem, termstr.Color.red),
|
||||||
(Status.info, termstr.Color.white),
|
(Status.normal, termstr.Color.white),
|
||||||
(Status.placeholder, termstr.Color.grey_100),
|
(Status.not_applicable, termstr.Color.grey_100),
|
||||||
(Status.running, termstr.Color.yellow)]
|
(Status.running, termstr.Color.yellow)]
|
||||||
|
|
||||||
|
|
||||||
STATUS_MEANINGS = [
|
STATUS_MEANINGS = [
|
||||||
(Status.info, "Normal"), (Status.success, "No problems"),
|
(Status.normal, "Normal"), (Status.ok, "Ok"),
|
||||||
(Status.failure, "Problems"), (Status.placeholder, "Not applicable"),
|
(Status.problem, "Problem"), (Status.not_applicable, "Not applicable"),
|
||||||
(Status.running, "Running"), (Status.empty, "Pending"),
|
(Status.running, "Running"), (Status.pending, "Pending"),
|
||||||
(Status.error, "Error")]
|
(Status.error, "Error")]
|
||||||
_STATUS_TO_TERMSTR = {
|
_STATUS_TO_TERMSTR = {
|
||||||
status: termstr.TermStr(" ", termstr.CharStyle(fg_color=color))
|
status: termstr.TermStr(" ", termstr.CharStyle(fg_color=color))
|
||||||
for status, color in _STATUS_COLORS}
|
for status, color in _STATUS_COLORS}
|
||||||
_STATUS_TO_TERMSTR[Status.error] = termstr.TermStr(
|
_STATUS_TO_TERMSTR[Status.error] = termstr.TermStr(
|
||||||
"E ", termstr.CharStyle(fg_color=termstr.Color.red))
|
"E ", termstr.CharStyle(fg_color=termstr.Color.red))
|
||||||
_STATUS_TO_TERMSTR[Status.empty] = ". "
|
_STATUS_TO_TERMSTR[Status.pending] = ". "
|
||||||
_STATUS_TO_TERMSTR_SIMPLE = {
|
_STATUS_TO_TERMSTR_SIMPLE = {
|
||||||
status: termstr.TermStr(" ", termstr.CharStyle(bg_color=color))
|
status: termstr.TermStr(" ", termstr.CharStyle(bg_color=color))
|
||||||
for status, color in _STATUS_COLORS}
|
for status, color in _STATUS_COLORS}
|
||||||
_STATUS_TO_TERMSTR_SIMPLE[Status.error] = termstr.TermStr(
|
_STATUS_TO_TERMSTR_SIMPLE[Status.error] = termstr.TermStr(
|
||||||
"E", termstr.CharStyle(bg_color=termstr.Color.red))
|
"E", termstr.CharStyle(bg_color=termstr.Color.red))
|
||||||
_STATUS_TO_TERMSTR_SIMPLE[Status.empty] = "."
|
_STATUS_TO_TERMSTR_SIMPLE[Status.pending] = "."
|
||||||
|
|
||||||
|
|
||||||
def get_ls_color_codes():
|
def get_ls_color_codes():
|
||||||
|
|
@ -95,7 +95,7 @@ def _do_command(command, **kwargs):
|
||||||
return fix_input(stdout), fix_input(stderr), process.returncode
|
return fix_input(stdout), fix_input(stderr), process.returncode
|
||||||
|
|
||||||
|
|
||||||
def _run_command(command, status_text=Status.success):
|
def _run_command(command, status_text=Status.ok):
|
||||||
status, output = status_text, ""
|
status, output = status_text, ""
|
||||||
try:
|
try:
|
||||||
process = subprocess.Popen(command, stdout=subprocess.PIPE,
|
process = subprocess.Popen(command, stdout=subprocess.PIPE,
|
||||||
|
|
@ -103,9 +103,9 @@ def _run_command(command, status_text=Status.success):
|
||||||
stdout, stderr = process.communicate()
|
stdout, stderr = process.communicate()
|
||||||
output = stdout + stderr
|
output = stdout + stderr
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
status = Status.failure
|
status = Status.problem
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
status = Status.failure
|
status = Status.problem
|
||||||
return status, fill3.Text(fix_input(output))
|
return status, fill3.Text(fix_input(output))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -121,19 +121,19 @@ def pygments_(path):
|
||||||
try:
|
try:
|
||||||
text = file_.read()
|
text = file_.read()
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
return Status.placeholder, fill3.Text("Not unicode")
|
return Status.not_applicable, fill3.Text("Not unicode")
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
source_widget = _syntax_highlight_code(fix_input(text), path)
|
source_widget = _syntax_highlight_code(fix_input(text), path)
|
||||||
except pygments.util.ClassNotFound:
|
except pygments.util.ClassNotFound:
|
||||||
return Status.placeholder, fill3.Text("No lexer found")
|
return Status.not_applicable, fill3.Text("No lexer found")
|
||||||
return Status.info, source_widget
|
return Status.normal, source_widget
|
||||||
pygments_.dependencies = ["python3-pygments"]
|
pygments_.dependencies = ["python3-pygments"]
|
||||||
|
|
||||||
|
|
||||||
def linguist(path):
|
def linguist(path):
|
||||||
# Dep: ruby?, ruby-dev, libicu-dev, cmake, "gem install github-linguist"
|
# Dep: ruby?, ruby-dev, libicu-dev, cmake, "gem install github-linguist"
|
||||||
return _run_command(["linguist", path], Status.info)
|
return _run_command(["linguist", path], Status.normal)
|
||||||
|
|
||||||
|
|
||||||
def _permissions_in_octal(permissions):
|
def _permissions_in_octal(permissions):
|
||||||
|
|
@ -207,7 +207,7 @@ def metadata(path):
|
||||||
else:
|
else:
|
||||||
name, value = line
|
name, value = line
|
||||||
text.append("%-15s: %s\n" % (name, "".join(value)))
|
text.append("%-15s: %s\n" % (name, "".join(value)))
|
||||||
return (Status.info, fill3.Text("".join(text)))
|
return (Status.normal, fill3.Text("".join(text)))
|
||||||
metadata.dependencies = {"file", "coreutils"}
|
metadata.dependencies = {"file", "coreutils"}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -254,26 +254,26 @@ def python_unittests(path):
|
||||||
cmd = [path] if _has_shebang_line(path) else [python_version, path]
|
cmd = [path] if _has_shebang_line(path) else [python_version, path]
|
||||||
stdout, stderr, returncode = _do_command(["timeout", "20"] + cmd)
|
stdout, stderr, returncode = _do_command(["timeout", "20"] + cmd)
|
||||||
markup = pygments.lex(stderr, _python_console_lexer)
|
markup = pygments.lex(stderr, _python_console_lexer)
|
||||||
status = Status.success if returncode == 0 else Status.failure
|
status = Status.ok if returncode == 0 else Status.problem
|
||||||
native_style = pygments.styles.get_style_by_name("native")
|
native_style = pygments.styles.get_style_by_name("native")
|
||||||
code = fill3.Code(markup, native_style)
|
code = fill3.Code(markup, native_style)
|
||||||
return status, code
|
return status, code
|
||||||
else:
|
else:
|
||||||
return Status.placeholder, fill3.Text("No tests.")
|
return Status.not_applicable, fill3.Text("No tests.")
|
||||||
python_unittests.dependencies = {"python", "python3"}
|
python_unittests.dependencies = {"python", "python3"}
|
||||||
|
|
||||||
|
|
||||||
def pydoc(path):
|
def pydoc(path):
|
||||||
pydoc_exe = "pydoc3" if _python_version(path) == "python3" else "pydoc"
|
pydoc_exe = "pydoc3" if _python_version(path) == "python3" else "pydoc"
|
||||||
status, output = Status.info, ""
|
status, output = Status.normal, ""
|
||||||
try:
|
try:
|
||||||
output = subprocess.check_output(
|
output = subprocess.check_output(
|
||||||
["timeout", "20", pydoc_exe, path])
|
["timeout", "20", pydoc_exe, path])
|
||||||
output = fix_input(output)
|
output = fix_input(output)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
status = Status.placeholder
|
status = Status.not_applicable
|
||||||
if not output.startswith("Help on module"):
|
if not output.startswith("Help on module"):
|
||||||
status = Status.placeholder
|
status = Status.not_applicable
|
||||||
return status, fill3.Text(output)
|
return status, fill3.Text(output)
|
||||||
pydoc.dependencies = {"python", "python3"}
|
pydoc.dependencies = {"python", "python3"}
|
||||||
|
|
||||||
|
|
@ -300,17 +300,17 @@ def python_coverage(path):
|
||||||
os.path.normpath(path)], env=env)
|
os.path.normpath(path)], env=env)
|
||||||
with open(os.path.join(temp_dir, path + ",cover"), "r") as f:
|
with open(os.path.join(temp_dir, path + ",cover"), "r") as f:
|
||||||
stdout = f.read()
|
stdout = f.read()
|
||||||
return Status.info, fill3.Text(_colorize_coverage_report(stdout))
|
return Status.normal, fill3.Text(_colorize_coverage_report(stdout))
|
||||||
else:
|
else:
|
||||||
return Status.placeholder, fill3.Text("No corresponding test file: " +
|
return Status.not_applicable, fill3.Text(
|
||||||
os.path.normpath(test_path))
|
"No corresponding test file: " + os.path.normpath(test_path))
|
||||||
python_coverage.dependencies = {"python-coverage", "python3-coverage"}
|
python_coverage.dependencies = {"python-coverage", "python3-coverage"}
|
||||||
|
|
||||||
|
|
||||||
def python_profile(path):
|
def python_profile(path):
|
||||||
stdout, *rest = _do_command(["timeout", "20", _python_version(path), "-m",
|
stdout, *rest = _do_command(["timeout", "20", _python_version(path), "-m",
|
||||||
"cProfile", "--sort=cumulative", path])
|
"cProfile", "--sort=cumulative", path])
|
||||||
return Status.info, fill3.Text(stdout)
|
return Status.normal, fill3.Text(stdout)
|
||||||
python_profile.dependencies = {"python", "python3"}
|
python_profile.dependencies = {"python", "python3"}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -334,13 +334,13 @@ def python_gut(path):
|
||||||
with open(path) as module_file:
|
with open(path) as module_file:
|
||||||
output = gut.gut_module(module_file.read())
|
output = gut.gut_module(module_file.read())
|
||||||
source_widget = _syntax_highlight_code(fix_input(output), path)
|
source_widget = _syntax_highlight_code(fix_input(output), path)
|
||||||
return Status.info, source_widget
|
return Status.normal, source_widget
|
||||||
python_gut.dependencies = set()
|
python_gut.dependencies = set()
|
||||||
|
|
||||||
|
|
||||||
def python_modulefinder(path):
|
def python_modulefinder(path):
|
||||||
return _run_command([_python_version(path), "-m", "modulefinder", path],
|
return _run_command([_python_version(path), "-m", "modulefinder", path],
|
||||||
Status.info)
|
Status.normal)
|
||||||
python_modulefinder.dependencies = {"python", "python3"}
|
python_modulefinder.dependencies = {"python", "python3"}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -363,14 +363,14 @@ def python_mccabe(path):
|
||||||
with contextlib.suppress(ValueError): # When there are no lines
|
with contextlib.suppress(ValueError): # When there are no lines
|
||||||
max_score = max(_get_mccabe_line_score(line, python_version)
|
max_score = max(_get_mccabe_line_score(line, python_version)
|
||||||
for line in stdout.splitlines())
|
for line in stdout.splitlines())
|
||||||
status = Status.failure if max_score > 10 else Status.success
|
status = Status.problem if max_score > 10 else Status.ok
|
||||||
return status, fill3.Text(_colorize_mccabe(stdout, python_version))
|
return status, fill3.Text(_colorize_mccabe(stdout, python_version))
|
||||||
python_mccabe.dependencies = {"python-mccabe", "python3-mccabe"}
|
python_mccabe.dependencies = {"python-mccabe", "python3-mccabe"}
|
||||||
|
|
||||||
|
|
||||||
def python_tidy(path): # Deps: found on internet?
|
def python_tidy(path): # Deps: found on internet?
|
||||||
stdout, *rest = _do_command(["python", "python-tidy.py", path])
|
stdout, *rest = _do_command(["python", "python-tidy.py", path])
|
||||||
return Status.info, _syntax_highlight_code(stdout, path)
|
return Status.normal, _syntax_highlight_code(stdout, path)
|
||||||
|
|
||||||
|
|
||||||
def disassemble_pyc(path):
|
def disassemble_pyc(path):
|
||||||
|
|
@ -378,7 +378,7 @@ def disassemble_pyc(path):
|
||||||
stringio = io.StringIO()
|
stringio = io.StringIO()
|
||||||
dis.dis(bytecode, file=stringio)
|
dis.dis(bytecode, file=stringio)
|
||||||
stringio.seek(0)
|
stringio.seek(0)
|
||||||
return Status.info, fill3.Text(stringio.read())
|
return Status.normal, fill3.Text(stringio.read())
|
||||||
disassemble_pyc.dependencies = set()
|
disassemble_pyc.dependencies = set()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -389,14 +389,14 @@ perl_syntax.dependencies = {"perl"}
|
||||||
|
|
||||||
def perldoc(path):
|
def perldoc(path):
|
||||||
stdout, stderr, returncode = _do_command(["perldoc", "-t", path])
|
stdout, stderr, returncode = _do_command(["perldoc", "-t", path])
|
||||||
return ((Status.info, fill3.Text(stdout)) if returncode == 0
|
return ((Status.normal, fill3.Text(stdout)) if returncode == 0
|
||||||
else (Status.placeholder, fill3.Text(stderr)))
|
else (Status.not_applicable, fill3.Text(stderr)))
|
||||||
perldoc.dependencies = {"perl-doc"}
|
perldoc.dependencies = {"perl-doc"}
|
||||||
|
|
||||||
|
|
||||||
def perltidy(path):
|
def perltidy(path):
|
||||||
stdout, *rest = _do_command(["perltidy", "-st", path])
|
stdout, *rest = _do_command(["perltidy", "-st", path])
|
||||||
return Status.info, _syntax_highlight_code(stdout, path)
|
return Status.normal, _syntax_highlight_code(stdout, path)
|
||||||
perltidy.dependencies = {"perltidy"}
|
perltidy.dependencies = {"perltidy"}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -407,9 +407,9 @@ perl6_syntax.dependencies = {"perl6"}
|
||||||
|
|
||||||
def _jlint_tool(tool_type, path):
|
def _jlint_tool(tool_type, path):
|
||||||
stdout, *rest = _do_command([tool_type, path])
|
stdout, *rest = _do_command([tool_type, path])
|
||||||
status = (Status.success
|
status = (Status.ok
|
||||||
if b"Verification completed: 0 reported messages." in stdout
|
if b"Verification completed: 0 reported messages." in stdout
|
||||||
else Status.failure)
|
else Status.problem)
|
||||||
return status, fill3.Text(stdout)
|
return status, fill3.Text(stdout)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -425,13 +425,13 @@ jlint.dependencies = {"jlint"}
|
||||||
|
|
||||||
def splint(path):
|
def splint(path):
|
||||||
stdout, stderr, returncode = _do_command(["splint", "-preproc", path])
|
stdout, stderr, returncode = _do_command(["splint", "-preproc", path])
|
||||||
status = Status.success if returncode == 0 else Status.failure
|
status = Status.ok if returncode == 0 else Status.problem
|
||||||
return status, fill3.Text(stdout + stderr)
|
return status, fill3.Text(stdout + stderr)
|
||||||
splint.dependencies = {"splint"}
|
splint.dependencies = {"splint"}
|
||||||
|
|
||||||
|
|
||||||
def objdump_headers(path):
|
def objdump_headers(path):
|
||||||
return _run_command(["objdump", "--all-headers", path], Status.info)
|
return _run_command(["objdump", "--all-headers", path], Status.normal)
|
||||||
objdump_headers.dependencies = {"binutils"}
|
objdump_headers.dependencies = {"binutils"}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -440,81 +440,81 @@ def objdump_disassemble(path):
|
||||||
["objdump", "--disassemble", "--reloc", "--dynamic-reloc", path])
|
["objdump", "--disassemble", "--reloc", "--dynamic-reloc", path])
|
||||||
import pygments.lexers.asm
|
import pygments.lexers.asm
|
||||||
lexer = pygments.lexers.asm.ObjdumpLexer()
|
lexer = pygments.lexers.asm.ObjdumpLexer()
|
||||||
return Status.success, fill3.Text(list(pygments.lex(stdout, lexer)))
|
return Status.ok, fill3.Text(list(pygments.lex(stdout, lexer)))
|
||||||
objdump_disassemble.dependencies = {"binutils"}
|
objdump_disassemble.dependencies = {"binutils"}
|
||||||
|
|
||||||
|
|
||||||
def readelf(path):
|
def readelf(path):
|
||||||
return _run_command(["readelf", "--all", path], Status.info)
|
return _run_command(["readelf", "--all", path], Status.normal)
|
||||||
readelf.dependencies = {"binutils"}
|
readelf.dependencies = {"binutils"}
|
||||||
|
|
||||||
|
|
||||||
def mp3info(path):
|
def mp3info(path):
|
||||||
stdout, *rest = _do_command(["mp3info", "-x", path])
|
stdout, *rest = _do_command(["mp3info", "-x", path])
|
||||||
source_widget = fill3.Text(stdout)
|
source_widget = fill3.Text(stdout)
|
||||||
return Status.info, source_widget
|
return Status.normal, source_widget
|
||||||
mp3info.dependencies = ["mp3info"]
|
mp3info.dependencies = ["mp3info"]
|
||||||
|
|
||||||
|
|
||||||
def dump_pickle(path):
|
def dump_pickle(path):
|
||||||
with open(path, "rb") as file_:
|
with open(path, "rb") as file_:
|
||||||
object_ = pickle.load(file_)
|
object_ = pickle.load(file_)
|
||||||
return Status.info, fill3.Text(pprint.pformat(object_.__dict__))
|
return Status.normal, fill3.Text(pprint.pformat(object_.__dict__))
|
||||||
dump_pickle.dependencies = set()
|
dump_pickle.dependencies = set()
|
||||||
|
|
||||||
|
|
||||||
def unzip(path):
|
def unzip(path):
|
||||||
return _run_command(["unzip", "-l", path], Status.info)
|
return _run_command(["unzip", "-l", path], Status.normal)
|
||||||
unzip.dependencies = {"unzip"}
|
unzip.dependencies = {"unzip"}
|
||||||
|
|
||||||
|
|
||||||
def tar_gz(path):
|
def tar_gz(path):
|
||||||
return _run_command(["tar", "ztvf", path], Status.info)
|
return _run_command(["tar", "ztvf", path], Status.normal)
|
||||||
tar_gz.dependencies = {"tar"}
|
tar_gz.dependencies = {"tar"}
|
||||||
|
|
||||||
|
|
||||||
def tar_bz2(path):
|
def tar_bz2(path):
|
||||||
return _run_command(["tar", "jtvf", path], Status.info)
|
return _run_command(["tar", "jtvf", path], Status.normal)
|
||||||
tar_bz2.dependencies = {"tar"}
|
tar_bz2.dependencies = {"tar"}
|
||||||
|
|
||||||
|
|
||||||
def csv(path):
|
def csv(path):
|
||||||
return _run_command(["head", "--lines=20", path], Status.info)
|
return _run_command(["head", "--lines=20", path], Status.normal)
|
||||||
csv.dependencies = {"coreutils"}
|
csv.dependencies = {"coreutils"}
|
||||||
|
|
||||||
|
|
||||||
def nm(path):
|
def nm(path):
|
||||||
return _run_command(["nm", "--demangle", path], Status.info)
|
return _run_command(["nm", "--demangle", path], Status.normal)
|
||||||
nm.dependencies = {"binutils"}
|
nm.dependencies = {"binutils"}
|
||||||
|
|
||||||
|
|
||||||
def pdf2txt(path):
|
def pdf2txt(path):
|
||||||
return _run_command(["pdf2txt", path], Status.info)
|
return _run_command(["pdf2txt", path], Status.normal)
|
||||||
pdf2txt.dependencies = {"python-pdfminer"}
|
pdf2txt.dependencies = {"python-pdfminer"}
|
||||||
|
|
||||||
|
|
||||||
def html_syntax(path):
|
def html_syntax(path):
|
||||||
# Maybe only show errors
|
# Maybe only show errors
|
||||||
stdout, stderr, returncode = _do_command(["tidy", path])
|
stdout, stderr, returncode = _do_command(["tidy", path])
|
||||||
status = Status.success if returncode == 0 else Status.failure
|
status = Status.ok if returncode == 0 else Status.problem
|
||||||
return status, fill3.Text(stderr)
|
return status, fill3.Text(stderr)
|
||||||
html_syntax.dependencies = {"tidy"}
|
html_syntax.dependencies = {"tidy"}
|
||||||
|
|
||||||
|
|
||||||
def tidy(path):
|
def tidy(path):
|
||||||
stdout, *rest = _do_command(["tidy", path])
|
stdout, *rest = _do_command(["tidy", path])
|
||||||
return Status.info, fill3.Text(stdout)
|
return Status.normal, fill3.Text(stdout)
|
||||||
tidy.dependencies = {"tidy"}
|
tidy.dependencies = {"tidy"}
|
||||||
|
|
||||||
|
|
||||||
def html2text(path):
|
def html2text(path):
|
||||||
return _run_command(["html2text", path], Status.info)
|
return _run_command(["html2text", path], Status.normal)
|
||||||
html2text.dependencies = {"html2text"}
|
html2text.dependencies = {"html2text"}
|
||||||
|
|
||||||
|
|
||||||
def bcpp(path):
|
def bcpp(path):
|
||||||
stdout, stderr, returncode = _do_command(["bcpp", "-fi", path])
|
stdout, stderr, returncode = _do_command(["bcpp", "-fi", path])
|
||||||
status = Status.info if returncode == 0 else Status.failure
|
status = Status.normal if returncode == 0 else Status.problem
|
||||||
source_widget = _syntax_highlight_code(stdout, path)
|
source_widget = _syntax_highlight_code(stdout, path)
|
||||||
return status, source_widget
|
return status, source_widget
|
||||||
bcpp.dependencies = {"bcpp"}
|
bcpp.dependencies = {"bcpp"}
|
||||||
|
|
@ -529,7 +529,7 @@ def uncrustify(path):
|
||||||
raise AssertionError
|
raise AssertionError
|
||||||
stdout, stderr, returncode = _do_command(
|
stdout, stderr, returncode = _do_command(
|
||||||
["uncrustify", "-c", config_path, "-f", path])
|
["uncrustify", "-c", config_path, "-f", path])
|
||||||
status = Status.info if returncode == 0 else Status.failure
|
status = Status.normal if returncode == 0 else Status.problem
|
||||||
source_widget = _syntax_highlight_code(stdout, path)
|
source_widget = _syntax_highlight_code(stdout, path)
|
||||||
return status, source_widget
|
return status, source_widget
|
||||||
uncrustify.dependencies = {"uncrustify"}
|
uncrustify.dependencies = {"uncrustify"}
|
||||||
|
|
@ -541,13 +541,13 @@ php5_syntax.dependencies = {"php5"}
|
||||||
|
|
||||||
|
|
||||||
def flog(path): # Deps: "gem install flog"
|
def flog(path): # Deps: "gem install flog"
|
||||||
return _run_command(["flog", path], Status.info)
|
return _run_command(["flog", path], Status.normal)
|
||||||
flog.dependencies = set()
|
flog.dependencies = set()
|
||||||
|
|
||||||
|
|
||||||
# def csstidy(path): # Deps: csstidy
|
# def csstidy(path): # Deps: csstidy
|
||||||
# stdout, stderr, returncode = _do_command(["csstidy", path])
|
# stdout, stderr, returncode = _do_command(["csstidy", path])
|
||||||
# status = Status.info if returncode == 0 else Status.failure
|
# status = Status.normal if returncode == 0 else Status.problem
|
||||||
# source_widget = _syntax_highlight_code(stdout, path)
|
# source_widget = _syntax_highlight_code(stdout, path)
|
||||||
# return status, source_widget
|
# return status, source_widget
|
||||||
|
|
||||||
|
|
|
||||||
6
vigil
6
vigil
|
|
@ -136,7 +136,7 @@ class Result:
|
||||||
self.scroll_position = (0, 0)
|
self.scroll_position = (0, 0)
|
||||||
self.is_completed = False
|
self.is_completed = False
|
||||||
self.is_placeholder = True
|
self.is_placeholder = True
|
||||||
self.status = tools.Status.empty
|
self.status = tools.Status.pending
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lru_cache_with_eviction(maxsize=50)
|
@lru_cache_with_eviction(maxsize=50)
|
||||||
|
|
@ -181,7 +181,7 @@ class Result:
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
self.is_placeholder = True
|
self.is_placeholder = True
|
||||||
self.set_status(tools.Status.empty)
|
self.set_status(tools.Status.pending)
|
||||||
|
|
||||||
def appearance_min(self):
|
def appearance_min(self):
|
||||||
return [status_to_str(self.status,
|
return [status_to_str(self.status,
|
||||||
|
|
@ -438,7 +438,7 @@ class Summary:
|
||||||
row_index = (index + y) % len(self._column)
|
row_index = (index + y) % len(self._column)
|
||||||
row = self._column[row_index]
|
row = self._column[row_index]
|
||||||
for index_x, result in enumerate(row):
|
for index_x, result in enumerate(row):
|
||||||
if (result.status == tools.Status.failure and
|
if (result.status == tools.Status.problem and
|
||||||
not (row_index == y and index_x <= x and
|
not (row_index == y and index_x <= x and
|
||||||
index != len(self._column))):
|
index != len(self._column))):
|
||||||
yield result, (index_x, row_index)
|
yield result, (index_x, row_index)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class WorkerTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def _test_worker(self, sandbox):
|
def _test_worker(self, sandbox):
|
||||||
status = worker.Worker(sandbox).run_tool("foo", tools.metadata)
|
status = worker.Worker(sandbox).run_tool("foo", tools.metadata)
|
||||||
self.assertEqual(status, tools.Status.info)
|
self.assertEqual(status, tools.Status.normal)
|
||||||
result_path = os.path.join(vigil._CACHE_PATH, "foo-metadata")
|
result_path = os.path.join(vigil._CACHE_PATH, "foo-metadata")
|
||||||
self.assertTrue(os.path.exists(result_path))
|
self.assertTrue(os.path.exists(result_path))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue