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

Add autocorrection for Rails/FilePath #991

Merged
merged 1 commit into from
May 3, 2023

Conversation

r7kamura
Copy link
Contributor

Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.

@koic
Copy link
Member

koic commented Apr 25, 2023

I've just merge #989. Can you rebase with the latest master branch and add a expect_correction test for that?

Comment on lines 115 to 126
context 'when using Rails.root called by double quoted string that ends with string interpolation' do
it 'registers an offense' do
expect_offense(<<~'RUBY')
"#{Rails.root}/a/#{b}"
^^^^^^^^^^^^^^^^^^^^^^ Prefer `Rails.root.join('path/to')`.
RUBY

expect_correction(<<~'RUBY')
"#{Rails.root.join("a/#{b}")}"
RUBY
end
end
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just merge #989. Can you rebase with the latest master branch and add a expect_correction test for that?

Thanks for the quick merge! Actually, I already have a test case for that here 👌
Anyway, I will rebase and try to resolve the conflict.

@koic koic merged commit d71ac2e into rubocop:master May 3, 2023
4 checks passed
@koic
Copy link
Member

koic commented May 3, 2023

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants