You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See #1944
for the issue that recalled me of it.
I checked that no current rule (activated with --enable=all for example) yields suggestions to add such keywords in your code.
I have a very simple rule to propose:
If there is only one match of the regexp like "^\s*@my_variable_name@=.*$" adapted to the variable in the current file, propose to add readonly keyword. Another feature would be to define a project variant of this to check all lines of bash scripts in . for example instead of just the current file. Regarding local vs global variable in functions, it could make sense that each variable in a function is defined with local or declare or typeset or that a warning is issued by some rule (the case of exterior variables could be dealed with # shellcheck disable=SC1111(@my_variable_name@) at beginning of function with function scope.
Best regards,
Laurent Lyaudet
The text was updated successfully, but these errors were encountered:
Hello :),
I may have used readonly or local keywords in some of my shell scripts in the past.
But at some point, I forgot about this keywords.
For new checks and feature suggestions
See #1944
for the issue that recalled me of it.
I checked that no current rule (activated with --enable=all for example) yields suggestions to add such keywords in your code.
I have a very simple rule to propose:
If there is only one match of the regexp like "^\s*@my_variable_name@=.*$" adapted to the variable in the current file, propose to add readonly keyword. Another feature would be to define a project variant of this to check all lines of bash scripts in . for example instead of just the current file. Regarding local vs global variable in functions, it could make sense that each variable in a function is defined with local or declare or typeset or that a warning is issued by some rule (the case of exterior variables could be dealed with
# shellcheck disable=SC1111(@my_variable_name@)
at beginning of function with function scope.Best regards,
Laurent Lyaudet
The text was updated successfully, but these errors were encountered: