Skip to content

Remove the RuboCop todo file and prune lint disables#1533

Merged
unflxw merged 6 commits into
mainfrom
rubocop-cleanup
Jul 3, 2026
Merged

Remove the RuboCop todo file and prune lint disables#1533
unflxw merged 6 commits into
mainfrom
rubocop-cleanup

Conversation

@unflxw

@unflxw unflxw commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

This is a follow-up to #1532, which upgrades RuboCop to version 1.87 by fixing some issues and generating a .rubocop_todo.yml for the others. This PR removes .rubocop_todo.yml and cleans up .rubocop.yml. The intent is:

  • Stop running lints that do not provide value, and/or lints that we constantly run against and disable in comments
  • Unless there's a self-evident reason to disable a specific lint in a specific file, prefer ad-hoc comments disabling specific lints at specific points in the codebase over .rubocop.yml blanket file disables.

As usual, with matters of the heart and mind and coding guidelines, there is space for disagreement. I went for bold, for reducing complexity, preventing noise, and highlighting genuine exceptions inline.


Stop running lint cops we never enforced

The complexity and length metrics tracked an auto-generated Max
that drifted for years and was never driven down. Lint/RescueException
only ever fired on our deliberate pattern of rescuing Exception to
record the error and re-raise it. Both produced noise instead of
signal, so disable them and drop the inline disables that silenced
them throughout the code.

Use the plain alias form for API aliases

Style/Alias was excluded for these two files. The offenses are all
the alias :x :y colon form and two alias_method calls in class
bodies; rewriting them to alias x y is a safe autocorrect with no
behaviour change, so apply it and drop the exclude.

Disable two naming cops that fight our conventions

Naming/AccessorMethodName flags our deliberate set_/get_ API naming,
and Naming/PredicateMethod wants command methods that return a boolean
renamed as queries. Both were only ever excluded or suppressed, so
disable them and remove the inline disables and excludes they needed.

Replace the lint todo with targeted exceptions

The remaining todo entries were each a single offense, not a file
that categorically should skip a cop. Disable each one inline at the
exact point instead, so the cop keeps protecting the rest of the code.
Make keep_transactions? return false rather than nil so it is a real
predicate. With nothing left to track, delete the generated todo file
and stop inheriting it.

Drop lint disables a small rewrite makes moot

A handful of inline disables marked code that a trivial,
behaviour-preserving rewrite satisfies instead: a guard clause, digit
grouping on a numeric literal, parentheses around an assignment used
as a condition, dropping an exception class already covered by
StandardError, and joining an array of strings rather than chaining
+. Rewrite them so the disables can go.

Document why we deliberately rescue Exception

wait_for must rescue Exception, not StandardError: callers pass blocks
containing RSpec expectations, and ExpectationNotMetError subclasses
Exception, so catching only StandardError stops the retry from working.
Add a comment saying so, and reword the Lint/RescueException disable
note to describe our deliberate uses accurately rather than claiming the
exception is never swallowed.

unflxw added 3 commits June 26, 2026 16:30
The complexity and length metrics tracked an auto-generated Max
that drifted for years and was never driven down. Lint/RescueException
only ever fired on our deliberate pattern of rescuing Exception to
record the error and re-raise it. Both produced noise instead of
signal, so disable them and drop the inline disables that silenced
them throughout the code.

[skip changeset]
Style/Alias was excluded for these two files. The offenses are all
the `alias :x :y` colon form and two `alias_method` calls in class
bodies; rewriting them to `alias x y` is a safe autocorrect with no
behaviour change, so apply it and drop the exclude.

[skip changeset]
Naming/AccessorMethodName flags our deliberate set_*/get_* API naming,
and Naming/PredicateMethod wants command methods that return a boolean
renamed as queries. Both were only ever excluded or suppressed, so
disable them and remove the inline disables and excludes they needed.

[skip changeset]
@backlog-helper

backlog-helper Bot commented Jun 26, 2026

Copy link
Copy Markdown

Hi @unflxw,

We've found some issues with your Pull Request.

  • This Pull Request does not include a changeset. Add a changeset if the change impacts users and should be included in the changelog upon release. Read more about changesets.
    Ignore this rule by adding [skip changeset] to your Pull Request body. - (More info)

New issue guide | Backlog management | Rules | Feedback

@unflxw
unflxw force-pushed the rubocop-cleanup branch from 7d06f4b to 5628782 Compare June 26, 2026 14:31
@unflxw
unflxw changed the base branch from bump-rubocop to main June 26, 2026 14:31
@unflxw
unflxw requested review from Copilot, lipskis and tombruijn June 26, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the auto-generated RuboCop todo file and replaces it with intentional, targeted lint configuration: disabling several cops that were either never enforced or conflict with established project conventions, and pruning now-unnecessary inline suppressions across the codebase.

Changes:

  • Remove .rubocop_todo.yml and stop inheriting it from .rubocop.yml, replacing todo exclusions with explicit cop disables and targeted inline exceptions where still needed.
  • Disable select cops globally (e.g., complexity/length metrics, Lint/RescueException, naming cops) and remove related inline disables/excludes.
  • Apply small behavior-preserving rewrites/autocorrections (alias syntax, guard clause, numeric literal formatting, string concatenation, assignment-in-condition parentheses).

Reviewed changes

Copilot reviewed 39 out of 39 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
spec/support/testing.rb Makes keep_transactions? a strict boolean predicate and removes a naming-cop inline disable.
spec/support/helpers/wait_for_helper.rb Removes inline suppression on rescue Exception in wait helper.
spec/support/helpers/transaction_helpers.rb Removes inline suppression on set_current_transaction naming.
spec/lib/appsignal/utils/data_spec.rb Replaces string + concatenation with array joining for expected JSON output.
spec/lib/appsignal/transaction_spec.rb Updates numeric literal formatting to satisfy style rules without disables.
spec/lib/appsignal/probes/sidekiq_spec.rb Adds targeted inline suppression for Struct.new override.
spec/lib/appsignal/integrations/sidekiq_spec.rb Removes inline Lint/RescueException suppressions in specs.
spec/lib/appsignal/event_formatter_spec.rb Adds targeted inline suppression around class variable reset in spec.
spec/integration/runner.rb Adds parentheses to assignment-in-condition to avoid a lint disable.
lib/puma/plugin/appsignal.rb Removes block-length suppression (metrics cops now disabled).
lib/appsignal/utils/query_params_sanitizer.rb Adds targeted inline suppression for optional boolean parameter cop.
lib/appsignal/transaction.rb Rewrites aliases to the plain alias x y form (Style/Alias).
lib/appsignal/rack/body_wrapper.rb Removes inline Lint/RescueException suppressions.
lib/appsignal/rack/abstract_middleware.rb Removes inline Lint/RescueException suppression.
lib/appsignal/logger.rb Replaces todo exclusion with targeted inline suppression for missing super, and removes metrics disable on add.
lib/appsignal/integrations/webmachine.rb Removes inline Lint/RescueException suppression.
lib/appsignal/integrations/sidekiq.rb Removes inline Lint/RescueException suppression; adds targeted suppression for YAML.load.
lib/appsignal/integrations/shoryuken.rb Removes inline Lint/RescueException suppression.
lib/appsignal/integrations/resque.rb Removes inline Lint/RescueException suppression.
lib/appsignal/integrations/rake.rb Removes inline Lint/RescueException suppression.
lib/appsignal/integrations/que.rb Removes inline Lint/RescueException suppression.
lib/appsignal/integrations/object.rb Rewrites a non-guard if into a guard clause.
lib/appsignal/integrations/delayed_job_plugin.rb Removes inline Lint/RescueException suppression; adds targeted suppression for optional boolean parameter cop.
lib/appsignal/integrations/action_cable.rb Removes inline Lint/RescueException suppression.
lib/appsignal/hooks/active_job.rb Removes metrics disable and inline Lint/RescueException suppression.
lib/appsignal/hooks/action_cable.rb Removes inline Lint/RescueException suppressions.
lib/appsignal/helpers/instrumentation.rb Removes inline Lint/RescueException suppressions and rewrites aliases to plain alias.
lib/appsignal/extension/jruby.rb Removes inline naming-cop suppressions for set_* methods.
lib/appsignal/extension.rb Adds targeted inline suppression for missing super in MockData#initialize.
lib/appsignal/config.rb Removes metrics disable and adds targeted suppression for YAML.load config loading.
lib/appsignal/cli/install.rb Removes metrics disables (metrics cops now disabled).
lib/appsignal/cli/diagnose.rb Removes Lint/ShadowedException suppression by simplifying rescue list.
lib/appsignal/check_in/event.rb Removes metrics disable (metrics cops now disabled).
lib/appsignal.rb Removes metrics disables (metrics cops now disabled).
ext/extconf.rb Adds targeted inline suppression for predicate prefix cop on helper method name.
ext/base.rb Adds targeted inline suppressions for Security/Open around open/URI.open.
appsignal.gemspec Removes block-length suppression (metrics cops now disabled).
.rubocop.yml Stops inheriting from todo, disables several cops globally, and documents rationale.
.rubocop_todo.yml Deleted (no longer generated/used).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread spec/support/helpers/wait_for_helper.rb
Comment thread .rubocop.yml Outdated
Comment thread spec/lib/appsignal/utils/data_spec.rb
unflxw added 2 commits June 26, 2026 16:41
The remaining todo entries were each a single offense, not a file
that categorically should skip a cop. Disable each one inline at the
exact point instead, so the cop keeps protecting the rest of the code.
Make keep_transactions? return false rather than nil so it is a real
predicate. With nothing left to track, delete the generated todo file
and stop inheriting it.

[skip changeset]
A handful of inline disables marked code that a trivial,
behaviour-preserving rewrite satisfies instead: a guard clause, digit
grouping on a numeric literal, parentheses around an assignment used
as a condition, dropping an exception class already covered by
StandardError, and joining an array of strings rather than chaining
`+`. Rewrite them so the disables can go.

[skip changeset]
@unflxw
unflxw force-pushed the rubocop-cleanup branch from 5628782 to b70b148 Compare June 26, 2026 14:41
wait_for must rescue Exception, not StandardError: callers pass blocks
containing RSpec expectations, and ExpectationNotMetError subclasses
Exception, so catching only StandardError stops the retry from working.
Add a comment saying so, and reword the Lint/RescueException disable
note to describe our deliberate uses accurately rather than claiming the
exception is never swallowed.

[skip changeset]
@unflxw
unflxw force-pushed the rubocop-cleanup branch from b279ae5 to b53c211 Compare June 26, 2026 14:57
@backlog-helper

This comment has been minimized.

2 similar comments
@backlog-helper

This comment has been minimized.

@backlog-helper

This comment has been minimized.

@backlog-helper

backlog-helper Bot commented Jul 3, 2026

Copy link
Copy Markdown

This is a message from the daily scheduled checks.

New issue guide | Backlog management | Rules | Feedback

@unflxw
unflxw merged commit 289de53 into main Jul 3, 2026
214 checks passed
@tombruijn tombruijn added the chore A small task that takes a day or two at the most. label Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore A small task that takes a day or two at the most.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants