diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:56 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:56 +0000 |
commit | d964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2 (patch) | |
tree | 794bc3738a00b5e599f06d1f2f6d79048d87ff8e /examples/playbooks/vars/jinja-spacing.yml | |
parent | Initial commit. (diff) | |
download | ansible-lint-d964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2.tar.xz ansible-lint-d964cec5e6aa807b75c7a4e7cdc5f11e54b2eda2.zip |
Adding upstream version 6.13.1.upstream/6.13.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'examples/playbooks/vars/jinja-spacing.yml')
-rw-r--r-- | examples/playbooks/vars/jinja-spacing.yml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/playbooks/vars/jinja-spacing.yml b/examples/playbooks/vars/jinja-spacing.yml new file mode 100644 index 0000000..419c7bc --- /dev/null +++ b/examples/playbooks/vars/jinja-spacing.yml @@ -0,0 +1,41 @@ +--- +# Should raise jinja[spacing] at line [14, 15, 16, 17, 18, 19, 22, 32, 38], at following variables. +# ".bad_var_1", ".bad_var_2", ".bad_var_3", ".invalid_multiline_nested_json", ".invalid_nested_json" +good_var_1: "{{ good_format }}" +good_var_2: "Value: {{ good_format }}" +good_var_3: "{{ good_format | filter }}" +good_var_4: "Value: {{ good_format | filter }}" +jinja_escape_1: "{{ '{{' }}" +jinja_escape_2: docker info --format '{{ '{{' }}json .Swarm.LocalNodeState{{ '}}' }}' | tr -d '"' +jinja_whitespace_control: | + {{ good_format }}/ + {{- good_format }} + {{- good_format -}} +bad_var_1: "{{bad_format}}" # <-- 1 +bad_var_2: "Value: {{ bad_format}}" # <-- 2 +bad_var_3: "{{bad_format }}" # <-- 3 +bad_var_4: "{{ bad_format|filter }}" # <-- 4 +bad_var_5: "Value: {{ bad_format |filter }}" # <-- 5 +bad_var_6: "{{ bad_format| filter }}" # <-- 6 +# spell-checker: disable-next-line +non_jinja_var: "data = ${lookup{$local_part}lsearch{/etc/aliases}}" # noqa: jinja[spacing] +json_inside_jinja: "{{ {'test': {'subtest': variable}} }}" +multiline_vars: # Assert that no false positive on multiline exists + cases: + case1: >- + http://example.com/{{ + case1 }} + case2: >- + http://example.com/{{ + case2 }} +valid_nested_json: "{{ {'dummy_2': {'nested_dummy_1': 'value_1', 'nested_dummy_2': value_2}} | combine(dummy_1) }}" +invalid_nested_json: "{{ {'dummy_2': {'nested_dummy_1': 'value_1', 'nested_dummy_2': value_2}} | combine(dummy_1)}}" # <-- 7 + +valid_multiline_nested_json: >- + {{ {'dummy_2': {'nested_dummy_1': value_1, + 'nested_dummy_2': value_2}} | + combine(dummy_1) }} +invalid_multiline_nested_json: >- # ignored multiline expression, for now + {{ {'dummy_2': {'nested_dummy_1': value_1, + 'nested_dummy_2': value_2}} | + combine(dummy_1)}} |