Skip to content

Commit

Permalink
Added test coverage for loop-var-prefix rule (#3092)
Browse files Browse the repository at this point in the history
Co-authored-by: James Cooke <jamescooke@users.noreply.github.com>
  • Loading branch information
audgirka and jamescooke authored Feb 28, 2023
1 parent 97e6aa4 commit 5c75f7c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions examples/roles/loop_var_prefix/tasks/fail.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
- bar
loop_control:
loop_var: zz_item
- name: fail | That should fail due to wrong prefix
ansible.builtin.debug:
var: zz_item
with_items:
- foo
- bar
loop_control:
loop_var: zz_item
- name: fail | Using a block
block:
- name: fail | That should also not pass
Expand Down
2 changes: 1 addition & 1 deletion src/ansiblelint/rules/loop_var_prefix.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def matchtask(
"examples/playbooks/roles/loop_var_prefix/tasks/pass.yml", 0, id="pass"
),
pytest.param(
"examples/playbooks/roles/loop_var_prefix/tasks/fail.yml", 5, id="fail"
"examples/playbooks/roles/loop_var_prefix/tasks/fail.yml", 6, id="fail"
),
),
)
Expand Down

0 comments on commit 5c75f7c

Please sign in to comment.