Rubocop version: 0.47.1
For example the following command is listed as offense, but there is no path to join
system "wheneverize '#{Rails.root}'" unless File.exist? @filepath
if I use rails_path = Rails.root there is no offense detected, so there must be a problem with the curly brackets I guess.
This issue looks like a duplicate of https://github.com/bbatsov/rubocop/issues/3947.
I have another example of misdetection:
Dir.glob(Rails.root.join("config/**/*.env.#{Rails.env}"), File::FNM_DOTMATCH))
@dabroz Rubocop wants you to rewrite that example as:
Dir.glob(Rails.root.join('config', '**', "*.env.#{Rails.env}"), File::FNM_DOTMATCH))
I think the offense message needs changed somehow. I was confused by it recently, too.
Most helpful comment
@dabroz Rubocop wants you to rewrite that example as:
I think the offense message needs changed somehow. I was confused by it recently, too.