Skip to content

Fix incorrect disabling of departments when inheriting configuration#13942

Merged
bbatsov merged 1 commit intorubocop:masterfrom
koic:fix_disabling_of_departments_when_inheriting_configuration
Mar 4, 2025
Merged

Fix incorrect disabling of departments when inheriting configuration#13942
bbatsov merged 1 commit intorubocop:masterfrom
koic:fix_disabling_of_departments_when_inheriting_configuration

Conversation

@koic
Copy link
Member

@koic koic commented Mar 4, 2025

This fixes an issue where departments that were disabled in rubocop-i18n were unexpectedly enabled, even when they were also disabled in the user configuration.

Since override_department_setting_for_cops is processed in resolve_inheritance, unnecessary calls were being made. This caused 'override_department' to be unexpectedly set for cop's Enabled.
It seems that part of the configuration processing changes introduced with plugin support was missed.

Fixes rubocop/rubocop-i18n#66.


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.

This fixes an issue where departments that were disabled in `rubocop-i18n` were unexpectedly enabled,
even when they were also disabled in the user configuration.

Since `override_department_setting_for_cops` is processed in `resolve_inheritance`,
unnecessary calls were being made. This caused `'override_department'` to be unexpectedly set
for cop's `Enabled`.
It seems that part of the configuration processing changes introduced with plugin support was missed.

Fixes rubocop/rubocop-i18n#66.
@koic koic force-pushed the fix_disabling_of_departments_when_inheriting_configuration branch from c0f43f6 to 4c09f85 Compare March 4, 2025 06:22
@bbatsov bbatsov merged commit 4ae459d into rubocop:master Mar 4, 2025
24 checks passed
@bbatsov
Copy link
Collaborator

bbatsov commented Mar 4, 2025

Thanks!

@koic koic deleted the fix_disabling_of_departments_when_inheriting_configuration branch March 4, 2025 07:22
@pboling
Copy link
Contributor

pboling commented Mar 4, 2025

I have seen similar config problems in other gems, when I have an exceptionally deep stack of rubocop gems. Thanks for finding this, I expect there is a decent chance the other issues had the same root cause.

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.

Config broken with switch to plugin

3 participants