-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set the working dir and shadow file flag for mypy (#9)
* Run mypy from inferred python project root * Remove leading dot from temp file name This appears to break relative imports in files checked by mypy. Maybe make the temp file pattern configurable per checker? * Use mypy --shadow-file for buffers with a file Fall back to the buffer name when `buffer-file-name' is nil. Necessary for checking temp files since python module names are based on the file name. * Parse mypy diagnostic ids * Make the mypy working dir configurable * Add basic tests for mypy * Add require for project * Move required mypy flags out of custom variable * Fix parsing of mypy error ids with hyphens * Add temp-file-prefix paramter * Update src/checkers/flymake-collection-mypy.el Co-authored-by: dmitrig <34632025+dgarbuzov@users.noreply.github.com> Co-authored-by: Mohsin Kaleem <mohkale@kisara.moe>
- Loading branch information
1 parent
274e5ec
commit 74e2f3f
Showing
4 changed files
with
144 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python3.8 -m pip install mypy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
checker: flymake-collection-mypy | ||
tests: | ||
- name: no-lints | ||
file: | | ||
"""A test case with no output from mypy.""" | ||
print("hello world") | ||
lints: [] | ||
- name: error-operator | ||
file: | | ||
"""Test parsing an error.""" | ||
"x" + 1 | ||
lints: | ||
- point: [3, 6] | ||
level: error | ||
message: operator Unsupported operand types for + ("str" and "int") (mypy) | ||
- name: error-attr-defined | ||
file: | | ||
"""Test parsing an error with a hyphen in the id.""" | ||
x = 1 | ||
x.foo | ||
lints: | ||
- point: [4, 0] | ||
level: error | ||
message: attr-defined "int" has no attribute "foo" (mypy) | ||
- name: note-reveal | ||
file: | | ||
"""Test parsing a note.""" | ||
foo = "bar" | ||
reveal_type(foo) | ||
lints: | ||
- point: [4, 12] | ||
level: note | ||
message: Revealed type is "builtins.str" (mypy) | ||
- name: error-syntax | ||
file: | | ||
"""Test syntax error.""" | ||
class Foo: | ||
lints: | ||
- point: [3, 0] | ||
level: error | ||
message: syntax unexpected EOF while parsing (mypy) |