Merged
Conversation
…cessarily noisy warnings on Ruby 3.4.8.
There was a problem hiding this comment.
Pull request overview
This pull request addresses noisy warnings that appear on Ruby 3.4.8 when the gem is loaded, even when parser/rubocop functionality is not used. The warnings occur because parser/current loads parser/ruby34 which recognizes 3.4.0-dev-compliant syntax but the actual Ruby version is 3.4.8. The solution is to lazy-load the rubocop and parser dependencies only when the code actually needs to use them.
Changes:
- Moved
require 'rubocop'andrequire 'parser/current'from module-level to method-level lazy loading - Added explicit
parserdependency to gemspec (previously only transitive through rubocop) - Removed unnecessary
require 'parser/current'from LinesOfCodeCalculator (not actually used)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/feature_map/private/lines_of_code_calculator.rb | Removed unused require 'parser/current' statement |
| lib/feature_map/private/feature_metrics_calculator.rb | Moved require 'rubocop' to lazy load inside calculate_for_file method |
| lib/feature_map/private/cyclomatic_complexity_calculator.rb | Moved require 'parser/current' to lazy load inside process method |
| lib/feature_map.rb | Removed blank line between require statements |
| feature_map.gemspec | Added explicit parser dependency (~> 3.3) to ensure version compatibility |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aahmad
approved these changes
Feb 23, 2026
spacechurro
approved these changes
Feb 25, 2026
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.
When including this gem in codebases running Ruby 3.4.8, we're seeing warnings like the following pop up anytime the gem is loaded (e.g. running a console, running tests, etc) even when no FeatureMap related functionality, and particularly not the functionality requiring these gems, is exercised:
This set of changes moves
rubocopandparserdependencies to be lazy loaded to avoid unnecessarily noisy warnings on Ruby 3.4.8.Local Validation - 3.4 Ruby on Main Branch
Local Validation - Pre 3.4 Ruby
Local Validation - 3.4 Ruby