From 6c56182e316f79313d71d2a77bdbb1e4641cb0fe Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 24 Jun 2025 20:14:02 +0200 Subject: [PATCH 1/3] Add more checks to pre-commit hook --- .pre-commit-config.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 220f81804b3b..317ca5909d53 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,13 +16,23 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v5.0.0 hooks: + # Git + - id: check-added-large-files + - id: no-commit-to-branch + name: "ensure no direct commit to master/maintenance branches" + args: [--branch, "master", --pattern, "maintenance/.*"] + - id: check-case-conflict + - id: check-illegal-windows-names + # Contents - id: check-ast - id: check-builtin-literals - id: check-case-conflict - id: check-executables-have-shebangs - id: check-merge-conflict - id: check-shebang-scripts-are-executable + - id: check-symlinks - id: check-toml + - id: check-yaml - id: debug-statements - id: destroyed-symlinks - id: end-of-file-fixer From 658b00d4c8025f0834333e4793eb02fb70e59d4d Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 24 Jun 2025 20:26:57 +0200 Subject: [PATCH 2/3] Exclude check-yaml check --- .pre-commit-config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 317ca5909d53..7e2a26056f12 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -32,7 +32,6 @@ repos: - id: check-shebang-scripts-are-executable - id: check-symlinks - id: check-toml - - id: check-yaml - id: debug-statements - id: destroyed-symlinks - id: end-of-file-fixer From d3442a48306ef9190cfea678e7ee8fe6e70ad952 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Tue, 24 Jun 2025 20:31:15 +0200 Subject: [PATCH 3/3] Add change to the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e09bb89d49e..d713b1d5ec19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added * Added `--target-cuda[=ARCH]` option to replace the deprecated `--target=cuda`, allowing users to build for CUDA devices with optional architecture selection using [CodePlay oneAPI plug-in](https://developer.codeplay.com/products/oneapi/nvidia/home/) [#2478](https://github.com/IntelPython/dpnp/pull/2478) +* Added several new `pre-commit` rules, including protection against direct commits to master/maintenance branches [#2500](https://github.com/IntelPython/dpnp/pull/2500) ### Changed