Closed
Conversation
- Updated .rubocop.yml to use plugins instead of require for rubocop-performance - Auto-fixed 79 style offenses including: - Changed OrAssignment to use ||= operator - Converted class << self to def self. method definitions - Fixed hash literal brace spacing throughout specs - Manually fixed remaining GitHub/AvoidObjectSendWithDynamicMethod warning by using public_send with a disable comment for intentional dynamic dispatch in test code All rubocop checks now pass with 0 offenses.
c7ed2f5 to
17c5a38
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR addresses code style issues identified by rubocop, focusing on consistency and adherence to Ruby style conventions. The changes include deprecation fixes, class method definition style updates, and spacing corrections.
- Updated
.rubocop.ymlto use the modernplugins:syntax instead of deprecatedrequire:for rubocop-performance - Converted all
class << selfblocks to individualdef self.method definitions across 12 files for consistency - Fixed hash literal spacing by ensuring proper spacing inside braces throughout spec and lib files
- Applied appropriate rubocop disable comments for intentional dynamic method dispatch in test code
Reviewed Changes
Copilot reviewed 14 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| .rubocop.yml | Updated to use plugins: instead of deprecated require: for loading rubocop-performance |
| .gitignore | Added bin/ directory to gitignore |
| spec/spec_helper.rb | Converted class << self to def self. for class methods in Configuration test helpers |
| spec/lib/secure_headers_spec.rb | Fixed spacing in hash literals throughout test cases |
| spec/lib/secure_headers/middleware_spec.rb | Fixed spacing in hash literals for cookie configuration tests |
| spec/lib/secure_headers/headers/policy_management_spec.rb | Fixed spacing after let method call |
| spec/lib/secure_headers/headers/cookie_spec.rb | Fixed spacing in hash literals in cookie test cases |
| spec/lib/secure_headers/headers/content_security_policy_spec.rb | Fixed spacing after let and in hash literals across CSP tests |
| spec/lib/secure_headers/configuration_spec.rb | Added rubocop disable comments for intentional dynamic method use; fixed hash literal spacing |
| lib/secure_headers/headers/x_xss_protection.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/x_permitted_cross_domain_policies.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/x_frame_options.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/x_download_options.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/x_content_type_options.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/strict_transport_security.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/referrer_policy.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/expect_certificate_transparency.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/cookie.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers/headers/clear_site_data.rb | Converted class << self block to individual def self. methods |
| lib/secure_headers.rb | Changed target = guess_target(config) unless target to use ` |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This was referenced Nov 19, 2025
Merged
Contributor
rei-moo
added a commit
that referenced
this pull request
Dec 12, 2025
Inspired by #558 with the addition of disabling `Lint/RedundantCopDisableDirective` in `.rubocop.yml` in order to prevent rubocop errors related to unknown cops for Ruby versions 2.7 and prior. --------- Co-authored-by: Tobias Maier <me@tobiasmaier.info>
rei-moo
added a commit
that referenced
this pull request
Dec 16, 2025
Inspired by #558 with the addition of disabling `Lint/RedundantCopDisableDirective` in `.rubocop.yml` in order to prevent rubocop errors related to unknown cops for Ruby versions 2.7 and prior. --------- Co-authored-by: Tobias Maier <me@tobiasmaier.info>
rei-moo
added a commit
that referenced
this pull request
Dec 16, 2025
Inspired by #558 with the addition of disabling `Lint/RedundantCopDisableDirective` in `.rubocop.yml` in order to prevent rubocop errors related to unknown cops for Ruby versions 2.7 and prior. --------- Co-authored-by: Tobias Maier <me@tobiasmaier.info>
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.
All PRs:
Summary
This PR fixes all code style issues identified by rubocop.
Changes Made:
.rubocop.ymlto useplugins:instead ofrequire:for rubocop-performance (addresses deprecation warning)Style/OrAssignmentviolations to use||=operatorStyle/ClassMethodsDefinitionsfromclass << selftodef self.method definitions across 12 filesLayout/SpaceInsideHashLiteralBracesspacing issues throughout spec filesGitHub/AvoidObjectSendWithDynamicMethodwarning with appropriate rubocop disable comments for intentional dynamic dispatch in test codeVerification:
## Adding a new headerNot applicable - this PR only contains code style fixes
## Adding a new CSP directiveNot applicable - this PR only contains code style fixes