5 ms·
I have 1 key recommendation: if you're writing shell scripts, use shellcheck. It can detect many problems and hrlp you write better scripts.
by dwheeler 3y ago
I have 1 key recommendation: if you're writing shell scripts, use shellcheck. It can detect many problems and hrlp you write better scripts.
- keepamovin 3y agoYes! I only wish there was a better interface. Like an editor integration. Just something where you can go through each check line 1 by 1 and consider changing or not. I tried writing this in a simple way but gave up...
- frou_dh 3y agoUse the editor's normal support for running a build/compile to run shellcheck with the `--format gcc` flag. Shellcheck will output in the traditional path:line:column:message format, which will be navigable like compiler errors.
- BozeWolf 3y agoJetbrains has shellcheck integrated in their editors:) I bet vscode can do the same.
- FredrikMeyer 3y agoEmacs' flycheck integrates perfectly with shellcheck.
- wodenokoto 3y agoI don't know which editor you are using, but the shellcheck plugin for VS Code works really well. Underlines warnings and errors, and on hover gives you a short description and a link to a long description. There's also a "fix" button, but I it only works for the simplest of cases.
- keepamovin 3y agoOh, I use vim. And I don't really know about any plugins that work. But I would try VS Code just to go through my shell files with shellcheck! :)
- marcelarie 3y agoyou can use nvim then, it has shellcheck for diagnostics and formatting, like in vscode :) here the link to the config: https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTIN_CONFIG.md#diagnostic-config https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main...
- keepamovin 3y agoThanks, for the link, man! Helpful. Is nvim, like, command line? I don't like to be in GUI when I'm coding. I mean I guess I could hook up my Quake style iTerm2 dropdown overlay to display a GUI window (but I think that only works on Windows with ConEmu). It's just easier for me to stay in command line, switch to GUI to eval or research...or watch videos! Haha
- llimllib 3y agonvim is a fork of vim, so yes it’s a command line editor
- keepamovin 3y agoCool! Will give a try.
- ramses0 3y agoSyntastic, I think? `~/.vim/pack/default/start/syntastic/README.markdown`
- JCWasmx86 3y agoA lot of editors have available integrations for Shellcheck. VSCode and IntelliJ have a plugin, GNOME Builder comes with the plugin included, etc.
- marcelarie 3y agoIn neovim I would recommend setting shellcheck with null.ls or using the bash language server: https://github.com/bash-lsp/bash-language-server https://github.com/bash-lsp/bash-language-server both work really well