Repository navigation
Conversation
JsonConfig, TomlConfig and YAMLConfig repeated the same parse steps. BaseConfig now runs these steps. Each subclass gives only its parser, its parse errors and the path to its commitizen section.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2131 +/- ##
=======================================
Coverage 98.29% 98.29%
=======================================
Files 61 61
Lines 2874 2875 +1
=======================================
+ Hits 2825 2826 +1
Misses 49 49 ☔ View full report in Codecov by Harness. |
Member
|
Hi thanks for this but it doesn't add any value |
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.
Description
Part of #2129.
JsonConfig,TomlConfigandYAMLConfigeach had the same_parse_settingsteps: parse the file, change a parse error intoInvalidConfigurationError, then apply the commitizen section if it exists.BaseConfig._parse_settingnow runs these steps. Each subclass gives only:_parse_errors: the parser errors for a malformed file_missing_section_errors: the errors for a missing commitizen section_load_document()and_get_commitizen_section()The error types are the same as before, so behavior does not change.
Checklist
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code following the guidelines. AI suggested the changes; I wrote and reviewed the code by hand.
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsExpected Behavior
No change. Valid, malformed and section-less config files behave as before.
Steps to Test This Pull Request
uv run poe alluv run pytest tests/test_conf.pycovers malformed files and missing sections for all three formats.Additional Context
No new tests: the existing tests in
tests/test_conf.pycover all paths. Pure refactor, so no docs change.