ansible-lint icon indicating copy to clipboard operation
ansible-lint copied to clipboard

ansible-lint[risky-shell-pipe] misinterprets pipe in comment when using Multiline Block Scalars

Open jedthe3rd opened this issue 1 year ago • 1 comments

Summary

The ansible-lint[risky-shell-pipe] rule misinterprets pipe in comment when using Multiline Block Scalars ( | or > )

Issue Type
  • Bug Report
OS / ENVIRONMENT
> ansible-lint --version
ansible-lint 24.7.0 using ansible-core:2.17.1 ansible-compat:24.7.0 ruamel-yaml:0.18.6 ruamel-yaml-clib:0.2.8
  • ansible installation method: ansible-dev-tools devcontainer - ghcr.io/ansible/community-ansible-dev-tools:latest
  • ansible-lint installation method: ansible-dev-tools devcontainer - ghcr.io/ansible/community-ansible-dev-tools:latest
STEPS TO REPRODUCE

Create the below test.yml and run it through the linter

---
- name: "Write crontab header for {{ postgresql_svc_user }}"
  become: true
  ansible.builtin.shell: |
    cat <<EOF >> crontab_temp.txt ##    |    +---------------- hour (0 - 23)
  changed_when: true
...

Desired Behavior

Expected behavior is the pipes in comments are interpreted correctly and not flagged for risky-shell-pipe rule.

Actual Behavior

image

jedthe3rd avatar Jul 16 '24 22:07 jedthe3rd