tools: Let python_syntax tool show errors.
- Wasn't worth treating python specially.
This commit is contained in:
parent
ee27439a7c
commit
cc0b565b3a
2 changed files with 5 additions and 14 deletions
|
|
@ -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"#!"
|
||||
|
|
|
|||
|
|
@ -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/"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue