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

Refactor spec use expect_correction in Lint cops #8285

Merged

Conversation

biinari
Copy link
Contributor

@biinari biinari commented Jul 9, 2020

Part of #8127

Use newer expect_correction API in Lint namespace cops.

Move expected corrections to directly follow expected offenses.


Before submitting the PR make sure the following are checked:

  • 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.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

Use newer expect_correction API in Lint namespace cops.

Move expected corrections to directly follow expected offenses.
Copy link
Contributor

@marcandre marcandre left a comment

Choose a reason for hiding this comment

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

Wow, very impressive PR 💪! The result look so much better 😄

Here are a few things I noticed, but I'm too tired to really go through it tonight...

spec/rubocop/cop/lint/empty_when_spec.rb Outdated Show resolved Hide resolved
spec/rubocop/cop/lint/multiple_comparison_spec.rb Outdated Show resolved Hide resolved
@marcandre
Copy link
Contributor

marcandre commented Jul 9, 2020

Tangential: created #8286

@biinari
Copy link
Contributor Author

biinari commented Jul 9, 2020

I'm going to go with matching the message = ... pattern used in the rest of the files touched here with long offense messages (for consistency within the file and hopefully for improved readability).

Be consistent within UnusedMethodArgument and UnusedBlockArgument specs by
defining the offense message just before the code.
@marcandre
Copy link
Contributor

💪 Lots of great work in there, thanks! 🎉

Result looks super clean. Great job.

BTW, we can now abbreviate the error messages with [...]; no need to amend this PR but if you continue cleaning up other specs...

@marcandre marcandre merged commit 5c77009 into rubocop:master Jul 10, 2020
@biinari
Copy link
Contributor Author

biinari commented Jul 10, 2020

Thanks @marcandre. I'm going to take a look at the style namespace cops this weekend (probably split into ranges to keep PR size reasonable).

I'll make use of the [...] abbreviation in those. Nice work getting that in.

@biinari biinari deleted the refactor/expect_correction_lint_cops branch July 10, 2020 22:47
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