Skip to content

Fix all RuboCop violations for rubocop 1.89 compatibility - #658

Open
tungleduyxyz wants to merge 7 commits into
masterfrom
rubocop-fixes
Open

Fix all RuboCop violations for rubocop 1.89 compatibility#658
tungleduyxyz wants to merge 7 commits into
masterfrom
rubocop-fixes

Conversation

@tungleduyxyz

Copy link
Copy Markdown
Contributor

Summary

  • rubocop 1.89 introduced Lint/CopDirectiveSyntax which rejects disable-next-line as an invalid mode (only enable, disable, todo, push, pop are valid). Replaced all disable-next-line comments with inline # rubocop:disable on the specific offense lines.
  • Fixed genuine violations in queues_controller.rb by refactoring the begin/rescue/ensure pattern to eliminate Lint/SuppressedException and Lint/EnsureReturn.
  • Simplified get_layout in engine_controller_util.rb by removing the useless layout ||= assignment.
  • Moved HashCompareByIdentity inline suppression to the actual offense lines (previously the comment was on the def line, not the real violations).

Rubocop result: 172 files inspected, no offenses detected

Test plan

  • CI rubocop check passes
  • Existing tests continue to pass

🤖 Generated with Claude Code

tungleduyxyz and others added 7 commits August 28, 2026 22:05
Replace disable/enable pairs with disable-next-line directives and
fix double-space after `when` keywords in custom_fields_controller.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rubocop 1.89 introduced Lint/CopDirectiveSyntax which rejects
disable-next-line directives. Replace all disable-next-line comments
with inline rubocop:disable on the specific offense lines.

Also fix genuine violations:
- queues_controller: refactor begin/rescue/ensure pattern to
  eliminate Lint/SuppressedException and Lint/EnsureReturn
- engine_controller_util: simplify get_layout, remove useless
  layout ||= assignment
- invoices_controller, bundles_controller: inline-suppress
  Lint/HashCompareByIdentity on actual offense lines (not method def)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The Lint/HashCompareByIdentity cop flagged hsh[entry.object_id] patterns.
Rather than suppressing, use group_by(&:object_id) which is cleaner and
idiomatic. Note: object_id here is a Kill Bill API attribute (UUID string),
not Ruby's Object#object_id.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reader methods should not be prefixed with get_. Rename to current_layout
to avoid conflict with Rails' layout class macro.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace float equality (unreliable for money) with to_d comparison
so partial vs full refund detection works correctly for all amounts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use .dup to create distinct objects with the same email value instead
of comparing an object to itself. Tests the same invariant (equal email
values compare as 0) without identical operands.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Prevent future CI breakage from unexpected rubocop upgrades introducing
new cops. Use ~> patch-level pins so bugfixes still apply automatically.
Upgrade intentionally by bumping these constraints when ready.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant