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

Introduce Ansible lint #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

szepeviktor
Copy link
Contributor

@szepeviktor szepeviktor commented Jun 20, 2023

@s4ke I hope you will benefit from having Ansible Lint 🚀

                          Rule Violation Summary                           
 count tag                           profile    rule associated tags       
     8 command-instead-of-shell      basic      command-shell, idiom       
     2 deprecated-local-action       basic      deprecations               
     2 literal-compare               basic      idiom                      
     6 jinja[spacing]                basic      formatting (warning)       
     2 no-free-form                  basic      syntax, risk               
    21 role-name                     basic      deprecations, metadata     
    14 name[missing]                 basic      idiom                      
    16 name[play]                    basic      idiom                      
    54 var-naming[no-role-prefix]    basic      idiom                      
     2 var-naming[pattern]           basic      idiom                      
     1 yaml[comments]                basic      formatting, yaml           
     4 yaml[empty-lines]             basic      formatting, yaml           
     7 yaml[indentation]             basic      formatting, yaml           
     4 yaml[line-length]             basic      formatting, yaml           
    35 yaml[new-line-at-end-of-file] basic      formatting, yaml           
    11 yaml[octal-values]            basic      formatting, yaml           
    26 yaml[trailing-spaces]         basic      formatting, yaml           
    48 yaml[truthy]                  basic      formatting, yaml           
    14 name[template]                moderate   idiom                      
    95 name[casing]                  moderate   idiom                      
    12 risky-file-permissions        safety     unpredictability           
     2 risky-shell-pipe              safety     command-shell              
     1 ignore-errors                 shared     unpredictability           
    31 no-changed-when               shared     command-shell, idempotency 
     1 no-handler                    shared     idiom                      
   142 fqcn[action-core]             production formatting                 
     5 fqcn[action]                  production formatting                 

@jaydrogers After seeing your star ⭐

@szepeviktor szepeviktor changed the title Ansible lint Introduce Ansible lint Jun 20, 2023
@szepeviktor
Copy link
Contributor Author

After Ansible Lint gives you a ✔️ we could introduce yamllint too.

@s4ke
Copy link
Member

s4ke commented Jun 21, 2023

Thanks @szepeviktor . I will have to check out what this would entail in terms of required changes to get the linter happy first, though. A lot of the roles in this repo have been with us for quite a while and are "just" part of this repository because we know they worked.

Can you give me some examples for these two?

54 var-naming[no-role-prefix]    basic      idiom                      
     2 var-naming[pattern]           basic      idiom      

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Jun 21, 2023

I've never used ansible/ansible lint.
If you install it locally pip3 install ansible-lint or enable GitHub Actions it will give you file names and line numbers.

Docs say

Variables names from within roles should use role_name_ as a prefix.

Variables names should match ... regex.

https://ansible.readthedocs.io/projects/lint/rules/var-naming/

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Jun 21, 2023

because we know they worked.

You are writing about very interesting things!

I use the iceberg metaphor. The submerged part is viktor-territory, the top part is the they worked (human experience) part.
The difference is: with the top part only you'll be reactive, with the whole iceberg you can be proactive!

image

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

Successfully merging this pull request may close these issues.

2 participants