fix: read COMPLEXITY_THRESHOLD from config instead of hardcoded default#1293
Open
MorningStar0709 wants to merge 1 commit into
Open
fix: read COMPLEXITY_THRESHOLD from config instead of hardcoded default#1293MorningStar0709 wants to merge 1 commit into
MorningStar0709 wants to merge 1 commit into
Conversation
The `cgc analyze complexity --threshold` option had a hardcoded default of 10 that ignored the COMPLEXITY_THRESHOLD config value set via `cgc config set COMPLEXITY_THRESHOLD <value>`. Changed the default to None and added logic to read from config when not explicitly provided via CLI, falling back to 10 if the config value is missing or invalid.
|
@MorningStar0709 is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
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
The
cgc analyze complexitycommand's--thresholdoption ignored theCOMPLEXITY_THRESHOLDconfig value, always defaulting to hardcoded10.Root Cause
In
cli/main.pyline 2511, the threshold parameter was defined as:The function body never called
config_manager.get_config_value("COMPLEXITY_THRESHOLD")to override this default. So even if a user rancgc config set COMPLEXITY_THRESHOLD 15, the CLI would still use10.Fix
Changed the default to
None(making itOptional[int]) and added config-reading logic:In the function body, when
threshold is None:COMPLEXITY_THRESHOLDfrom configValueError/TypeErrorTesting
py_compilepassescgc analyze complexity --helpshows updated descriptioncgc config set COMPLEXITY_THRESHOLD 15now takes effectImpact
COMPLEXITY_THRESHOLDviacgc config setwill now see it applied--threshold NCLI flag still takes precedence (notNone)