Repository navigation
Reduce the cognitive complexity of Parser::handleArguments() - #69
Merged
Merged
Conversation
Assisted-by: Claude Code
This comment has been minimized.
This comment has been minimized.
Code Metrics Report
Details | | master (4b6c04c) | T68-parser-complexity | +/- |
| | | (8fbe7d3) | |
|---------------------|------------------|--------------------------------|------|
| Coverage | 100.0% | 100.0% | 0.0% |
| Files | 1 | 1 | 0 |
| Lines | 71 | 75 | +4 |
+ | Covered | 71 | 75 | +4 |
+ | Test Execution Time | 1s | 0s | -1s |Code coverage of files in pull request scope (100.0% → 100.0%, patch 100.0%)
Reported by octocov |
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.
Hello!
In raising this pull request, I confirm the following:
Small description of change:
Stacked on #67. Merge #67 first.
Fixes SonarCloud
php:S3776(cognitive complexity 28, limit 15) inParser::handleArguments(). The behavior does not change.handleArguments()reads each argument and gets the next argument when it is a value (it exists and does not start with-). Amatchthen sends the argument to one handler.handleLongOption(),handleShortOptions()andhandlePositional()store the result. Each returns the number of arguments it used: 1, or 2 when it used the value. The loop moves by that number.$position,$argument,$next,$valueand$lettersreplace$i,$jand$chars.There are no new tests and no CHANGELOG line, because this is an internal change. The current suite and Infection protect the behavior.
Results in the PHP 8.3 container: 65 tests pass, line coverage 100% (75/75), Infection MSI 100% and covered MSI 100% (120 mutants, no escaped). PHPCS, PHPStan and PHP CS Fixer pass.
Thanks