-
Notifications
You must be signed in to change notification settings - Fork 654
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
E106: Don't use relative paths for meta/main.yml #1044
E106: Don't use relative paths for meta/main.yml #1044
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK, roles can exist without tasks but they cannot exist without meta. Also, meta is always at predictable location, regardless how the tasks are organized.
If we are fixing an existing bug, we clearly need a test that prevents a future regression, a test that would reproduce the current bug.
It would even be better if you can add a test that reproduces the current bug and add it using @pytest.mark.xfail before making this fix.
I am saying this because I want to avoid future regressions, especially as this area was touched multiple times, and recently too.
9660e46
to
5d6970d
Compare
Adding a task in a subdirectory of an existing role (such as |
In that case maybe just add a comment on the empty task file explaining why the file is there, so we do not remove it by mistake? |
The present behavior of ansible-lint will raise E106 in this case, since it miscalculates the location of meta/main.yml from the task subdirectory.
This change calculates the role's root directory by finding the "tasks" directory first, rather than using the parent of the parent of the current file. The problem with using the parent/parent scheme is that roles which organize their tasks into subdirectories would cause ansible-lint to erroneously raise E106 for an invalid role name.
5d6970d
to
65d4ede
Compare
Great suggestion, done! Also, I removed the |
@ssbarnea Thanks for the quick review and merge! 👏 |
This change calculates the role's root directory by finding the
"tasks" directory first, rather than using the parent of the parent of
the current file. The problem with using the parent/parent scheme is
that roles which organize their tasks into subdirectories would cause
ansible-lint to erroneously raise E106 for an invalid role name.
Fixes #1001