Uzun zaman sonra bir projede daha pre-commit i kullanma karari verdim. Nede olsa terraform ile ansible benzer yapidalar.
Öncelikle ansible icin hook lara ihtiyacim vardi nerden bulacagimi bilmiyordum ama pre-commit in sayfasi bu konuda yardimci oluyor.
finding hooks
it’s recommended to use your favorite searching tool to find existing hooks to use in your project.
for example, here’s some searches you may find useful using sourcegraph:
- hooks which run on python files:
file:^\.pre-commit-hooks\.yaml$ "types: [python]"
- hooks which run on shell files:
file:^\.pre-commit-hooks\.yaml$ "types: [shell]"
- pre-commit configurations in popular projects:
file:^\.pre-commit-config\.yaml$
you may also find github’s search useful as well, though its querying and sorting capabilities are quite limited plus it requires a login:
- repositories providing hooks:
path:.pre-commit-hooks.yaml language:YAML
Aslinda Linklere tiklayarak da github ve sourcegraph incelenebilir. Ayrica github aramayi da burada anlatiyor
https://docs.github.com/en/search-github/github-code-search/understanding-github-code-search-syntax
Ansible Docs
Öncelikli amacim terraform gibi readme olusturmakti ve security scanlerini yapmakti. Bir kac tane hook buldum bunlari buraya koyuyorum.
.pre-commit-config.yaml
repos:
- repo: https://github.com/robertdebock/pre-commit
rev: v1.5.3
hooks:
- id: ansible_role_find_unused_variable
- id: ansible_role_find_empty_files
- id: ansible_role_find_empty_directories
- id: ansible_role_fix_readability
- id: ansible_role_find_undefined_handlers
- id: ansible_role_find_unquoted_values
- id: ansible_role_find_horizontal_when
- repo: https://github.com/danielhoherd/pre-commit-hooks
rev: master
hooks:
- id: CVE-2017-18342
- id: remove-unicode-left-to-right-mark
- id: remove-unicode-zero-width-non-breaking-spaces
- id: remove-unicode-zero-width-space
- id: replace-en-dashes
- id: replace-greek-question-mark
- id: replace-unicode-non-breaking-spaces
- id: sort-ansible-requirements-yml