shellcheck
shellcheck copied to clipboard
[Feature Request] Add directives "is_set" and "is_used"
SC2154 and SC2034 are about unset and unused variables. But when I'm sure a variable is set (in a function with the var name in argument for example), I'd like to tell Shellcheck about it.
I think something like this would be great:
set_variable my_var_name my_var_value
# shellcheck is_set=my_var_name,my_other_var_name
echo "$my_var_name" # <--- no warning here
same would be for unused variables :
my_new_var="hello world" # <-- no warning here because of the is_used later
use_variable my_new_var
# shellcheck is_used=my_new_var