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: false-positive in regexp #2285

Closed
skwde opened this issue Aug 12, 2022 · 0 comments · Fixed by #2306
Closed

var-spacing: false-positive in regexp #2285

skwde opened this issue Aug 12, 2022 · 0 comments · Fixed by #2306
Assignees
Labels

Comments

@skwde
Copy link

skwde commented Aug 12, 2022

Summary

Rather similar to #2208 but with variables.

The pipe in the regexp: '({{ var1 }}|{{ var2 }})' triggers a false-positive.

Also related

Issue Type
  • Bug Report
Ansible and Ansible Lint details
# ansible --version
ansible [core 2.13.2]
  config file = $HOME/ansible-test/ansible.cfg
  configured module search path = ['$HOME/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/miniconda3/envs/ansible/lib/python3.10/site-packages/ansible
  ansible collection location = $HOME/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/miniconda3/envs/ansible/bin/ansible
  python version = 3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:04:59) [GCC 10.3.0]
  jinja version = 3.1.2
  libyaml = True

# ansible-lint --version
ansible-lint 6.4.0 using ansible 2.13.2
  • ansible installation method: conda
  • ansible-lint installation method: conda
OS / ENVIRONMENT
STEPS TO REPRODUCE
Desired Behavior

The regexp should not trigger a var-spacing warning

Actual Behavior

A minimal playbook might look like

---
- name: test
  hosts: localhost
  gather_facts: false
  tasks:
    - name: test
      ansible.builtin.lineinfile:
        path: /some/file.txt
        regexp: '({{ var1 }}|{{ var2 }})'
        line: 'abc'

The pipe triggers a var-spacing warning.

@skwde skwde added bug new Triage required labels Aug 12, 2022
@ssbarnea ssbarnea self-assigned this Aug 17, 2022
@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