Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive with Rails/FilePath for a list of paths separated by colon including Rails.root #700

Closed
tk0miya opened this issue May 2, 2022 · 0 comments

Comments

@tk0miya
Copy link
Contributor

tk0miya commented May 2, 2022

When I created a list of paths separated by colon (like $PATH envvar) including Rails.root, the Rails/FilePath cop warns to use Rails.root.join. But it's not appropriate in this case.

Expected behavior

No warning is emitted.

Actual behavior

$ bundle exec rubocop --require rubocop-rails
Inspecting 2 files
.C

Offenses:

test.rb:3:8: C: Rails/FilePath: Prefer Rails.root.join('path/to').
PATH = "#{Rails.root}:/path/to/directory"
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

2 files inspected, 1 offense detected

Steps to reproduce the problem

https://github.com/tk0miya/rubocop-rails-bugs is a minimal reproducible project.

RuboCop version

$ bundle exec rubocop --require rubocop-rails -Vbugs [master]
1.28.2 (using Parser 3.1.2.0, rubocop-ast 1.17.0, running on ruby 3.1.2 x86_64-darwin19)
  - rubocop-rails 2.14.2
tk0miya added a commit to tk0miya/rubocop-rails that referenced this issue May 2, 2022
@koic koic closed this as completed in 4977ea3 May 2, 2022
koic added a commit that referenced this issue May 2, 2022
…ilepath_for_colon_separated_pathlist

[Fix #700] Fix a false positive for `Rails/FilePath`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant