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

Provide a semantics-only configuration #219

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dhutty
Copy link
Contributor

@dhutty dhutty commented Dec 31, 2019

* configure style rules as warnings
* configure rules that can introduce semantic errors as errors

See #72

@coveralls
Copy link

coveralls commented Dec 31, 2019

Coverage Status

Coverage increased (+0.2%) to 97.832% when pulling 75ca77a on dhutty:syntax-only into 734d5d5 on adrienverge:master.

    * configure style rules as warnings
    * configure rules that can introduce semantic errors as errors
Copy link
Owner

@adrienverge adrienverge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dhutty, thanks for your contribution.

  • The rest of yamllint uses the term "syntax", which is also common in other tools. When a syntax problem occurs, it is reported as syntax (rule name). What about syntax-only instead of semantics-only?

  • The rule name says "semantics only" or "syntax only", but actually enables most rules (as warnings) and even enables truthy and key-duplicates as errors. Not very understandable for users.

    Instead, what about a syntax-only conf that disables all rules but syntax rule?

    The config file would be simple:

    ---
    
    rules: []


.. code:: bash

yamllint -d semantics-only file.yml
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to simplify all this to something like:

If you want yamllint to only report syntax errors, use the pre-defined
configuration named ``syntax-only``:


.. code:: bash

 yamllint -d syntax-only file.yaml

@dhutty
Copy link
Contributor Author

dhutty commented Jan 3, 2020

The reason I chose the word 'semantics' was to emphasize that if yamllint exited with an error, it means that the YAML being tested might be semantically different from what the user intended as opposed merely being stylistically/conventionally problematic.

In order words, my proposed yamllint -d semantics-only foo.yaml is a very weak/permissive configuration, which makes most of the common rules about the YAML itself get flagged only as warnings, but anything that could result in broken configuration should cause a failure (i.e. error exit).

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.

3 participants