mcandre / stank

stank: analyzers for determining whether files smell like rotten POSIX shell scripts, or faintly rosy like Ruby and Python scripts
Other
52 stars 0 forks source link

funk: shlint-like linting #90

Closed mcandre closed 4 years ago

mcandre commented 4 years ago

For POSIXy but technically not POSIX / generic sh interpreter, try running <interpreter> -n <script> to perform a per-interpreter syntax check.

By the way, it is quite common for DevOps users to be writing scripts for shells that they do not have installed locally or in CI. For example, a mksh script will be unable to mksh -n <script> in most non-MirOS environments.

Ensure explicit mvdan/sh parsing continues to be used for generic "sh" scripts, in order to avoid accidentally parsing with a superset shell like a /bin/sh -> bash s{him,ymlink}.

Note that modern bash 4.2+ offers --posix flag. Combined with -n, this could double as another POSIX sh syntax validator, as long as bash is installed.

Syntax check flags:

The work involves expanding interpreter analysis, populating this field based on filenames when needed.