VOLTTRON / volttron

VOLTTRON Distributed Control System Platform
https://volttron.readthedocs.io/
Other
460 stars 218 forks source link

Suggestion: use shellcheck to lint shell scripts #2373

Open SKalt opened 4 years ago

SKalt commented 4 years ago

Description of Issue

Shell scripts are similar to magic: difficult for the uninitiated to read, require care to write, and can result in cursing. Voltron has ~2000 lines of them. shellcheck is a linter which helps point out places where shell scripts might break, such as unexpected splitting of a variable or cding into a nonexistant directory. shellcheck could be used in CI and in most major IDEs during development.

Affected Version

the develop branch as of 2020-06-10.

Steps to Reproduce

# in a debian-based system; *nixes and windows also supported.
apt-get install shellcheck; shellcheck +x ./**/*.sh

Additional Details

suggested actions:

  1. address the existing shellcheck issues.
  2. add a script running shellcheck and run the script during CI.
  3. document using shellcheck for contributors

If I get the go-ahead from the volttron team, I'd be happy to PR these changes.

craig8 commented 4 years ago

@SKalt Please go for it... Though I would not do it on all of the scripts. I think some of the scripts need to be trimmed as we are doing somethings different(better?) in other places.