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

Improve testing for pre-commit hooks #277

Open
klmcadams opened this issue Jan 17, 2025 · 0 comments
Open

Improve testing for pre-commit hooks #277

klmcadams opened this issue Jan 17, 2025 · 0 comments

Comments

@klmcadams
Copy link
Contributor

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 & do something similar?
  • Create dummy repos for each hook that tests all scenarios for add-license-headers and tech-review respectively
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