shellcheck
shellcheck copied to clipboard
Suggestion: Tell if a variable can be declared as 'readonly'
For new checks and feature suggestions
- [x] shellcheck.net (i.e. the latest commit) currently gives no useful warnings about this
- [x] I searched through https://github.com/koalaman/shellcheck/issues and didn't find anything related
Many times a novice makes the mistake of not using the 'readonly' keyword for variables intended to be read-only. If a variable is not changed one could get a suggestion to declare it readonly.
Linters for other programming languages offer this feature. This helps the code to better reflect the author's intention and reduce mistakes.