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

ansible-lint pre-commit hook not using configuration file #515

Closed
ansiblejunky opened this issue May 21, 2019 · 1 comment
Closed

ansible-lint pre-commit hook not using configuration file #515

ansiblejunky opened this issue May 21, 2019 · 1 comment

Comments

@ansiblejunky
Copy link
Contributor

Issue Type

  • Bug report

Ansible and Ansible Lint details

ansible --version
2.7.10
ansible-lint --version
4.1.0
  • ansible installation method: pip
  • ansible-lint installation method: pre-commit installed from source

Desired Behaviour

Running pre-commit should result in ansible-lint using my configuration file that defines various settings.

pre-commit run ansible-lint

Actual Behaviour (Bug report only)

pre-commit launches ansible-lint but it's clear that ansible-lint is not using my configuration file because it's not applying my custom rules. When I instead run ansible-lint explicitly it picks up the configuration file and applies my rules.

ansible-lint site.yml

Below is the pre-commit hook definition in the .pre-commit-config.yaml file.

---

repos:
  - repo: https://github.com/ansible/ansible-lint.git
    rev: v4.1.0a0
    hooks:
      - id: ansible-lint
        name: ansible-lint
        files: \.(yaml|yml)$
        entry: ansible-lint
        language: python
        verbose: true

I tried adding the args option to explicitly define the config file but this does not work and is ignored (has no affect)! Here is my version with the args option:

---

repos:
  - repo: https://github.com/ansible/ansible-lint.git
    rev: v4.1.0a0
    hooks:
      - id: ansible-lint
        name: ansible-lint
        files: \.(yaml|yml)$
        entry: ansible-lint
        language: python
        args: [-c .ansible-lint]
        verbose: true

I have tried different formats for the args option and nothing worked.

Can someone please fix or advise?

@ansiblejunky
Copy link
Contributor Author

Actually, I determined the real problem is not with the args. It was caused because I had a vault file also in my staged files. Closing this issue as the real issue is here.

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

No branches or pull requests

1 participant