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

var-spacing rule triggers even if in warn_list #2301

Closed
konstruktoid opened this issue Aug 16, 2022 · 3 comments · Fixed by #2306
Closed

var-spacing rule triggers even if in warn_list #2301

konstruktoid opened this issue Aug 16, 2022 · 3 comments · Fixed by #2306
Assignees
Labels

Comments

@konstruktoid
Copy link
Contributor

Summary

var-spacing rule triggers even if in warn_list, jinja[spacing] does not.

Issue Type
  • Bug Report
Ansible and Ansible Lint details
ansible-lint 6.4.1.dev27 using ansible 2.12.7
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

macOS
Python 3.9.13

STEPS TO REPRODUCE
$ ansible-lint --version
WARNING: PATH altered to include /usr/local/opt/python@3.9/bin
ansible-lint 6.4.1.dev27 using ansible 2.12.7
$ ansible-lint
[...]
# .config/ansible-lint.yml
warn_list:  # or 'skip_list' to silence them completely
  - jinja[spacing]  # Rule that looks inside jinja2 templates.
  - var-spacing  # Jinja2 variables and filters should have spaces before and after.

Finished with 26 failure(s), 332 warning(s) on 124 files.
$ cat .ansible-lint
---
exclude_paths:
  - .git/
  - .github/
  - tests/
enable_list:
  - fqcn-builtins
warn_list:
  - jinja[spacing]  # Rule that looks inside jinja2 templates.
  - line-length  # Violations reported by yamllint
  - name[casing]  # Rule for checking task names and their content.
  - var-spacing  # Jinja2 variables and filters should have spaces before and after.
  - yaml[line-length]  # Violations reported by yamllint
$ ansible-lint
[...]
You can skip specific rules or tags by adding them to your configuration file:
# .config/ansible-lint.yml
warn_list:  # or 'skip_list' to silence them completely
  - var-spacing  # Jinja2 variables and filters should have spaces before and after.

Finished with 13 failure(s), 345 warning(s) on 124 files.
Desired Behavior

var-spacing should behave as the jinja[spacing] rule

@konstruktoid konstruktoid added bug new Triage required labels Aug 16, 2022
@konstruktoid
Copy link
Contributor Author

konstruktoid commented Aug 16, 2022

var-spacing added to skip_list:

---
exclude_paths:
  - .git/
  - .github/
  - tests/
enable_list:
  - fqcn-builtins
warn_list:
  - jinja[spacing]  # Rule that looks inside jinja2 templates.
  - line-length  # Violations reported by yamllint
  - name[casing]  # Rule for checking task names and their content.
  - yaml[line-length]  # Violations reported by yamllint
skip_list:
  - var-spacing  # Jinja2 variables and filters should have spaces before and after.
$ ansible-lint | grep var-spacing
WARNING: PATH altered to include /usr/local/opt/python@3.9/bin
WARNING  Listing 345 violation(s) that are fatal
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
var-spacing: Jinja2 variables and filters should have spaces before and after.
You can skip specific rules or tags by adding them to your configuration file:
# .config/ansible-lint.yml
warn_list:  # or 'skip_list' to silence them completely
- var-spacing  # Jinja2 variables and filters should have spaces before and after.

Finished with 13 failure(s), 332 warning(s) on 124 files.

@konstruktoid
Copy link
Contributor Author

All skip_list:

$ cat .ansible-lint 
---
exclude_paths:
  - .git/
  - .github/
  - tests/
enable_list:
  - fqcn-builtins
skip_list:
  - jinja[spacing]  # Rule that looks inside jinja2 templates.
  - line-length  # Violations reported by yamllint
  - name[casing]  # Rule for checking task names and their content.
  - yaml[line-length]  # Violations reported by yamllint
  - var-spacing  # Jinja2 variables and filters should have spaces before and after.
$ ansible-lint
WARNING: PATH altered to include /usr/local/opt/python@3.9/bin
WARNING  Listing 13 violation(s) that are fatal
var-spacing: Jinja2 variables and filters should have spaces before and after.
molecule/default/verify.yml:11 Task/Handler: wait for the host and reconnect

var-spacing: Jinja2 variables and filters should have spaces before and after.
molecule/default/verify.yml:152 Task/Handler: verify sshd_config configuration

var-spacing: Jinja2 variables and filters should have spaces before and after.
molecule/default/verify.yml:199 Task/Handler: verify sshd_config.d configuration

var-spacing: Jinja2 variables and filters should have spaces before and after.
molecule/default/verify.yml:247 Task/Handler: verify sshd runtime configuration

var-spacing: Jinja2 variables and filters should have spaces before and after.
molecule/default/verify.yml:575 Task/Handler: verify blocked blacklisted kernel modules

var-spacing: Jinja2 variables and filters should have spaces before and after.
tasks/ipv6.yml:29 Task/Handler: configure IPv6 sysctl settings

var-spacing: Jinja2 variables and filters should have spaces before and after.
tasks/mount.yml:2 Task/Handler: mount /proc

var-spacing: Jinja2 variables and filters should have spaces before and after.
tasks/password.yml:260 Task/Handler: add local information to password list

var-spacing: Jinja2 variables and filters should have spaces before and after.
tasks/sysctl.yml:2 Task/Handler: set sysctl dev.tty.ldisc_autoload

var-spacing: Jinja2 variables and filters should have spaces before and after.
tasks/sysctl.yml:13 Task/Handler: set sysctl net.ipv6.conf.accept_ra_rtr_pref

var-spacing: Jinja2 variables and filters should have spaces before and after.
tasks/sysctl.yml:34 Task/Handler: configure sysctl

var-spacing: Jinja2 variables and filters should have spaces before and after.
tasks/ufw.yml:120 Task/Handler: allow ssh ufw

var-spacing: Jinja2 variables and filters should have spaces before and after.
tasks/ufw.yml:135 Task/Handler: allow outgoing specified ufw ports

You can skip specific rules or tags by adding them to your configuration file:
# .config/ansible-lint.yml
warn_list:  # or 'skip_list' to silence them completely
  - var-spacing  # Jinja2 variables and filters should have spaces before and after.

Finished with 13 failure(s), 0 warning(s) on 124 files.

@ssbarnea ssbarnea self-assigned this Aug 16, 2022
@konstruktoid
Copy link
Contributor Author

Probably not var-spacing specific.
https://gist.github.com/konstruktoid/8f2d9eb4511c35afe0ff84d0b27b20fb

adding name[casing] to warn_string makes it go from 280 failure(s), 13 warning(s) to Finished with 13 failure(s), 280 warning(s).

@ssbarnea ssbarnea removed the new Triage required label Aug 17, 2022
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 18, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 18, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 18, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 20, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 20, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 20, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 20, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 20, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 20, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 20, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 21, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 21, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 21, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 21, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit to ssbarnea/ansible-lint that referenced this issue Aug 22, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: ansible#2301 ansible#2285 ansible#2241 ansible#2209 ansible#2208 ansible#2120
ssbarnea added a commit that referenced this issue Aug 22, 2022
This change rewrites jinja2 rule to make it use jinaja lex parser and
avoid use of regexes for parsing, as they cause too many false
positives.

Fixes: #2301 #2285 #2241 #2209 #2208 #2120
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 a pull request may close this issue.

2 participants