Details
Description
The existing rule UnusedFunctionParameter S1172 does not work for Ruby code.
The rule raises on methods that are either:
- under TopLevelTree (not in a class) - but for ruby, the parent of the context of a top-level function is a Block, not a TopLevelTree (except when the function is the only piece of code in the file)
- a private class method, but in ruby the modifier doesn't seem to get in the tree
def is_not_used( a ) puts "Hello, World!" # FN end class Foo private def is_not_used( a ) puts "Hello, World!" # FN end end class Bar private def is_not_used( a ) puts "Hello, World!" # FN end end
Note: the rule works only if the function is the only piece of code in the file
def foo(unused)
puts 'Hello' # Noncompliant
end
Attachments
Issue Links
- is related to
-
SONARSLANG-520 [Ruby] Support access modifiers for functions
-
- Closed
-