Ask HN: Let’s build Checkstyle for Bash?


W3Schools
Ask HN: Let’s build Checkstyle for Bash?
by a-t-0 on Hacker News.
After working with Bash and Shellcheck for a few months, I noticed I could improve my code quality by making it compliant with the Shell Style Guide by Google [0]. While working on that, I thought some aspects of this Shell style guide can be verified automatically, granted some assumptions/opinions are formed. So I looked around for linting tools and autoformatters for Bash: Shellcheck: https://ift.tt/nYuPNmd From Asynchronous Lint Engine (ALE): https://ift.tt/eLzd4CT – bashate: https://ift.tt/eGTWcnl – cspell: https://ift.tt/cqSg9ZD – Bash Language Server: https://ift.tt/yfg8kBX – shell -n flag: https://ift.tt/kMd4eoK – sh: https://ift.tt/4K5qsSy From this stack post [1]: – checkbashisms: https://ift.tt/6irf2Qa – shlint: https://ift.tt/BI5J8bV (archived) Prettier: https://ift.tt/bEY7xer Within all these linters and auto-formatters I did not find checks that enforce, for example, the Function Comments of the Shell Style Guide by Google: All function comments should describe the intended API behaviour using: Description of the function.
Globals: List of global variables used and modified.
Arguments: Arguments taken.
Outputs: Output to STDOUT or STDERR.
Returns: Returned values other than the default exit status of the last command run.

Hence, I thought we could make a Bash linting tool that verifies compliance with the Shell Style Guide by Google. To do so, a brief start was made here [2]. It identifies/lists elements in that style guide that may be verified automatically. Since Bash has been around longer than me, I think there may be some people better suited for the development of this enhanced linter. Hence, I thought it might be wise, for impact and usability, to share this idea here. What do you say, HN? [0]: https://ift.tt/sjyo4vl [1]: https://ift.tt/eo8THLk [2]: https://ift.tt/sTr3hXm


W3Schools

Leave a comment