[rb] Update lint configuration and fix rubocop offenses by titusfortner ยท Pull Request #17008 ยท SeleniumHQ/selenium
๐ฅ What does this PR do?
Updates Ruby lint configuration and fixes rubocop offenses to reduce inline disable comments:
- Remove unnecessary exclusions from
.rubocop.ymlfor files that now pass lint checks - Add
SteepfiletoBlockLengthexclusion instead of inline disable comment - Add proper
respond_to_missing?methods wheremethod_missingis used (best practice in Ruby) - Rename single-letter parameters to descriptive names in
Color.from_hsl - Remove duplicate test in
driver_spec.rb - Move
Style/MixinUsageexclusion to.rubocop.yml
๐ง Implementation Notes
The goal is to reduce the number of inline rubocop disable comments by either:
- Fixing the underlying code to comply with the rule
- Moving necessary exclusions to
.rubocop.ymlwhere they're more visible
๐ก Additional Considerations
None - all changes verified by pre-push hook running rubocop and steep.
๐ Types of changes
- Cleanup (formatting, renaming)
User description
๐ฅ What does this PR do?
Updates Ruby lint configuration and fixes rubocop offenses to reduce inline disable comments:
- Remove unnecessary exclusions from
.rubocop.ymlfor files that now pass lint checks - Add
SteepfiletoBlockLengthexclusion instead of inline disable comment - Add proper
respond_to_missing?methods wheremethod_missingis used (best practice in Ruby) - Rename single-letter parameters to descriptive names in
Color.from_hsl - Remove duplicate test in
driver_spec.rb - Move
Style/MixinUsageexclusion to.rubocop.yml
๐ง Implementation Notes
The goal is to reduce the number of inline rubocop disable comments by either:
- Fixing the underlying code to comply with the rule
- Moving necessary exclusions to
.rubocop.ymlwhere they're more visible
๐ก Additional Considerations
None - all changes verified by pre-push hook running rubocop and steep.
๐ Types of changes
- Cleanup (formatting, renaming)
PR Type
Enhancement
Description
-
Add
respond_to_missing?methods to comply with Ruby best practices -
Rename single-letter parameters to descriptive names in
Color.from_hsl -
Remove duplicate test case in
driver_spec.rb -
Clean up rubocop configuration by removing unnecessary exclusions
-
Move
Style/MixinUsageexclusion to.rubocop.ymlconfiguration
Diagram Walkthrough
flowchart LR
A["Rubocop Offenses"] --> B["Add respond_to_missing?"]
A --> C["Rename Parameters"]
A --> D["Remove Duplicates"]
B --> E["Cleaner Code"]
C --> E
D --> E
F[".rubocop.yml"] --> G["Remove Exclusions"]
F --> H["Add Steepfile"]
F --> I["Add MixinUsage"]
G --> J["Reduced Config"]
H --> J
I --> J
File Walkthrough
| Relevant files | |||||||
|---|---|---|---|---|---|---|---|
| Enhancement |
| ||||||
| Cleanup |
| ||||||
| Configuration changes |
|
Thank you, @titusfortner for this code suggestion.
The support packages contain example code that many users find helpful, but they do not necessarily represent
the best practices for using Selenium, and the Selenium team is not currently merging changes to them.
After reviewing the change, unless it is a critical fix or a feature that is needed for Selenium
to work, we will likely close the PR.
We actively encourage people to add the wrapper and helper code that makes sense for them to their own frameworks.
If you have any questions, please contact us
PR Compliance Guide ๐
Below is a summary of compliance checks for this PR:
| Security Compliance | |
| ๐ข | No security concerns identifiedNo security vulnerabilities detected by AI analysis. Human verification advised for critical code. |
| Ticket Compliance | |
| โช | ๐ซ No ticket provided
|
| Codebase Duplication Compliance | |
| โช | Codebase context is not definedFollow the guide to enable codebase context checks. |
| Custom Compliance | |
| ๐ข |
Generic: Comprehensive Audit TrailsObjective: To create a detailed and reliable record of critical system actions for security analysis Status: Passed
|
Generic: Meaningful Naming and Self-Documenting CodeObjective: Ensure all identifiers clearly express their purpose and intent, making code Status: Passed
| |
Generic: Robust Error Handling and Edge Case ManagementObjective: Ensure comprehensive error handling that provides meaningful context and graceful Status: Passed
| |
Generic: Secure Error HandlingObjective: To prevent the leakage of sensitive system information through error messages while Status: Passed
| |
Generic: Secure Logging PracticesObjective: To ensure logs are useful for debugging and auditing without exposing sensitive Status: Passed
| |
Generic: Security-First Input Validation and Data HandlingObjective: Ensure all data inputs are validated, sanitized, and handled securely to prevent Status: Passed
| |
| |
Compliance status legend
๐ข - Fully Compliant๐ก - Partial Compliant
๐ด - Not Compliant
โช - Requires Further Human Verification
๐ท๏ธ - Compliance label
PR Code Suggestions โจ
Explore these optional code suggestions:
| Category | Suggestion | Impact |
| Possible issue |
Fix splat forwarding in method_missing*Fix a syntax error in rb/lib/selenium/webdriver/support/block_event_listener.rb [28-29] -def method_missing(meth, *) - @callback.call(meth, *) +def method_missing(meth, *args) + @callback.call(meth, *args)
Suggestion importance[1-10]: 10__ Why: The suggestion correctly identifies a syntax error in the PR where an anonymous splat | High |
| ||
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Updates Ruby lint configuration and fixes RuboCop offenses with the goal of removing inline disable comments and aligning code with Ruby best practices around method_missing.
Changes:
- Moves/adjusts RuboCop exclusions in
rb/.rubocop.yml(includingSteepfileandStyle/MixinUsage) and removes now-unneeded inline disables. - Adds
respond_to_missing?implementations alongsidemethod_missingusage. - Cleans up specs by removing a duplicated example and parameter renames for readability.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| rb/spec/integration/selenium/webdriver/spec_helper.rb | Removes inline Style/MixinUsage disable and relies on config exclusion. |
| rb/spec/integration/selenium/webdriver/driver_spec.rb | Removes duplicated RSpec example and associated inline disable. |
| rb/lib/selenium/webdriver/support/event_firing_bridge.rb | Adds respond_to_missing? for method_missing delegation. |
| rb/lib/selenium/webdriver/support/color.rb | Renames from_hsl parameters to descriptive names. |
| rb/lib/selenium/webdriver/support/block_event_listener.rb | Adds respond_to_missing? for method_missing-based callback forwarding. |
| rb/Steepfile | Removes inline Metrics/BlockLength disable (moved to RuboCop config). |
| rb/.rubocop.yml | Updates metrics exclusions and adds Style/MixinUsage exclusion for the spec helper. |
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