The rubocop documentation states "Files and directories are specified relative to the .rubocop.yml file.", however that seems to be untrue based on from where you run rubocop from! Oh no!
To demonstrate the breakage, clone this gist and move the broken.rb to a subdirectory:
mkdir -p rel/path
mv broken.rb rel/path
From there, you can confirm that relative paths work from the same directory as .rubocop.yml:
bundle
bundle exec rubocop rel/path/broken.rb
All good! 1 files inspected, no offenses detected
But if I rely on the behavior for rubocop to go upwards to find the .rubocop.yml
(which it does) it loses the Excludes
configuration.
bundle exec rubocop broken.rb
Inspecting 1 file
W
Offenses:
broken.rb:8:7: W: end at 8, 6 is not aligned with if at 4, 4.
end
^^^
1 file inspected, 1 offense detected