Skip to content

Conversation

r7kamura
Copy link
Contributor

@r7kamura r7kamura commented Jul 2, 2025

When --format or -f CLI option is specified, @options.keys becomes [:format, :formatters] rather than just [:format].

To ensure the following code works correctly, I believe we need to add :formatters to DEFAULT_PARALLEL_OPTIONS as well.

rubocop/lib/rubocop/cli.rb

Lines 148 to 153 in da5d9d4

if (@options.keys - DEFAULT_PARALLEL_OPTIONS).empty? &&
@config_store.for_pwd.for_all_cops['UseCache'] != false
puts 'Use parallel by default.' if @options[:debug]
@options[:parallel] = true
end

Before the change, parallel execution was not enabled by default, as shown below:

$ bundle exec rubocop Gemfile --debug --format progress | grep "Use parallel by default."
$ echo $?
1

After the change, parallel execution is enabled by default.

$ bundle exec rubocop Gemfile --debug --format progress | grep "Use parallel by default."
Use parallel by default.
$ echo $?
0

FYI: As a background, I often run bundle exec rubocop --format progress --format github in GitHub Actions, but I noticed that it consistently takes twice as long as expected on the default 2-core machine. That led me to this issue. For now, I’ve worked around this by explicitly adding --parallel option.


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.

@koic koic merged commit 865c92c into rubocop:master Jul 3, 2025
24 checks passed
@koic
Copy link
Member

koic commented Jul 3, 2025

Thanks!

koic added a commit to koic/rubocop that referenced this pull request Jul 29, 2025
…duleInclusion`

This PR fixes false positives for `Layout/EmptyLinesAfterModuleInclusion`
when `prepend` is used with block methods.

Fixes rubocop#14339.
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.

2 participants