Commit 72dcbc51 authored by Adam Blank's avatar Adam Blank
Browse files

Update codequality.py

parent 6a84b518
No related merge requests found
Showing with 15 additions and 4 deletions
+15 -4
...@@ -486,7 +486,7 @@ def check_style() -> str | None: ...@@ -486,7 +486,7 @@ def check_style() -> str | None:
elif type(desc) == type(tt): elif type(desc) == type(tt):
if not match_ast(tt, desc, contents): if not match_ast(tt, desc, contents):
continue continue
print(colored("* " + msg, "red") + " in " + colored( print(colored(msg, "red") + " in " + colored(
# type: ignore # type: ignore
filename + ":" + str(desc.lineno), "yellow"), file=log) # type: ignore filename + ":" + str(desc.lineno), "yellow"), file=log) # type: ignore
...@@ -500,10 +500,21 @@ def check_style() -> str | None: ...@@ -500,10 +500,21 @@ def check_style() -> str | None:
# print('in ' + ff + ",", 'the variable "' + loc + '"', 'has type', ty) # print('in ' + ff + ",", 'the variable "' + loc + '"', 'has type', ty)
pass pass
val = log.getvalue() return log.getvalue()
return (colored("FAILED", "red") + ": code quality\n" + val) if val else None
if __name__ == '__main__': if __name__ == '__main__':
if not os.path.exists('tests'):
print()
print()
print('\x1b[1m\x1b[31mCould not find the tests directory. :(\x1b[0m')
print()
exit(1)
result = check_style() result = check_style()
print(json.dumps({'success': result is None, 'output': result}))
if '--json' in sys.argv:
print(json.dumps(
{'success': not result, 'output': result.strip().split(os.linesep) if result else ""}))
print(result.strip() if result else "", file=sys.stderr)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment