DEV Community

Discussion on: Using `shellcheck` to lint your bash/sh scripts.

Collapse
 
nebojsac profile image
Nick Cinger

Ooo this is excellent, thanks for sharing! Can't believe I never thought of looking for a linter for my bash scripts.

Collapse
 
ferricoxide profile image
Thomas H Jones II • Edited

It can be an annoying linter. Fortunately, it's easy enough to disable some of the annoyances. E.g., I'm a frequent user of the <TARGET_ACTION> && <SUCCESS_ACTION> || <ERROR_ACTION> construct. Unless you put # shellcheck disable=<LINT_ID> in either your script-header or peppered with your violating-construct, you're going to be annoyed. Especially fun when you've got git server-side commit-validation going on and you see that little red x come up next to a commit that is doing exactly what you want it to do and how you want it done.

Collapse
 
nebojsac profile image
Nick Cinger

Well, I guess it's kind of the point for linters to be somewhat annoying :D
Thanks for the tips, will keep them in mind!

Thread Thread
 
ferricoxide profile image
Thomas H Jones II

Yeah, it's just that some of the linters' determinations are a matter of philosophical disagreement. I mean, sure, warn me that a given thing exposes me to corner-cases, but don't make my damned commit fail.

Presumably, some of these linters will end up being enhanced with ML so that they have enough "intelligence" to know "in this case, we don't need to fail this".