ansys / ansys/pre-commit-hooks

Improve testing for pre-commit hooks

Open
#277 0 comments 1 reaction 0 assignees Claimed by @klmcadams View on GitHub
Dominant language
Python
Stars
5
Forks
1
Avg merge
4h 21m
Merged PRs (30d)
9

Description

Figure out a way to test the pre-commit hooks in the actions.

Currently, the content of the hooks are tested with pytest, but I have to test my hook changes locally by updating the .pre-commit-config.yaml file:

```
- repo: local
hooks:
- id: add-license-headers
name: "Add License Headers"
entry: add-license-headers
language: python
files: '(src|examples|tests)/.*\.(py)|\.(proto)'
require_serial: true
args:
- --start_year=2023
exclude: |
(?x)^(
tests/test_add_license_headers_files/bad_chars.py |
tests/test_add_license_headers_files/index_error.scss
)$
```

**Next steps**
- Look at how hooks are tested in the [pre-commit repository](https://github.com/pre-commit/pre-commit) & do something similar?
- Create dummy repos for each hook that tests all scenarios for add-license-headers and tech-review respectively

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.