Skip to content

Files

Latest commit

 

History

History
51 lines (38 loc) · 768 Bytes

Lint-CircularArgumentReference.md

File metadata and controls

51 lines (38 loc) · 768 Bytes

Pattern: Circular argument reference

Issue: -

Description

This rule checks for circular argument references in optional keyword arguments and optional ordinal arguments.

This rule mirrors a warning produced by MRI since 2.2.

Examples

# bad

def bake(pie: pie)
  pie.heat_up
end
# good

def bake(pie:)
  pie.refrigerate
end
# good

def bake(pie: self.pie)
  pie.feed_to(user)
end
# bad

def cook(dry_ingredients = dry_ingredients)
  dry_ingredients.reduce(&:+)
end
# good

def cook(dry_ingredients = self.dry_ingredients)
  dry_ingredients.combine
end

Further Reading