shellcheck icon indicating copy to clipboard operation
shellcheck copied to clipboard

Suggestion: Tell if a variable can be declared as 'readonly'

Open nihilus opened this issue 8 years ago • 1 comments

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.

nihilus avatar Nov 08 '17 10:11 nihilus

Linters for other programming languages offer this feature. This helps the code to better reflect the author's intention and reduce mistakes.

mcandre avatar Mar 29 '22 15:03 mcandre