Skip to content

Commit

Permalink
Exclude File.join from Rails/RootPathnameMethods target methods
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura committed May 9, 2023
1 parent 24ff064 commit 6465378
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#1001](https://github.com/rubocop/rubocop-rails/pull/1001): Exclude `File.join` from `Rails/RootPathnameMethods` target methods. ([@r7kamura][])
1 change: 0 additions & 1 deletion lib/rubocop/cop/rails/root_pathname_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class RootPathnameMethods < Base
fnmatch?
ftype
grpowned?
join
lchmod
lchown
lstat
Expand Down
6 changes: 6 additions & 0 deletions spec/rubocop/cop/rails/root_pathname_methods_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,10 @@
file = Rails.root.join('docs', 'invoice.pdf').open
RUBY
end

it 'does not register an offense when using `File.join(Rails.root, ...)`' do
expect_no_offenses(<<~RUBY)
File.join(Rails.root, '/foo')
RUBY
end
end

0 comments on commit 6465378

Please sign in to comment.