Skip to content

Commit 6465378

Browse files
committed
Exclude File.join from Rails/RootPathnameMethods target methods
1 parent 24ff064 commit 6465378

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#1001](https://github.com/rubocop/rubocop-rails/pull/1001): Exclude `File.join` from `Rails/RootPathnameMethods` target methods. ([@r7kamura][])

lib/rubocop/cop/rails/root_pathname_methods.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class RootPathnameMethods < Base
6565
fnmatch?
6666
ftype
6767
grpowned?
68-
join
6968
lchmod
7069
lchown
7170
lstat

spec/rubocop/cop/rails/root_pathname_methods_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,10 @@
191191
file = Rails.root.join('docs', 'invoice.pdf').open
192192
RUBY
193193
end
194+
195+
it 'does not register an offense when using `File.join(Rails.root, ...)`' do
196+
expect_no_offenses(<<~RUBY)
197+
File.join(Rails.root, '/foo')
198+
RUBY
199+
end
194200
end

0 commit comments

Comments
 (0)