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

Apply ansible-lint default rules #492

Open
rabin-io opened this issue May 13, 2024 · 3 comments
Open

Apply ansible-lint default rules #492

rabin-io opened this issue May 13, 2024 · 3 comments

Comments

@rabin-io
Copy link

Current state,

                        Rule Violation Summary                        
 count tag                      profile    rule associated tags       
    13 command-instead-of-shell basic      command-shell, idiom       
     2 key-order[task]          basic      formatting                 
     1 literal-compare          basic      idiom                      
    70 jinja[spacing]           basic      formatting (warning)       
     2 schema[playbook]         basic      core                       
     9 name[missing]            basic      idiom                      
     9 yaml[colons]             basic      formatting, yaml           
     1 yaml[commas]             basic      formatting, yaml           
     2 yaml[comments]           basic      formatting, yaml           
     2 yaml[empty-lines]        basic      formatting, yaml           
     2 yaml[hyphens]            basic      formatting, yaml           
   308 yaml[indentation]        basic      formatting, yaml           
    92 yaml[line-length]        basic      formatting, yaml           
     8 yaml[octal-values]       basic      formatting, yaml           
     4 yaml[trailing-spaces]    basic      formatting, yaml           
    31 yaml[truthy]             basic      formatting, yaml           
    12 name[template]           moderate   idiom                      
     3 name[casing]             moderate   idiom                      
    93 risky-file-permissions   safety     unpredictability           
    21 risky-shell-pipe         safety     command-shell              
    11 ignore-errors            shared     unpredictability           
   153 no-changed-when          shared     command-shell, idempotency 
     1 no-handler               shared     idiom                      
   589 fqcn[action-core]        production formatting                 
    20 fqcn[action]             production formatting                 
     2 run-once[task]                      idiom                      

Failed: 1391 failure(s), 70 warning(s) on 259 files. Last profile that met the validation criteria was 'min'.

A quick win/fix with ansible-lint --fix can reduce this to

$ ansible-lint --fix=fqcn ansible/*

Modified 104 files.
                       Rule Violation Summary                       
 count tag                      profile  rule associated tags       
    13 command-instead-of-shell basic    command-shell, idiom       
     2 key-order[task]          basic    formatting                 
     1 literal-compare          basic    idiom                      
    70 jinja[spacing]           basic    formatting (warning)       
     2 schema[playbook]         basic    core                       
     9 name[missing]            basic    idiom                      
     2 yaml[comments]           basic    formatting, yaml           
    18 yaml[line-length]        basic    formatting, yaml           
    12 name[template]           moderate idiom                      
     3 name[casing]             moderate idiom                      
    93 risky-file-permissions   safety   unpredictability           
    21 risky-shell-pipe         safety   command-shell              
    11 ignore-errors            shared   unpredictability           
   153 no-changed-when          shared   command-shell, idempotency 
     1 no-handler               shared   idiom                      
     2 run-once[task]                    idiom                      

Failed: 343 failure(s), 70 warning(s) on 259 files. Last profile that met the validation criteria was 'min'.
@rabin-io
Copy link
Author

What do you think @akrzos ?

@akrzos
Copy link
Member

akrzos commented May 28, 2024

I most likely do not agree with all of the defaults, for example I don't think we should waste time or space adding extra indents to an array that already indents naturally. There are likely some changes in there that break stuff, so without testing we can not just apply all of ansible lint suggestions.

@rabin-io
Copy link
Author

Yes, I understand your distaste for some of the rules, but most have been accepted by default. I actually think that adhering to a standard creates uniformity, and it actually helps in writing consistent code.

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

No branches or pull requests

2 participants