From 3b54c629fe40ae8457218ca35b106221d4236df5 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Tue, 31 Mar 2026 22:06:18 +1000 Subject: [PATCH 1/2] [CI] Add three pre-commit pygrep hooks https://github.com/pre-commit/pygrep-hooks Official hooks from pre-commit some more basic checks or tests we can run --- .pre-commit-config.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index cf6f8d39027d..9d620be941f0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -165,6 +165,19 @@ repos: files: ^(LICENSE|NOTICE)$|\.(bat|cfg|cs|css|gitignore|header|in|install|java|md|properties|py|rb|rc|sh|sql|te|template|txt|ucls|vue|xml|xsl|yaml|yml)$|^cloud-cli/bindir/cloud-tool$|^debian/changelog$ args: [--markdown-linebreak-ext=md] exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$ + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.10.0 + hooks: + - id: python-check-mock-methods + name: run check for not-real mock methods + description: Prevent common mistakes of assert mck.not_called(), assert mck.called_once_with(...) and mck.assert_called + - id: python-use-type-annotations + name: run check for type annotations not comments + description: Enforce that python3.6+ type annotations are used instead of type comments + exclude: ^scripts/vm/hypervisor/xenserver/xenserver56/InterfaceReconfigure\.py$ + - id: text-unicode-replacement-char + name: run check for no unicode replacement char + description: Forbid files which have a UTF-8 Unicode replacement character - repo: https://github.com/codespell-project/codespell rev: v2.4.1 hooks: From 69c15b3fc35f49add3b3501b05c81c1eefbe3221 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Wed, 9 Sep 2026 12:43:15 +1000 Subject: [PATCH 2/2] Pin hook to sha https://github.com/pre-commit/pygrep-hooks/commit/3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index dd97f34a0a29..469886c3d23d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -187,7 +187,7 @@ repos: args: [--markdown-linebreak-ext=md] exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$ - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.10.0 + rev: 3a6eb0fadf60b3cccfd80bad9dbb6fae7e47b316 # frozen: v1.10.0 hooks: - id: python-check-mock-methods name: run check for not-real mock methods