Giter Site home page Giter Site logo

Warnings vs Errors about ansible-review HOT 4 CLOSED

willthames avatar willthames commented on July 16, 2024
Warnings vs Errors

from ansible-review.

Comments (4)

willthames avatar willthames commented on July 16, 2024

Yes, that's a standard feature.

From the README.md (it could probably be clearer):

To add standards that are advisory, don't set the version. These will cause a message to be displayed but won't constitute a failure.

Hopefully that helps, let me know if you need any more info

from ansible-review.

ansiblejunky avatar ansiblejunky commented on July 16, 2024

Yes, I think it definitely needs to be made more clear on the docs. tbh, I am still not fully understanding. So there are 2 versions - the standards version and the version that is inside each rule defined in the standards file? if the standards version is greater than the rule version then it becomes a warning? Perhaps you can give some better example and explanation?

from ansible-review.

willthames avatar willthames commented on July 16, 2024

I talk a bit about versioned standards at https://willthames.github.io/2016/06/28/announcing-ansible-review.html

This means that you can update your standards without roles developed against earlier standards failing.

from ansible-review.

ansiblejunky avatar ansiblejunky commented on July 16, 2024

Thanks @willthames, I think I understand now. We generally don't set the Standards in our playbooks because we always want to apply the latest version of the lint rules. So in our standards.py we set the latest version to 1.0 here:

# Update this every time standards version increase
latest_version = Standard(dict(
    check=noop,
    name="No-op check to ensure latest standards version is set",
    version="1.0",
    types=[]
))

And then, the rules we want to FAIL in our standards.py we make sure they have version set as we do here:

tasks_are_named = Standard(dict(
    name="Tasks and handlers must be named",
    check=lintcheck('ANSIBLE0011'),
    version="0.0",
    types=["playbook", "task", "handler"],
))

Then when the playbook or task file breaks that rule, a FAIL will occur for that specific rule. If we want the rule to only be "suggestive" and warn developers, we remove the version from the above rule.

from ansible-review.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.