Skip to content

Fix rubocop CI failure: use disable-next for single-statement directives - #988

Draft
numbata wants to merge 2 commits into
masterfrom
fix/rubocop-directive-scope
Draft

Fix rubocop CI failure: use disable-next for single-statement directives#988
numbata wants to merge 2 commits into
masterfrom
fix/rubocop-directive-scope

Conversation

@numbata

@numbata numbata commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

CI on master is red: https://github.com/ruby-grape/grape-swagger/actions/runs/33563460032/job/100041130217

Rubocop's ~> 1.50 constraint resolved to 1.90.0 in that run, which introduced the new Style/DirectiveScope cop. It flags # rubocop:disable / # rubocop:enable comment pairs that only ever wrap a single statement, since a # rubocop:disable-next comment says the same thing without depending on the matching enable staying in sync.

What changed

Ran rubocop -A to apply the cop's own autocorrection at the four flagged sites:

  • lib/grape-swagger/rake/oapi_tasks.rb
  • spec/support/empty_model_parser.rb
  • spec/support/namespace_tags.rb
  • spec/swagger_v2/simple_mounted_api_spec.rb

No behavior change — bundle exec rubocop --parallel --format progress now reports 0 offenses across all 152 files, and the specs in the touched files still pass.

Rubocop 1.90 added Style/DirectiveScope, which was failing CI on master
(https://github.com/ruby-grape/grape-swagger/actions/runs/33563460032).
It flags disable/enable comment pairs that only ever wrap a single
statement, since a scoped disable-next comment says the same thing with
less risk of the enable being dropped or misplaced during edits.

Applied rubocop -A to the four flagged sites; no behavior change.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Danger Report

No issues found.

View run

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