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
Shellcheck checker #267
Comments
I will try it. I'm going to name this syntax checker |
Don't know. Seems fitting, but I'm not sure what Shellcheck actually checks. Is it Bash or POSIX sh? |
Quoting http://www.shellcheck.net/about.html:
It seems Bash and POSIX sh. |
Cool :-) I wonder how it tells them apart, though. Is there some kind of an option? |
See source code, https://github.com/koalaman/shellcheck/blob/0ec62390d57480a449afb7d450054a28de63fc8a/ShellCheck/Analytics.hs#L80-L87 . It decide shell by shebang. Oh, shellcheck support |
Wow. But what if the file being checked has no shebang? Can we force shellcheck to assume a specific shell? Emacs' shell mode already guesses the shell, so shellcheck should not guess again, lest it guesses something different and reports false errors. |
Sorry for asking all these questions, SVD letting you do all the research. I'm not at my computer, and reading source code on the phone just doesn't work well. |
@lunaryorn No problem.
If there is no sheebang,
|
That's bad. My
Imho, we need such an option before we can think about adding this syntax checker. Should we open an issue at Shellcheck? |
OK, I opened an issue. |
@yasuyk Thank you. We'll see. I hope that the issue is closed quickly. Shellcheck looks really cool :) |
Right! I had not known about Shellcheck until I see this issue, and Shellcheck is very useful after I used it. :-) |
Shellcheck's commit 4968e7d9f adds a It supports |
@koalaman Great! Thank you for the awesome work! When do you update version which includes this feature on |
@yasuyk With this new option in Shellcheck, we should add a single syntax checker
As part of this PR, we should rename all existing shell script checkers to follow the pattern What do you think? |
Excellent! I agree with you. 👍 |
@lunaryorn Shall I rename all existing shell script checkers? |
I'm already at it. |
OK, then I will tackle |
Since Shellcheck now supports (defconst flycheck-shellcheck-supported-shells '(bash sh ksh88 zsh)))
(flycheck-define-checker sh-shellcheck
:command ("shellcheck" "-f" "checkstyle" "-s" (eval (symbol-name sh-shell)) source)
:modes sh-mode
:predicate (lambda () (memq sh-shell flycheck-shellcheck-supported-shells))
:error-parser flycheck-parse-checkstyle) |
Wow, quick work! |
@yasuyk Please take a look at the shell-check branch. I added the necessary code to install shellcheck on the VM, and I also added the syntax checker itself, including the chaining from the shell checkers. Consider it as a draft of this checker. I didn't test it, nor add any tests, though. Let me know what you think, and whether you can work with these changes. |
@lunaryorn OK. I have written test. I will merge tests to |
@lunaryorn I added test for |
|
@yasuyk By the way, if you add a new syntax checker, you usually don't need to run the entire test suite. It's ok to just run the tests for the specific language and the documentation tests, i.e. Syntax checkers for other languages aren't affected by adding a new checker, and the rest of the tests runs on Travis CI. |
I see! I will do so from next time. |
@yasuyk Merged. Thank you for your help. |
If one of you will take a screenshot similar to the ones on http://www.shellcheck.net/about.html , I can upload it and link to flycheck |
@lunaryorn Great! Thanks. |
I taked a screenshot with Spolsky theme and Source Code Pro font. @lunaryorn @koalaman What do you say? |
@lunaryorn Looks good. 👍 |
@yasuyk @lunaryorn Great, thanks! Small is good, It's basically just a thumbnail to link to the project. |
@yasuyk @koalaman I used Shellcheck for the last days, and from my personal experience, I'd like to disable it for Zsh again. It's reporting too many false positives, and often entirely fails to parse Zsh code. For instance, it chokes on glob modifiers (e.g. Comments? |
@lunaryorn You can say that again. |
Sounds reasonable. I haven't put a lot of work into advanced zsh syntax, and there haven't been any bug reports. |
See http://www.shellcheck.net/about.html
The text was updated successfully, but these errors were encountered: