bash3boilerplate icon indicating copy to clipboard operation
bash3boilerplate copied to clipboard

better style guide checking (properly parse bash vs regex-hit-and-miss)

Open mstreuhofer opened this issue 8 years ago • 8 comments

See discussion in PR #81

mstreuhofer avatar Dec 21 '16 19:12 mstreuhofer

Some potentially helpful links:

  • https://github.com/vorpaljs/bash-parser
  • https://github.com/idank/bashlex
  • https://github.com/grncdr/js-shell-parse
  • http://hackage.haskell.org/package/language-sh
  • https://google.github.io/styleguide/shell.xml
  • https://github.com/bahamas10/bash-style-guide
  • http://wiki.bash-hackers.org/scripting/style
  • https://github.com/skudriashev/bashlint

zbeekman avatar Feb 10 '17 14:02 zbeekman

what about shfmt (https://github.com/mvdan/sh) ? it seems to be opinionated as in there is no way to influence the acceptable style but at least it is readily available in homebrew

mstreuhofer avatar Mar 31 '17 16:03 mstreuhofer

Looks promising at first glance, have you ran it against any code?

kvz avatar Apr 03 '17 11:04 kvz

yes. strangely it wants to change all if [[ $var = "x" ]] to if [[ $var == "x" ]]. Other than that it just removes some empty lines.

mstreuhofer avatar Apr 03 '17 15:04 mstreuhofer

Shellcheck could be nice too https://github.com/koalaman/shellcheck

kenden avatar Oct 18 '17 08:10 kenden

@kenden we already use shellcheck. This is about style beyond linting/syntax checking 😉

zbeekman avatar Oct 18 '17 11:10 zbeekman

A complete Bash parser in JavaScript transpiled from Go https://www.npmjs.com/package/mvdan-sh #hackernews

kvz avatar May 16 '18 17:05 kvz

also found this yesterday, just sharing as it might interest you https://google.github.io/styleguide/shell.xml

kvz avatar May 16 '18 17:05 kvz