Skip to content

Files

Latest commit

 

History

History
35 lines (25 loc) · 634 Bytes

Lint-TrailingCommaInAttributeDeclaration.md

File metadata and controls

35 lines (25 loc) · 634 Bytes

Pattern: Use of trailing comma in attribute declaration

Issue: -

Description

This rule checks for trailing commas in attribute declarations, such as #attr_reader. Leaving a trailing comma will nullify the next method definition by overriding it with a getter method.

Examples

# bad
class Foo
  attr_reader :foo,

  def bar
    puts "Unreachable."
  end
end

# good
class Foo
  attr_reader :foo

  def bar
    puts "No problem!"
  end
end

Further Reading