branch: elpa/flymake-collection
commit cfd4b5ef9437329c302a259901bcce2e688dc5bb
Author: Mohsin Kaleem <[email protected]>
Commit: Mohsin Kaleem <[email protected]>
(checkers): Make pylint use a pipe
The prior implementation used source-inplace+file to make flymake-rest
generate a temporary file in the same directory as the original file and
then lint that. Sadly pylint seems to have issues with the name of the
temporary file and reports an error even when nothings wrong.
There is a --from-stdin argument pylint can take alongside the module
name which fixes this issue. However it's not optional. You omit it and
pylint will crash. For now I'm passing the buffers file-name when
available and the just _ (a valid module name for some reason) when not.
---
checkers/flymake-rest-pylint.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/checkers/flymake-rest-pylint.el b/checkers/flymake-rest-pylint.el
index 2413fe80c9..05315cbccd 100644
--- a/checkers/flymake-rest-pylint.el
+++ b/checkers/flymake-rest-pylint.el
@@ -33,20 +33,22 @@
(flymake-rest-define flymake-rest-pylint
:title "pylint"
:pre-let ((python-exec (executable-find "python3"))
- (pylint-exec (executable-find "pylint")))
+ (pylint-exec (executable-find "pylint"))
+ (file-name (or (buffer-file-name flymake-rest-source)
+ "_")))
:pre-check
(progn
(unless python-exec
(error "Cannot find python executable"))
(unless pylint-exec
(error "Cannot find pylint executable")))
- :write-type 'file
- :source-inplace t
+ :write-type 'pipe
:command (list python-exec
"-m" "pylint"
"--reports=n"
"--output-format=json"
- flymake-rest-temp-file)
+ "--from-stdin"
+ file-name)
:error-parser
(flymake-rest-parse-enumerate
(car