Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed: Reworded syntax error messages to be clearer #838

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

aelsabbahy
Copy link
Member

Closes #800

Checklist
  • make test-all (UNIX) passes. CI will also test this
  • unit and/or integration tests are included (if applicable)
  • documentation is changed or added (if applicable)

Description of change

Added syntax checking for when multiple keys are provided. Improved syntax error messages in general.

Example of new errors:

$ cat goss.yaml 
matching:
  example:
   content: ['1.14.1']
   matches:
     and:
       - have-len: 1
         and:
           matches:
             - semver-constraint: '<1.14.0'
$ goss v
F

Failures/Skipped:

Matching: example: matches:
Error
    Syntax Error: Invalid matcher configuration. At a given nesting level, only one matcher is allowed. Found multiple matchers: ["have-len" "and"]

Total Duration: 0.000s
Count: 1, Failed: 1, Skipped: 0
$ cat goss.yaml 
matching:
  example:
   content: ['1.14.1']
   matches:
     and:
       - have-len: 1
       - and:
           matches:
             - semver-constraint: '<1.14.0'
$ goss v
F

Failures/Skipped:

Matching: example: matches:
Error
    Syntax Error: Invalid 'and' argument. Expected array value, but received: map["matches":[map["semver-constraint":"<1.14.0"]]]

Total Duration: 0.000s
Count: 1, Failed: 1, Skipped: 0

@aelsabbahy aelsabbahy merged commit b98798e into master Sep 14, 2023
1 check passed
@aelsabbahy aelsabbahy deleted the better_error_msgs branch September 14, 2023 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package Semver-Constraint Check - Printing warnings condition not met
1 participant