Repository navigation
feat: point config errors to the line of the invalid entry - #37
Merged
Merged
Conversation
A half-deleted secret, e.g. a `- kind: env` line left without `name` and `path`, reported only `secret at profile 'p' index 3 missing 'name' field`: a 0-based index, no line, and only the first missing field. Config errors for profiles and secrets missing fields now give the line, the 1-based position or the name, the fields that are there, and every missing field: secret #4 in profile 'personal' (line 17, kind: env) is missing 'name' and 'path' serde_yaml_ng keeps no positions, so on such an error the YAML is read again up to the entry, and an error raised there on purpose carries its line. Closes #35
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.
A half-deleted secret, e.g. a
- kind: envline left withoutnameandpath, reported onlysecret at profile 'p' index 3 missing 'name' field: a 0-based index, no line number, and only the first missing field.Config errors for profiles and secrets with missing fields now report the line, the secret's name (or its 1-based position), the fields that are there, and every missing field:
line_ofreads the YAML again up to the entry and raises an error there on purpose to get its line. Valid configs are parsed once, as before, and no dependency is added.kindor variable name, so an entry with both problems reports the missing fields first.account:key now gets the missing name/provider message. Named profiles still get the hint to moveaccountinto the provider.Tested with unit tests for the messages, a half-deleted entry among valid ones, an empty entry, and
line_ofon block- and flow-style YAML (all 166 tests pass, clippy clean). Also tried the binary on a broken config.Closes #35