🐛 Validate field default ordering in oneline config#63
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #63 +/- ##
==========================================
- Coverage 89.87% 89.80% -0.07%
==========================================
Files 29 29
Lines 2548 2560 +12
Branches 297 300 +3
==========================================
+ Hits 2290 2299 +9
- Misses 163 165 +2
- Partials 95 96 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
patdhlk
approved these changes
Apr 12, 2026
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.
Problem
The oneline parser maps comma-separated values to
needs_fieldsstrictly by position (index). When a field without a default is defined after a field with a default, it becomes unreachable if the user omits the optional fields — exactly like Python'sSyntaxError: parameter without a default follows parameter with a default.Example invalid configuration:
With this config,
@need MY_ID, My TitlemapsMy Titletoimplements(index 1) instead oftitle(index 3), andtitleis silently skipped.Solution
Add
check_fields_default_order()validation toOneLineCommentStylethat rejects configurations where a field without a default follows a field with a default. This is checked alongside existing schema, required-field, and uniqueness validations incheck_fields_configuration().Changes
config.py: Newcheck_fields_default_order()method, integrated intocheck_fields_configuration()test_analyse_config.py: Negative test case exercising the validation