Skip to content

Cannot ignore rule jinja[spacing] #3935

@AdrienEti

Description

@AdrienEti
Summary

The Jinja white-space control generates an jinja [spacing] rule violation.
I'm trying to escape this rule for a variable definition, but it seems that the escape is ignored.
I've tried to place the # noqa: jinja[spacing] mutation in several places, but it is always ignored.

Issue Type
  • Bug Report
OS / ENVIRONMENT
$ ansible-lint --version
ansible-lint 6.22.1 using ansible-core:2.16.0 ansible-compat:4.1.10 ruamel-yaml:0.18.5 ruamel-yaml-clib:0.2.7
  • ansible installation method: pip
  • ansible-lint installation method: pip
STEPS TO REPRODUCE

Defined a variable as follow and try to ignore the jinja[spacing] rule:

foo_postgresql_grafana_password_encoded: >- # noqa: jinja[spacing]
  {% if '!' in foo_postgresql_grafana_password or '#' in foo_postgresql_grafana_password %}
  {{- ('\"\"\"' + foo_postgresql_grafana_password + '\"\"\"') | b64encode -}}
  {% else %}
  {{- foo_postgresql_grafana_password | b64encode -}}
  {% endif %}

or

# noqa: jinja[spacing]
foo_postgresql_grafana_password_encoded: >-
  {% if '!' in foo_postgresql_grafana_password or '#' in foo_postgresql_grafana_password %}
  {{- ('\"\"\"' + foo_postgresql_grafana_password + '\"\"\"') | b64encode -}}
  {% else %}
  {{- foo_postgresql_grafana_password | b64encode -}}
  {% endif %}
Desired Behavior

The jinja[spacing] rule is ignored

Actual Behavior

The jinja[spacing] rule is not ignored

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions