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

E306 shouldn't warn when the command never fails #1250

Closed
pikrzysztof opened this issue Jan 19, 2021 · 1 comment · Fixed by #1453
Closed

E306 shouldn't warn when the command never fails #1250

pikrzysztof opened this issue Jan 19, 2021 · 1 comment · Fixed by #1453
Labels

Comments

@pikrzysztof
Copy link

Why would I want pipefail to be set when:

A) the command can't fail because I said so
B) the failure condition is nontrivial, such as "the error message does not contain Y word"

?

Example code that E306 shouldn't warn about:

- shell: "pgrep stuff | wc -l" # noqa 306
  failed_when: false
  changed_when: false
  check_mode: false
  register: stuff_is_running
@ssbarnea
Copy link
Member

I guess that the presence of failed_when: false should disable this rule. Feel free to make a PR to add this, it does make sense.

ssbarnea added a commit that referenced this issue Mar 10, 2021
Removes one false positive case where user set ignore_errors: true,
case in which the rule does not make much sense.

Fixes: #1250
ssbarnea added a commit that referenced this issue Mar 10, 2021
Removes one false positive case where user set ignore_errors: true,
case in which the rule does not make much sense.

Fixes: #1250
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants