Fix rubocop CI failure: use disable-next for single-statement directives - #988
Draft
numbata wants to merge 2 commits into
Draft
Fix rubocop CI failure: use disable-next for single-statement directives#988numbata wants to merge 2 commits into
numbata wants to merge 2 commits into
Conversation
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.
Danger ReportNo issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CI on
masteris red: https://github.com/ruby-grape/grape-swagger/actions/runs/33563460032/job/100041130217Rubocop's
~> 1.50constraint resolved to1.90.0in that run, which introduced the newStyle/DirectiveScopecop. It flags# rubocop:disable/# rubocop:enablecomment pairs that only ever wrap a single statement, since a# rubocop:disable-nextcomment says the same thing without depending on the matchingenablestaying in sync.What changed
Ran
rubocop -Ato apply the cop's own autocorrection at the four flagged sites:lib/grape-swagger/rake/oapi_tasks.rbspec/support/empty_model_parser.rbspec/support/namespace_tags.rbspec/swagger_v2/simple_mounted_api_spec.rbNo behavior change —
bundle exec rubocop --parallel --format progressnow reports 0 offenses across all 152 files, and the specs in the touched files still pass.