From cc0b565b3ab78e49980c7525eb836b61d2d725e4 Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sun, 21 Jul 2019 23:28:19 +1000 Subject: [PATCH] tools: Let python_syntax tool show errors. - Wasn't worth treating python specially. --- eris/tools.py | 14 -------------- eris/tools.toml | 5 +++++ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/eris/tools.py b/eris/tools.py index d1b778a..dbbd2d4 100644 --- a/eris/tools.py +++ b/eris/tools.py @@ -3,7 +3,6 @@ # Copyright (C) 2015-2019 Andrew Hamilton. All rights reserved. # Licensed under the Artistic License 2.0. -import ast import contextlib import enum import functools @@ -256,19 +255,6 @@ def contents(path): return Status.normal, text -@deps(url="https://en.wikipedia.org/wiki/Python_syntax_and_semantics") -def python_syntax(path): - with open(path) as f: - source = f.read() - try: - ast.parse(source) - except SyntaxError: - is_correct = False - else: - is_correct = True - return (Status.ok if is_correct else Status.problem), "" - - def _has_shebang_line(path): with open(path, "rb") as file_: return file_.read(2) == b"#!" diff --git a/eris/tools.toml b/eris/tools.toml index b8fc048..28f960a 100644 --- a/eris/tools.toml +++ b/eris/tools.toml @@ -46,6 +46,11 @@ tools_for_extensions = [ ] +[python_syntax] + dependencies = [] + url = "https://en.wikipedia.org/wiki/Python_syntax_and_semantics" + command = "python3.7 -m py_compile" + [pycodestyle] dependencies = ["pip/pycodestyle"] url = "http://pycodestyle.pycqa.org/en/latest/"