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

6.12.0 does not obey some noqa comment tags #2970

Closed
ianw opened this issue Feb 2, 2023 · 4 comments · Fixed by #2971
Closed

6.12.0 does not obey some noqa comment tags #2970

ianw opened this issue Feb 2, 2023 · 4 comments · Fixed by #2971
Assignees
Labels

Comments

@ianw
Copy link

ianw commented Feb 2, 2023

With ``test.yaml``` of

- name: Play
  hosts: all
  tasks:
    # We tag this with the unix timestamp so that the upload always
    # has an increasing version number.
    - name: Import sandbox project  # noqa command-instead-of-module
      shell: |
        git clone https://opendev.org/opendev/sandbox
$ .tox/linters/bin/ansible-lint ./test.yaml 
WARNING: PATH altered to include /home/iwienand/programs/zuul/zuul-jobs/.tox/linters/bin :: This is usually a sign of broken local setup, which can cause unexpected behaviors.
WARNING  Ignore loading rule from /home/iwienand/programs/zuul/zuul-jobs/.tox/linters/lib/python3.11/site-packages/ansiblelint/rules/galaxy.py due to No module named 'pytest'
INFO     Set ANSIBLE_LIBRARY=/home/iwienand/.cache/ansible-compat/7f15ad/modules:/home/iwienand/.ansible/plugins/modules:/usr/share/ansible/plugins/modules
INFO     Set ANSIBLE_COLLECTIONS_PATH=/home/iwienand/.cache/ansible-compat/7f15ad/collections:/home/iwienand/.ansible/collections:/usr/share/ansible/collections
INFO     Set ANSIBLE_ROLES_PATH=/home/iwienand/.cache/ansible-compat/7f15ad/roles:roles:/home/iwienand/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles
INFO     Executing syntax check on test.yaml (0.44s)
WARNING  Listing 1 violation(s) that are fatal
test.yaml:6: command-instead-of-module: git used in place of git module
You can skip specific rules or tags by adding them to your configuration file:
# .config/ansible-lint.yml
warn_list:  # or 'skip_list' to silence them completely
  - command-instead-of-module  # Using command rather than module.

                    Rule Violation Summary                    
 count tag                       profile rule associated tags 
     1 command-instead-of-module basic   command-shell, idiom 

Failed after min profile: 1 failure(s), 0 warning(s) on 1 files.

This works with 6.11

I bisected this and it started happening @ 497bae9

@ianw ianw added bug new Triage required labels Feb 2, 2023
@ianw
Copy link
Author

ianw commented Feb 2, 2023

Another example is (so I guess this shows its more generic than just deprecated-command-syntax)

- hosts: all
  pre_tasks:
    # Run ensure-output-dirs now as it is not performed speculatively
    - name: Run ensure-output-dirs
      import_role:
        name: ensure-output-dirs

    - name: Create fake translation  # noqa deprecated-command-syntax
      shell: |
        mkdir -p src/{{ zuul.project.canonical_name }}/translation-source/
        echo Hello > src/{{ zuul.project.canonical_name }}/translation-source/test

@ianw ianw changed the title 6.12.0 does not obey "noqa command-instead-of-module" 6.12.0 does not obey some noqa comment tags Feb 2, 2023
@ssbarnea
Copy link
Member

ssbarnea commented Feb 2, 2023

I am afraid that this is unrelated, you missed to add the colons after noqa, noqa: xxx works, but noqa xxx does not.

I will not close the bug because I spotted two examples in docs that do not use the colon, but all the other ones do.

We need to fix at least the docs. If we are support the syntax without the colon,... not sure, I will ask around.

BTW, Thanks for the good bug reports, keep reporting them.

@vooon
Copy link

vooon commented Feb 2, 2023

@ssbarnea but doc doesn't say that colon is needed: # noqa [rule_id]

https://ansible-lint.readthedocs.io/usage/#muting-warnings-to-avoid-false-positives

That's kind of breaking changes, because previously linter do not require colon, so things like # noqa 204 or # noqa command-instead-of-module worked well.

@ssbarnea ssbarnea self-assigned this Feb 2, 2023
@ssbarnea ssbarnea removed the new Triage required label Feb 2, 2023
@ssbarnea
Copy link
Member

ssbarnea commented Feb 2, 2023

I am working on a hotfix.

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.

3 participants