fix(config): fix contains_commitizen_section failing for completely e…#1874
Merged
woile merged 1 commit intocommitizen-tools:masterfrom Feb 18, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1874 +/- ##
=======================================
Coverage 97.98% 97.99%
=======================================
Files 60 60
Lines 2686 2689 +3
=======================================
+ Hits 2632 2635 +3
Misses 54 54 ☔ View full report in Codecov by Sentry. |
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
The new contains_commitizen_section broke JSON and YAML configs that are completely empty files.
For TOML configs, the check was working as expected and not failing for empty files.
This PR just adds some basic error handling for empty files.
Checklist
Was generative AI tooling used to co-author this PR?
Code Changes
uv run poe alllocally to ensure this change passes linter check and testsDocumentation Changes
No doc changes
Expected Behavior
Commitizen no longer fails on empty JSON/YAML config files.
Steps to Test This Pull Request
touch .cz.yamlcz --config .cz.yaml check COMMIT..COMMIT.cz.jsonAdditional Context
Updated commitizen and CI jobs in exisiting repositories started failing. Short investigation revealed new empty config file check did not account for completely empty files.