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

Enable ansible-lint to auto-detect roles/playbooks #615

Merged
merged 1 commit into from Nov 4, 2019
Merged

Enable ansible-lint to auto-detect roles/playbooks #615

merged 1 commit into from Nov 4, 2019

Conversation

ssbarnea
Copy link
Member

@ssbarnea ssbarnea commented Nov 1, 2019

When called without any arguments, ansible-lint will now try to look
for all playbooks and roles inside current git repository.

Unrecognized YAML files will be displayed in verbose mode but will not
be considered errors. This will allow users to enable ansible-lint
on any repository without being forced to alter the way is called or
its configuration each time a new playbooks/role is added.

Fixes: #613
Fixes: #564

@ssbarnea ssbarnea marked this pull request as ready for review November 1, 2019 17:39
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
tox.ini Outdated Show resolved Hide resolved
@ssbarnea
Copy link
Member Author

ssbarnea commented Nov 2, 2019

@webknjaz Please have another look on it, I hope I addressed all concerns.

If you want to see the output of calling it on multiple repositories, look at https://sbarnea.com/tmp/result.html -- i kinda scripted its execution in order to get an idea about what to expect in real-life once the code goes in.

lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link

lgtm-com bot commented Nov 3, 2019

This pull request introduces 1 alert when merging 212a85e into 5453d07 - view on LGTM.com

new alerts:

  • 1 for Syntax error

@lgtm-com
Copy link

lgtm-com bot commented Nov 3, 2019

This pull request introduces 1 alert when merging ace361e into cad1804 - view on LGTM.com

new alerts:

  • 1 for Syntax error

lib/ansiblelint/utils.py Outdated Show resolved Hide resolved
When called without any arguments, ansible-lint will now try to look
for all playbooks and roles inside current git repository.

Unrecognized YAML files will be displayed in verbose mode but will not
be considered errors. This will allow users to enable ansible-lint
on any repository without being forced to alter the way is called or
its configuration each time a new playbooks/role is added.

Fixes: #613
Fixes: #564
Signed-off-by: Sorin Sbarnea <ssbarnea@redhat.com>
@ssbarnea
Copy link
Member Author

ssbarnea commented Nov 4, 2019

Anything else preventing this to be merged?

@webknjaz webknjaz merged commit ad721b6 into ansible:master Nov 4, 2019
@ssbarnea ssbarnea deleted the fix/recursive branch November 5, 2019 11:25
options = {}

# git is preferred as it also considers .gitignore
files = OrderedDict.fromkeys(sorted(subprocess.check_output(
Copy link
Member

Choose a reason for hiding this comment

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

@ssbarnea why did you use OrderedDict and not a list here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants