Skip to content

Files

Latest commit

 

History

History
27 lines (18 loc) · 665 Bytes

Style-OptionalArguments.md

File metadata and controls

27 lines (18 loc) · 665 Bytes

Pattern: Malformed optional arguments

Issue: -

Description

This rule checks for optional arguments to methods that do not come at the end of the argument list. Ruby has some unexpected results when calling methods that have optional arguments at the front of the list.

Examples

# bad
def foo(a = 1, b, c)
end

# good
def baz(a, b, c = 1)
end

def foobar(a = 1, b = 2, c = 3)
end

Further Reading