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

Skip LineLength phase on --auto-gen-only-exclude #12730

Merged

Conversation

sambostock
Copy link
Contributor

@sambostock sambostock commented Mar 1, 2024

Phase 1 of config auto-generation runs the Layout/LineLength cop on all files to discover the Max line length, so it can be used by cops which depend on it.

The --auto-gen-only-exclude config skips generating any Max configs, meaning phase 1 is redundant, as we won't generate the Max for use by phase 2.

Therefore, we can skip phase 1 entirely. Even though we're only running Layout/LineLength, parsing the entire codebase twice can get quite time consuming on large repositories.


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.

@sambostock sambostock force-pushed the skip-line-length-phase-on-only-excludes branch from d141a18 to e915229 Compare March 1, 2024 02:17
@bbatsov bbatsov requested a review from jonas054 March 5, 2024 10:39
@bbatsov
Copy link
Collaborator

bbatsov commented Mar 5, 2024

The proposed change looks reasonable to me. @jonas054 please take a look as well.

Copy link
Collaborator

@jonas054 jonas054 left a comment

Choose a reason for hiding this comment

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

Found one thing I would like changed. Other than that, looks good!

@sambostock sambostock force-pushed the skip-line-length-phase-on-only-excludes branch from e915229 to 2edc7ab Compare March 6, 2024 22:04
Phase 1 of config auto-generation runs the `Layout/LineLength` cop on
all files to discover the `Max` line length, so it can be used by cops
which depend on it.

The `--auto-gen-only-exclude` config skips generating any `Max` configs,
meaning phase 1 is redundant, as we won't generate the `Max` for use by
phase 2.

Therefore, we can skip phase 1 entirely.
@sambostock sambostock force-pushed the skip-line-length-phase-on-only-excludes branch from 2edc7ab to 15fb5c7 Compare March 6, 2024 22:18
@sambostock sambostock requested a review from jonas054 March 6, 2024 22:18
Copy link
Collaborator

@jonas054 jonas054 left a comment

Choose a reason for hiding this comment

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

Nice! Approved.

@bbatsov bbatsov merged commit 50a45b0 into rubocop:master Mar 7, 2024
33 checks passed
@sambostock sambostock deleted the skip-line-length-phase-on-only-excludes branch March 7, 2024 14:23
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