emacs-flycheck-mypy's People
emacs-flycheck-mypy's Issues
Uncertain how to use
I've installed this, and mypy. On a test source file from the command line, when I run mypy, I get a proper error about a mismatched type hint.
I have Flycheck running on the same source file in emacs, but I'm not sure how to activate the mypy features of your script, which is installed. I see FlyC in the mode line, but flycheck-next-error and other similar commands report no errors. What do I need to do to actually run the mypy checker with flycheck?
Also -- there is a comment in your source about desiring deactivation of flake8 -- I find the flake8 syntax checking fantastic, and since this is a different task than mypy, it's not clear to me why I cannot use both?
Thanks, looking forward to getting this working!
Support "note" in addition to "error", too
I activated some of mypy's additional flags and I'm getting the following output:
tools.py:14: note: unused 'type: ignore' comment
Which triggers the following message in emacs:
Suspicious state from syntax checker python-mypy: Flycheck checker python-mypy returned non-zero exit code 1, but its output contained no errors: tools.py:16: note: unused 'type: ignore' comment
Contribute to Flycheck
Would you like to contribute this syntax checker to Flycheck itself?
Run mypy from "root" path
I have the following directory structure (standard for a python package I think):
module/
__init__.py
...
tests/
test_xxx.py
setup.cfg
setup.py
I have installed the module doing pip install -e .
.
Problem
When running mypy
from the command line, there are no issues with test_xxx.py
. When running flycheck-mypy
from emacs
, I got tons of warnings similar to:
test_settings.py:7: error: Cannot find implementation or library stub for module named 'module.settings'
The problem occurs because flycheck
run mypy
from the tests
folder and not the root one. Even if I specify a mypy
config file, the error persists.
Potential fix
There is :working-directory
option for flycheck
checkers that could be used. Mine look like this (only works for setup.cfg
currently):
(defun flycheck-mypy--find-project-root (_checker)
"Compute an appropriate working-directory for flycheck-ruby.
This is either a parent directory containing a Gemfile, or nil."
(and
buffer-file-name
(locate-dominating-file buffer-file-name "setup.cfg")))
(flycheck-define-checker python-mypy
"Mypy syntax checker. Requires mypy>=0.3.1.
Customize `flycheck-python-mypy-args` to add specific args to default
executable.
E.g. when processing Python2 files, add \"--py2\".
See URL `http://mypy-lang.org/'."
:command ("mypy"
(config-file "--config-file" flycheck-mypy.ini)
(eval flycheck-python-mypy-args)
source-original)
:working-directory flycheck-mypy--find-project-root
:error-patterns
((error line-start (file-name) ":" line ": error:" (message) line-end)
(warning line-start (file-name) ":" line ": note:" (message) line-end)
(info line-start (file-name) ":" line ": note:" (message) line-end))
:modes python-mode)
(add-to-list 'flycheck-checkers 'python-mypy t)
It should be possible to adapt this to either have a variable to define the directory, or use the directory of flycheck-mypy.ini
.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.