Skip to content

Fix Style/DirectiveScope offense failing the RuboCop build - #752

Merged
anakinj merged 1 commit into
jwt:mainfrom
anakinj:fix/rubocop-directive-scope
Sep 2, 2026
Merged

Fix Style/DirectiveScope offense failing the RuboCop build#752
anakinj merged 1 commit into
jwt:mainfrom
anakinj:fix/rubocop-directive-scope

Conversation

@anakinj

@anakinj anakinj commented Sep 2, 2026

Copy link
Copy Markdown
Member

Description

main has been failing the RuboCop build since 2026-08-28 with no code change behind it. The scheduled runs on the same commit a2cb2723 show the flip:

2026-08-28  failure  a2cb2723
2026-08-21  success  a2cb2723

RuboCop's Style/DirectiveScope cop was added in a recent release and is picked up automatically through NewCops: enable. It flags a disable/enable pair that wraps exactly one statement, which is the case for the pair around module SecurityUtils in lib/jwt/jwa/hmac.rb:

lib/jwt/jwa/hmac.rb:60:7: C: [Correctable] Style/DirectiveScope:
Use disable-next instead of a disable/enable pair around a single statement.

This switches to the statement-scoped disable-next form and drops the closing enable. The suppression still covers the whole module, since the module definition is the single statement the directive applies to.

Comment-only change; no behaviour is affected.

Checklist

Before the PR can be merged be sure the following are checked:

  • There are tests for the fix or feature added/changed — n/a, this is a lint directive change with no behaviour change
  • A description of the changes and a reference to the PR has been added to CHANGELOG.md. More details in the CONTRIBUTING.md

@anakinj
anakinj force-pushed the fix/rubocop-directive-scope branch from 151cf06 to ec22feb Compare September 2, 2026 13:52
RuboCop's Style/DirectiveScope cop, added in a recent release and picked
up automatically via `NewCops: enable`, flags a disable/enable pair that
wraps exactly one statement. The pair around `module SecurityUtils` is
such a case, so main has been failing the RuboCop build since 2026-08-28
without any code change (the same commit passed on 2026-08-21).

Use the statement-scoped `disable-next` form instead. The suppression
still covers the whole module, as the module definition is the single
statement the directive applies to.
@anakinj
anakinj force-pushed the fix/rubocop-directive-scope branch from ec22feb to 95f4843 Compare September 2, 2026 13:53
@anakinj
anakinj merged commit bedd65a into jwt:main Sep 2, 2026
15 checks passed
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