Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions rules/S1481/shell/rule.adoc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading