mschuchard / linter-ansible-syntax

ansible syntax check linter for pulsar
MIT License
5 stars 3 forks source link

Limit linting to only files with a hosts attribute? #1

Closed xenithorb closed 8 years ago

xenithorb commented 8 years ago
  • The Ansible syntax check does not understand how to parse task lists that are included as part of a playbook (including roles) and will display 'attribute' is not a valid attribute for a Play in those instances.

Is there any way to make this more robust? If not then this generally doesn't seem very useful for role-building.

What I'm thinking is, could you only run this may if there's a - hosts: in the file?

mschuchard commented 8 years ago

This has been on my TODO for a long time now. Additionally, Ansible has just recently started doing syntax checks on includes so now I need to handle that too.

Ideally, Ansible would be able to syntax check more than just the site.yml, but they haven't really cared a lot about the syntax checker.

I have a similar TODO for the ansible-lint package. I don't see myself taking a stab at this in the next few days, but I very likely will in the next month.

mschuchard commented 8 years ago

Resolved in 7f2832c49695d9686774a8cf8a574c1236c7b774.

I had work and technical headaches the last few days, but just got a chance to look at this again. I still have the dream to trick ansible into syntax checking all files, but your suggestion is a good intermediary step. Also, the quick code search on github to figure out the API call to do this has given me an idea for that trick.

Note I am also about to go do this for the ansible-lint linter too. Will claims ansible-lint works fine on roles (not includes) as of a certain version, but I have been unable to figure that out. Going to go ping him on that now.