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

[#8362] Display correctable offenses in summary #8496

Conversation

nguyenquangminh0711
Copy link
Contributor

@nguyenquangminh0711 nguyenquangminh0711 commented Aug 9, 2020

Solve #8362

  • When doing investigation only, without -a. It
    Screenshot from 2020-08-10 20-51-16

  • When running safe corrector:
    Screenshot from 2020-08-10 20-51-27


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.

@nguyenquangminh0711 nguyenquangminh0711 changed the title [https://github.com/rubocop-hq/rubocop/issues/8362] Display correctable offenses in summary [#8362] Display correctable offenses in summary Aug 9, 2020
"#{files} inspected, #{offenses} detected, #{corrections} corrected"
if @correctable_count.positive?
"#{files} inspected, #{offenses} detected, #{corrections} corrected,"\
" #{correctable} correctable"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd probably use auto-correctable here, so it's clearer we're talking about offenses RuboCop can fix itself.

@bbatsov
Copy link
Collaborator

bbatsov commented Aug 10, 2020

I like a lot the proposed change! Nicely done! I'll likely merge it after cutting 0.89.1, unless someone has any objections.

@nguyenquangminh0711
Copy link
Contributor Author

Great, thanks for your review ❤️. Glad I can help.

Btw, do you have any reviews on this @marcandre? Implemented based on your idea in the issue.

@marcandre
Copy link
Contributor

Great, thanks for addressing this 😄
Only thing I'd change is I'd output the number of unsafe auto-corrections.
Instead of "More offenses...", how about "42 more offenses..."?

@bbatsov
Copy link
Collaborator

bbatsov commented Aug 10, 2020

Instead of "More offenses...", how about "42 more offenses..."?

Good idea!

@nguyenquangminh0711
Copy link
Contributor Author

It looks like it's not every friendly if we have 2 lines stating the same thing. So, I merge into 1 line, and make the language a little bit more natural:

  • When doing investigation only, without -a. It
    Screenshot from 2020-08-10 20-51-16

  • When running safe corrector:
    Screenshot from 2020-08-10 20-51-27

CHANGELOG.md Outdated
@@ -15,6 +15,7 @@
### Changes

* [#8487](https://github.com/rubocop-hq/rubocop/pull/8487): Detect `<` and `>` as comparison operators in `Style/ConditionalAssignment` cop. ([@biinari][])
* [#8362](https://github.com/rubocop-hq/rubocop/issues/8362): Add numbers of correctable offenses to summary. ([@nguyenquangminh0711][])
Copy link
Collaborator

Choose a reason for hiding this comment

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

You'll have to move this under master, as I just cut 0.89.1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Sorry, I'm not aware that you cut a new relase some couple of hours ago

@nguyenquangminh0711 nguyenquangminh0711 force-pushed the feature/display-correctable-offenses-in-summary branch from 024bd70 to fcfe856 Compare August 10, 2020 14:57
@bbatsov bbatsov merged commit cfb519d into rubocop:master Aug 10, 2020
@bbatsov
Copy link
Collaborator

bbatsov commented Aug 10, 2020

Thanks for tackling this! 🙇‍♂️

@nguyenquangminh0711 nguyenquangminh0711 deleted the feature/display-correctable-offenses-in-summary branch August 10, 2020 16:10
@marcandre
Copy link
Contributor

Thank you @nguyenquangminh0711 for fulfilling my wish! ❤️

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

3 participants