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

VariableHasSpace Rule matches {{- var }} #499

Closed
netzvieh opened this issue Mar 26, 2019 · 2 comments
Closed

VariableHasSpace Rule matches {{- var }} #499

netzvieh opened this issue Mar 26, 2019 · 2 comments

Comments

@netzvieh
Copy link
Contributor

Issue Type

  • Bug report

Ansible and Ansible Lint details

ansible --version
ansible 2.7.9
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/sebastian/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/sebastian/.venvs/a2.7/lib/python3.6/site-packages/ansible
  executable location = /home/sebastian/.venvs/a2.7/bin/ansible
  python version = 3.6.5 (default, Mar 31 2018, 19:45:04) [GCC]

ansible-lint --version
ansible-lint 4.1.0
  • ansible installation method: pip
  • ansible-lint installation method: pip

Desired Behaviour

ansible-lint should allow for Jinja whitespace control, e.g. {{- and -}}.

The reason for using yaml multiline string here is, that I need to build a string without newlines from multiple variables with defaults from other variables which leads to the line being longer than 160 chars.

Actual Behaviour (Bug report only)

---
- hosts: localhost
  vars:
    fooo: asadsafdsafdsafdsafadsfdsa
    bar: 15.6
    baz: x86_64

  tasks:
    - debug:
        msg: |
          {{ fooo }}/
          {{- bar }}/
          {{- baz }}
ansible-lint /tmp/abc.yml
[206] Variables should have spaces before and after: {{ var_name }}
/tmp/abc.yml:12
          {{- bar }}/

[206] Variables should have spaces before and after: {{ var_name }}
/tmp/abc.yml:13
          {{- baz }}
@ssbarnea
Copy link
Member

ssbarnea commented Apr 2, 2019

I confirm that I enounter this bug in an alternative way: {{ var_name -}} as dash suffix is also part of the jinja2 specification and AFAIK there is no workaround.

@awcrosby
Copy link
Contributor

awcrosby commented Apr 3, 2019

Closed by #500

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

3 participants