https://github.com/hatamiarash7/pre-commit
My pre commit hooks
https://github.com/hatamiarash7/pre-commit
commit git pre-commit pre-commit-hook pre-commit-hooks
Last synced: 12 months ago
JSON representation
My pre commit hooks
- Host: GitHub
- URL: https://github.com/hatamiarash7/pre-commit
- Owner: hatamiarash7
- License: mit
- Created: 2022-05-12T06:16:00.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-01T17:59:45.000Z (almost 2 years ago)
- Last Synced: 2025-02-03T18:57:59.348Z (about 1 year ago)
- Topics: commit, git, pre-commit, pre-commit-hook, pre-commit-hooks
- Language: Shell
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pre Commit
My pre-commit hooks. You can use these hooks for easier development.
## Configuration
Run all checks:
```yaml
repos:
- repo: https://github.com/hatamiarash7/pre-commit
rev: v1.0.3
hooks:
- id: ansible_find_unused_variable
- id: ansible_find_empty_files
- id: ansible_find_empty_directories
- id: ansible_fix_readability
- id: ansible_find_undefined_handlers
- id: ansible_find_unquoted_values
```
## Hooks
We have these hooks for now. more items will be added gradually.
### Ansible - Find unused variables
This hook can help you find defined variables ( in `defaults/main.yml` or `vars/main.yml` ) that are not used in the role.
```yaml
repos:
- repo: https://github.com/hatamiarash7/pre-commit
rev: v1.0.0
hooks:
- id: ansible_find_unused_variable
```
### Ansible - Find empty files
This hook can find empty `defaults/main.yml`, `handlers/main.yml` and `vars/main.yml` files.
```yaml
repos:
- repo: https://github.com/hatamiarash7/pre-commit
rev: v1.0.0
hooks:
- id: ansible_find_empty_files
```
### Ansible - Find empty directories
This hook can find empty directories.
```yaml
repos:
- repo: https://github.com/hatamiarash7/pre-commit
rev: v1.0.0
hooks:
- id: ansible_find_empty_directory
```
### Ansible - Fix Readability
This hook can improve readability.
```yaml
repos:
- repo: https://github.com/hatamiarash7/pre-commit
rev: v1.0.0
hooks:
- id: ansible_fix_readability
```
### Ansible - Find undefined handler
This hook can find undefined handlers.
```yaml
repos:
- repo: https://github.com/hatamiarash7/pre-commit
rev: v1.0.0
hooks:
- id: ansible_find_undefined_handlers
```
### Ansible - Find unquoted values
This hook can find unquoted values.
```yaml
repos:
- repo: https://github.com/hatamiarash7/pre-commit
rev: v1.0.0
hooks:
- id: ansible_find_unquoted_values
```
## Known Problems
In some cases, you may need change permissions for cloned repository to run checks. For example you have this error :
```lang-none
Executable `/home/username/.cache/pre-commit//scripts/ansible_find_undefined_handlers.sh` is not executable
Find unquoted values that look like a version............................Failed
- hook id: ansible_find_unquoted_values
- exit code: 1
```
You can fix this problems easily :
```bash
chmod ug+x /home/username/.cache/pre-commit//scripts/*
```
---
## Support
[](https://en.cryptobadges.io/donate/bc1qmmh6vt366yzjt3grjxjjqynrrxs3frun8gnxrz) [](https://en.cryptobadges.io/donate/0x0831bD72Ea8904B38Be9D6185Da2f930d6078094)
[](https://ko-fi.com/D1D1WGU9)
## Contributing
Don't be shy to be a contributor 😉
1. Fork it !
2. Create your feature branch : `git checkout -b my-new-feature`
3. Commit your changes : `git commit -am 'Add some feature'`
4. Push to the branch : `git push origin my-new-feature`
5. Submit a pull request
## Issues
Each project may have many problems. Contributing to the better development of this project by reporting them.