Added mypy for python.

This commit is contained in:
Andrew Hamilton 2016-10-15 18:45:32 +02:00
parent fb9ecd9039
commit dedac08987
5 changed files with 17 additions and 4 deletions

6
TODO
View file

@ -164,6 +164,8 @@ Done
- Recognize python test files like: test_*.py
- Only show the 'keys' in the help page, and only show the command line usage
on the command line.
- Can mypy be a tool?
<- Yes, but wait for it to be included in python, or until it is an ubuntu package.
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
@ -210,7 +212,7 @@ Ideas
contents of compressed archives, pdf2text, doc2text, html2text, ebook2text,
csv file?
- Check these tools: astyle, indent, uncrustify, xmlindent, csstidy, flake8,
frosted, pep257, pyroma, dodgy, jedi, pep8-naming, graphite, propector, mypy, vmprof, pytype
frosted, pep257, pyroma, dodgy, jedi, pep8-naming, graphite, propector, vmprof, pytype
- eslint for javascript?
- epydoc for python
- readelf
@ -267,8 +269,6 @@ Ideas
- Have command line options for more things? timeout? worker's nice priority level?
editor? pygment syntax theme? Compress the cache? Ignore which paths? Log to disk?
The cache path?
- Can mypy be a tool?
<- Yes, but wait for it to be included in python, or until it is an ubuntu package.
- Have a command-line option to create workers that run remotely.

View file

View file

@ -0,0 +1,2 @@
input/hi.py: note: In function "hi":
input/hi.py:4: error: Parse error before string literal

View file

@ -325,6 +325,13 @@ def pydoc(path):
pydoc.dependencies = {"python", "python3"}
def mypy(path):
stdout, stderr, returncode = _do_command(["mypy", path], timeout=TIMEOUT)
status = Status.ok if returncode == 0 else Status.normal
return status, fill3.Text(stdout)
mypy.dependencies = {"mypy"}
def _colorize_coverage_report(text):
line_color = {"> ": termstr.Color.green, "! ": termstr.Color.red,
" ": None}
@ -672,7 +679,7 @@ def _generic_tools():
def _tools_for_extension():
return {
"py": [python_syntax, python_unittests, pydoc, python_coverage,
"py": [python_syntax, python_unittests, pydoc, mypy, python_coverage,
python_profile, pep8, pyflakes, pylint, python_gut,
python_modulefinder, python_mccabe],
"pyc": [disassemble_pyc],

View file

@ -88,6 +88,10 @@ class ToolsTestCase(unittest.TestCase):
def test_pydoc(self):
self._test_tool(tools.pydoc, self.HI_NORMAL)
def test_mypy(self):
self._test_tool(tools.mypy, [("hi3.py", tools.Status.ok),
("hi.py", tools.Status.normal)])
def test_python_coverage(self):
self._test_tool(tools.python_coverage, self.HI_NORMAL)