Skip to content

Files

Latest commit

 

History

History
29 lines (19 loc) · 599 Bytes

Airbnb-ConstAssignedInWrongFile.md

File metadata and controls

29 lines (19 loc) · 599 Bytes

Pattern: Const assigned in wronf file

Issue: -

Description

Checks for a constant assigned in a file that does not match its owning scope. The Rails autoloader can't find such a constant, but sometimes people "get lucky" if the file happened to be loaded before the method was defined.

Examples

# bad

# foo/bar.rb
module Foo
  BAZ = 42
end

# good

# foo.rb
module Foo
  BAZ = 42
end

Further Reading