File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,20 @@ def check
19
19
20
20
# Iterate over each command found in any exec
21
21
exec_resources . each do |command_resources |
22
- # Iterate over each command in execs and check for unsafe interpolations
23
- command_resources [ :tokens ] . each do |token |
24
- # We are only interested in tokens from command onwards
25
- next unless token . type == :NAME
26
- # Don't check the command if it is parameterised
27
- next if parameterised? ( token )
22
+ check_unsafe_interpolations ( command_resources )
23
+ end
24
+ end
28
25
29
- check_command ( token ) . each do |t |
30
- notify_warning ( t )
31
- end
26
+ # Iterates over tokens in a command and raises a warning if an interpolated variable is found
27
+ def check_unsafe_interpolations ( command_resources )
28
+ command_resources [ :tokens ] . each do |token |
29
+ # We are only interested in tokens from command onwards
30
+ next unless token . type == :NAME
31
+ # Don't check the command if it is parameterised
32
+ next if parameterised? ( token )
33
+
34
+ check_command ( token ) . each do |t |
35
+ notify_warning ( t )
32
36
end
33
37
end
34
38
end
You can’t perform that action at this time.
0 commit comments