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

Suppress RuboCop output when there are no offenses in code generation #51808

Merged

Conversation

koic
Copy link
Contributor

@koic koic commented May 13, 2024

Motivation / Background

Follow up #51782.

But it's overkill for the default case where people use the default style guide,
and it introduces both delay and console output as a cost.

Detail

When there are no offenses with the coding style generated by code generation, outputting RuboCop results to the console was redundant. Since RuboCop has --format=quiet option that suppresses console output when there are no offenses, this PR adds that option: https://docs.rubocop.org/rubocop/1.63/formatters.html#quiet-formatter

While this PR doesn't resolve any added execution speed by RuboCop, the frequency of using the generator is not high within the development flow. Therefore, depending on the execution speed, it might be possible to uncomment #51782, but this PR respects the defaults in #51782 and doesn't address that.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

Follow up rails#51782.

> But it's overkill for the default case where people use the default style guide,
> and it introduces both delay and console output as a cost.

When there are no offenses with the coding style generated by code generation,
outputting RuboCop results to the console was redundant.
Since RuboCop has `--format=quiet` option that suppresses console output
when there are no offenses, this PR adds that option:
https://docs.rubocop.org/rubocop/1.63/formatters.html#quiet-formatter

While this PR doesn't resolve any added execution speed by RuboCop,
the frequency of using the generator is not high within the development flow.
Therefore, depending on the execution speed, it might be possible to uncomment rails#51782,
but this PR respects the defaults in rails#51782 and doesn't address that.
@rails-bot rails-bot bot added the railties label May 13, 2024
@rafaelfranca rafaelfranca merged commit 48d6285 into rails:main May 13, 2024
3 checks passed
@koic koic deleted the suppress_rubocop_output_when_code_generation branch May 13, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants