diff --git a/rules/S1481/shell/rule.adoc b/rules/S1481/shell/rule.adoc index 05889f97639..d1e7fe99de9 100644 --- a/rules/S1481/shell/rule.adoc +++ b/rules/S1481/shell/rule.adoc @@ -1,5 +1,17 @@ include::../rationale.adoc[] +=== Special Cases + +Variables passed by reference to functions whose name contains `by_ref` are considered used. In bash, some functions accept variable names as plain word arguments (not `$var` expansions) and modify them indirectly. When such a function name contains `by_ref`, word arguments matching declared variable names are counted as legitimate usages. + +[source,bash] +---- +function process_data() { + local result status # Compliant: result and status are used by reference + get_values_by_ref result status +} +---- + include::../how-to-fix-it.adoc[] === Code examples