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

Parseable output including severity and pep8 not working #1054

Closed
JiriSko opened this issue Sep 14, 2020 · 5 comments · Fixed by #1055
Closed

Parseable output including severity and pep8 not working #1054

JiriSko opened this issue Sep 14, 2020 · 5 comments · Fixed by #1055
Labels
new Triage required

Comments

@JiriSko
Copy link
Contributor

JiriSko commented Sep 14, 2020

Summary

Parseable-severity mode together with parseable output in the format of pep8 doesn't show severity in output.

Issue Type
  • Bug Report
Ansible and Ansible Lint details
bash-4.2# ansible --version
ansible 2.9.13
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /var/task/python/lib/python3.8/site-packages/ansible
  executable location = /var/task/python/bin/ansible
  python version = 3.8.5 (default, Sep 14 2020, 06:51:44) [GCC 7.3.1 20180712 (Red Hat 7.3.1-6)]
bash-4.2# ansible-lint --version
ansible-lint 4.3.4
  • ansible installation method: pip
  • ansible-lint installation method: pip
OS / ENVIRONMENT

Custom docker image based on amazonlinux:2.0.20190508 with installed python 3.8.5

STEPS TO REPRODUCE
ansible-lint -p --parseable-severity roles/test.yml
Desired Behaviour
roles/test.yml:5: [E301] [HIGH] Commands should not change things if nothing needs doing
roles/test.yml:5: [E303] [HIGH] service used in place of service module
roles/test.yml:8: [E301] [HIGH] Commands should not change things if nothing needs doing
roles/test.yml:8: [E303] [HIGH] service used in place of service module
roles/test.yml:13: [E301] [HIGH] Commands should not change things if nothing needs doing
roles/test.yml:13: [E303] [HIGH] service used in place of service module
roles/test.yml:13: [E502] [MEDIUM] All tasks should be named

This behavior is captured from ansible-lint v4.2.0.

Actual Behaviour
roles/test.yml:5: [E301] Commands should not change things if nothing needs doing
roles/test.yml:5: [E303] service used in place of service module
roles/test.yml:8: [E301] Commands should not change things if nothing needs doing
roles/test.yml:8: [E303] service used in place of service module
roles/test.yml:13: [E301] Commands should not change things if nothing needs doing
roles/test.yml:13: [E303] service used in place of service module
roles/test.yml:13: [E502] All tasks should be named

roles/test.yml contents:

---
- hosts: bobbins

  tasks:
  - name: a bad play
    action: command service blah restart

  - name: Start Nginx
    command: service nginx start
    tags:
      - nginx

  - command: service nginx start
    tags:
      - nginx
@JiriSko JiriSko added priority/medium new Triage required labels Sep 14, 2020
@ssbarnea
Copy link
Member

What was your expectation around this considering the pep8 format does not allow display of severity?

@JiriSko
Copy link
Contributor Author

JiriSko commented Sep 14, 2020

Oh, I didn't know that because it works in previous version. I'm looking for a machine-readable format including severity. Is any alternative?

@ssbarnea
Copy link
Member

Your best bet is to use github annotation format, as that one seems to be extensible, and we already support it. See https://ansible-lint.readthedocs.io/en/latest/usage.html#ci-cd

I am not sure if we output severity with it but if not you can easily make a patch to include it.

@JiriSko
Copy link
Contributor Author

JiriSko commented Sep 14, 2020

It look that severity isn't included in the output (tested).

https://github.com/ansible/ansible-lint/blob/master/lib/ansiblelint/formatters/__init__.py#L127 , patch should be simply, like you said.

@JiriSko
Copy link
Contributor Author

JiriSko commented Sep 14, 2020

I've created PR #1055. Is that what you thought?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new Triage required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants