refactor: change parse_cli_args to use data-driven approach#358
Merged
shenxianpeng merged 2 commits intofeature/enhance-configrationfrom Feb 1, 2026
Merged
refactor: change parse_cli_args to use data-driven approach#358shenxianpeng merged 2 commits intofeature/enhance-configrationfrom
shenxianpeng merged 2 commits intofeature/enhance-configrationfrom
Conversation
…ation Co-authored-by: shenxianpeng <[email protected]>
|
Copilot
AI
changed the title
[WIP] Address feedback on configuration enhancements for CLI and TOML support
Refactor parse_cli_args to use data-driven approach
Feb 1, 2026
shenxianpeng
approved these changes
Feb 1, 2026
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feature/enhance-configration #358 +/- ##
================================================================
+ Coverage 93.12% 94.35% +1.22%
================================================================
Files 9 9
Lines 829 797 -32
================================================================
- Hits 772 752 -20
+ Misses 57 45 -12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
shenxianpeng
added a commit
that referenced
this pull request
Feb 1, 2026
* feat: Enhance configuration management with CLI, env vars, and TOML support - Introduced a new ConfigMerger class to handle merging configurations from multiple sources: command-line arguments, environment variables, TOML files, and defaults. - Added command-line options for various commit and branch configurations, including subject length, imperative mood, and allowed commit types. - Updated README and configuration documentation to reflect new configuration methods and examples. - Implemented comprehensive tests for CLI argument integration, environment variable handling, and configuration priority. - Ensured backward compatibility with existing configuration files while providing enhanced flexibility for users. * chore: Update docs/configuration.rst Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * chore: Update commit-check version to v2.3.0 in README * refactor: change parse_cli_args to use data-driven approach (#358) * Initial plan * refactor: Use data-driven approach in parse_cli_args to reduce duplication Co-authored-by: shenxianpeng <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: shenxianpeng <[email protected]> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Copilot <[email protected]> Co-authored-by: shenxianpeng <[email protected]>
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.



The
parse_cli_argsmethod contained ~75 lines of repetitive if statements checking individual CLI arguments, making it difficult to maintain and error-prone when adding new configuration options.Changes
CLI_ARG_MAPPINGdictionary - Maps CLI argument names to their (section, key) config pairs, following the same pattern asENV_VAR_MAPPINGparse_cli_argsto use iteration - Replaced individual if statements with a single loop over the mapping, reducing method from ~75 lines to ~14 linesBefore
After
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.