-
-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add emacs-lisp-check-declare checker #1286
Conversation
Hm, this appears to work when I load the checker into my working Emacs, but the flycheck-test test doesn't pass, and ert is woefully opaque about why. |
The output to ERT is not the most intuitive:
Inside the I think the issue here is that your checker is never selected by the Flycheck run by ERT. You could put your checker as a |
1058b7c
to
2e21ec5
Compare
Ah, got it. The tests pass now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks pretty good. One question: shouldn't this be part of the default ELisp checker?
|
||
;;; Commentary: | ||
|
||
;; Checkdoc uses the syntax table and comment syntax of the current buffer; if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that comment a leftover from another file?
flycheck.el
Outdated
@@ -7161,12 +7162,34 @@ The checker runs `checkdoc-current-buffer'." | |||
(not (or (flycheck-autoloads-file-p) | |||
(and (buffer-file-name) | |||
(member (file-name-nondirectory (buffer-file-name)) | |||
'("Cask" "Carton" ".dir-locals.el"))))))) | |||
'("Cask" "Carton" ".dir-locals.el")))))) | |||
:next-checkers (emacs-lisp-check-declare)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be added to the next-checkers of emacs-lisp as well?
I agree. It looks like we could just add the |
(Reminder: #1229) |
2e21ec5
to
c4b27e4
Compare
Merged checker into emacs-lisp |
Looks like I need to get my hands on a build of Emacs 24, please wait warmly. |
Actually, it looks like I can't build Emacs 24. I believe I'm running into the bug mentioned here: http://lists.linuxfromscratch.org/pipermail/blfs-support/2016-August/078284.html It may be a while before I can get Emacs 24. If someone else can fix this, feel free. I suspect it's something like the error filter needing to be tweaked. |
c4b27e4
to
eb947e4
Compare
The Emacs I used was 24.3, which flycheck doesn't support. If the fix doesn't pass, I'll probably install a newer Ubuntu in a VM and try again.
|
eb947e4
to
aa4af40
Compare
Well, that was a waste of time. As it turns out, check-declare does not print the line number on Emacs 24 and stepping through the debugger I learned that Flycheck discards errors that do not have line numbers. I don't really feel like trying to make this work now, so I've skipped the test on Emacs 24 and documented that check-declare doesn't work on Emacs 24. |
Thanks for investigating the issue. So, currently the If the issue is missing line numbers in the output, you can check for errors that have a If it's too much a hassle to test that with Emacs 24, let me know. I have an Emacs 24 install I can use to test this workaround. |
Currently on Emacs 24, Adding 0 line numbers to them sounds like a good solution; I'll try to do it with error-filters. |
27f03ed
to
1c5d410
Compare
Any update on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@darkfeline Sorry, I didn't see that you updated the PR (does Github actually notifies you of new commits, even for amends?)
That's a lovely patch, with tests. LGTM 👍
@cpitclaudel, is it good for you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work :) I left two small comments, but I'd also be fine with merging as-is.
flycheck.el
Outdated
flycheck-byte-compiled-files))))) | ||
flycheck-byte-compiled-files)) | ||
(when (and (boundp 'flycheck-emacs-lisp-check-declare) | ||
flycheck-emacs-lisp-check-declare) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be written as bound-and-true-p
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
(seq-do (lambda (err) | ||
(unless (flycheck-error-line err) | ||
(setf (flycheck-error-line err) 0))) | ||
errors) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For simple iteration like this, I tend to prefer dolist over seq-do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the other filters use seq-do
, so I am inclined to keep the code consistent.
EDIT: Not all, but many. The nearby filters use seq-do
so I will do the same.
1c5d410
to
ac7b5a9
Compare
Brilliant work, thanks! |
Thank you @darkfeline for your patience, and for this nice contribution! |
No description provided.