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 in Rails/FilePath cop #3947

Closed
lucascaton opened this issue Jan 21, 2017 · 0 comments · Fixed by #5461
Closed

False positive in Rails/FilePath cop #3947

lucascaton opened this issue Jan 21, 2017 · 0 comments · Fixed by #5461
Labels

Comments

@lucascaton
Copy link

lucascaton commented Jan 21, 2017

Expected behavior

Rails/FilePath cop (PR) shouldn't complain when I have the following code:

system "rm -rf #{Rails.root.join('public', 'system')}"

Actual behavior

$ rubocop --only Rails/FilePath

Offenses:
lib/tasks/db.rake:52:12: C: Rails/FilePath: Please use Rails.root.join('path', 'to') instead.
    system "rm -rf #{Rails.root.join('public', 'system')}"
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

RuboCop version

0.47.1 (using Parser 2.3.3.1, running on ruby 2.3.3 x86_64-darwin16)

Thank you.

@bbatsov bbatsov added the bug label Jan 22, 2017
jspanjers added a commit to jspanjers/rubocop that referenced this issue Jan 28, 2017
@lucascaton lucascaton changed the title Rails/FilePath cop complains even when I have the expected code False positive in Rails/FilePath cop Mar 27, 2017
koic added a commit to koic/rubocop that referenced this issue Jan 14, 2018
Fixes rubocop#3947 and Fixes rubocop#3974.

This PR is the takeover of rubocop#4178. It fixes a false positive for `Rails/FilePath`
when using `Rails.root.join` in string interpolation of argument.

In addition, the following review comments are reflected in the test cases.

- rubocop#4178 (comment)
- rubocop#4178 (comment)
bbatsov pushed a commit that referenced this issue Jan 14, 2018
Fixes #3947 and Fixes #3974.

This PR is the takeover of #4178. It fixes a false positive for `Rails/FilePath`
when using `Rails.root.join` in string interpolation of argument.

In addition, the following review comments are reflected in the test cases.

- #4178 (comment)
- #4178 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants