Skip to content

Commit

Permalink
Add meta-hooks for pre-commit validation (#17012)
Browse files Browse the repository at this point in the history
Summary of the issue:
pre-commit CI doesn't use a pinned version of python
the pre-commit CI file is not validated by pre-commit
pre-commit CI doesn't run our license check or unit tests. Further investigation was performed to see if this was possible. Unfortunately it is not.
Description of user facing changes
pin pre-commits python env version to 3.11
add validation for our pre-commit config with meta hooks
expand notes on why unit testing and license check is not possible with pre-commit CI, there's no way to consistently having a matching python venv to local devs, and no custom telemetry.
  • Loading branch information
seanbudd authored Aug 16, 2024
1 parent 38e2f73 commit 3fd1f07
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,33 @@ exclude: ^user_docs/(?!en/).*$
# https://pre-commit.ci/
# Configuration for Continuous Integration service
ci:
# Can't run Windows scripts on Linux
# These also do not apply fixes, only run tests
# Can't run Windows scons scripts on Linux.
# unit testing requires our python environment,
# which cannot be configured with pre-commit.ci:
# https://stackoverflow.com/questions/70778806/pre-commit-not-using-virtual-environment .
# Can't run licenseCheck as it relies on telemetry,
# which CI blocks.
skip: [scons-source, checkPot, unitTest, licenseCheck]
autoupdate_schedule: monthly
autoupdate_commit_msg: "Pre-commit auto-update"
autofix_commit_msg: "Pre-commit auto-fix"

default_language_version:
python: python3.11

repos:
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
- id: check-pre-commit-ci-config

- repo: meta
hooks:
# ensures that exclude directives apply to any file in the repository.
- id: check-useless-excludes
# ensures that the configured hooks apply to at least one file in the repository.
- id: check-hooks-apply

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
Expand Down

0 comments on commit 3fd1f07

Please sign in to comment.