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

Fix playbook/rulebook detection #3005

Merged
merged 1 commit into from Feb 10, 2023
Merged

Fix playbook/rulebook detection #3005

merged 1 commit into from Feb 10, 2023

Conversation

apatard
Copy link
Contributor

@apatard apatard commented Feb 9, 2023

Don't try detecting the file type unless file already loaded in Lintable._data, otherwise the line numbers for inline rule skipping will be set to the line where's it's used since self.kind is 'yaml'. After _guess_kind() call, the kind will be set to playbook and the error line will be the one of the task, which is possibly different that the one with the 'noqa:' comment.

Fixes: #2977
Signed-off-by: Arnaud Patard apatard@hupstream.com

Don't try detecting the file type unless file already loaded
in Lintable._data, otherwise the line numbers for inline
rule skipping will be set to the line where's it's used since
self.kind is 'yaml'. After _guess_kind() call, the kind will
be set to playbook and the error line will be the one of the
task, which is possibly different that the one with the 'noqa:'
comment.

Fixes: ansible#2977
Signed-off-by: Arnaud Patard <apatard@hupstream.com>
@ssbarnea ssbarnea changed the title src/ansiblelint/file_utils.py: Fix playbook/rulebook detection Fix playbook/rulebook detection Feb 10, 2023
@ssbarnea ssbarnea added the bug label Feb 10, 2023
@ssbarnea ssbarnea merged commit 2eb37cf into ansible:main Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

version 6.12.0 ignores noqa in playbook?
2 participants