-
Notifications
You must be signed in to change notification settings - Fork 3
feat: configure pre-commit hooks via CLI args, add no-banner-comment-check #39
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,6 @@ | |
| .idea/ | ||
| .vscode/ | ||
| .DS_Store | ||
| .venv/ | ||
| uv.lock | ||
| __pycache__/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: 2026 The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS) | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| default: true | ||
| MD013: | ||
| line_length: 1000 | ||
| MD024: | ||
| siblings_only: true | ||
| MD033: false | ||
| MD060: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: 2026 The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS) | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| default_install_hook_types: [pre-commit, commit-msg] | ||
|
|
||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v6.0.0 | ||
| hooks: | ||
| - id: check-yaml | ||
| - id: check-toml | ||
| - id: check-json | ||
| - id: check-merge-conflict | ||
| - id: end-of-file-fixer | ||
| exclude: '\.lock$' | ||
| - id: trailing-whitespace | ||
| exclude: '\.(patch|diff|lock)$' | ||
| - id: mixed-line-ending | ||
| exclude: '\.lock$' | ||
| - repo: https://github.com/google/yamlfmt | ||
| rev: v0.21.0 | ||
| hooks: | ||
| - id: yamlfmt | ||
| - repo: https://github.com/igorshubovych/markdownlint-cli | ||
| rev: v0.48.0 | ||
| hooks: | ||
| - id: markdownlint | ||
| - repo: https://github.com/astral-sh/ruff-pre-commit | ||
| rev: v0.15.12 | ||
| hooks: | ||
| - id: ruff-check | ||
| - id: ruff-format | ||
| - repo: https://github.com/gitleaks/gitleaks | ||
| rev: v8.30.1 | ||
| hooks: | ||
| - id: gitleaks | ||
| - repo: https://github.com/koalaman/shellcheck-precommit | ||
| rev: v0.11.0 | ||
| hooks: | ||
| - id: shellcheck | ||
| - repo: https://github.com/compilerla/conventional-pre-commit | ||
| rev: v4.4.0 | ||
| hooks: | ||
| - id: conventional-pre-commit | ||
| stages: [commit-msg] | ||
| - repo: https://github.com/eclipse-opensovd/cicd-workflows | ||
| # prek does not support `repo: self` or `repo: local`, so this repo must | ||
| # reference itself by URL with an explicit rev. The CI workflow (checks.yml) | ||
| # patches this sentinel to the actual HEAD SHA before running prek. For | ||
| # local runs, set this to the desired commit SHA (branch names not allowed). | ||
| rev: CICD_WORKFLOWS_HEAD_SHA | ||
| hooks: | ||
| - id: reuse-annotate | ||
| - id: no-unicode-check | ||
| - id: no-banner-comment-check | ||
| - id: check-hooks | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: 2026 The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS) | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| - id: reuse-annotate | ||
| name: Add missing license headers (REUSE) | ||
| entry: pre-commit-action/reuse-annotate-hook.py | ||
| language: script | ||
| pass_filenames: true | ||
| exclude: ^(LICENSE|NOTICE|CONTRIBUTORS)$ | ||
| args: | ||
| - --copyright=The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS) | ||
| - --license=Apache-2.0 | ||
| - --template=opensovd | ||
|
|
||
| - id: no-unicode-check | ||
| name: No Unicode characters allowed | ||
| entry: pre-commit-action/no-unicode-check.py | ||
| language: script | ||
| pass_filenames: true | ||
| files: '\.(rs|py|toml|yml|yaml|rst|c|h|kt|kts|sh|proto|fbs|puml|json|xml)$|^Dockerfile$' | ||
|
|
||
| - id: no-banner-comment-check | ||
| name: No banner-style comments allowed | ||
| entry: pre-commit-action/no-banner-comment-check.py | ||
| language: script | ||
| pass_filenames: true | ||
| files: '\.(rs|py|toml|yml|yaml|c|h|kt|kts|sh|proto|fbs|puml|json|xml)$|^Dockerfile$' | ||
| args: | ||
| - --banner-chars==\-#\*/~_+ | ||
| - --min-length=5 | ||
|
|
||
| - id: validate-cargo-lints | ||
| name: Validate Cargo Lints | ||
| entry: shared-lints/check_cargo_lints.py Cargo.toml | ||
| language: script | ||
| types: [rust] | ||
| pass_filenames: false | ||
|
|
||
| - id: check-hooks | ||
| name: Validate hook configuration | ||
| entry: pre-commit-action/check-hooks-installed.py | ||
| language: script | ||
| always_run: true | ||
| pass_filenames: false | ||
|
|
||
| - id: cargo-fmt | ||
| name: Rust format (shared config) | ||
| entry: shared-config/cargo-fmt.sh | ||
| language: script | ||
| pass_filenames: false | ||
|
|
||
| - id: clippy | ||
| name: Clippy (shared config) | ||
| entry: shared-config/cargo-clippy.sh | ||
| language: script | ||
| pass_filenames: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: 2026 The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS) | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| formatter: | ||
| type: basic | ||
| retain_line_breaks_single: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| <!-- | ||
| SPDX-License-Identifier: Apache-2.0 | ||
| SPDX-FileCopyrightText: 2026 The Contributors to Eclipse OpenSOVD (see CONTRIBUTORS) | ||
|
|
||
| See the NOTICE file(s) distributed with this work for additional | ||
| information regarding copyright ownership. | ||
|
|
||
| This program and the accompanying materials are made available under the | ||
| terms of the Apache License Version 2.0 which is available at | ||
| https://www.apache.org/licenses/LICENSE-2.0 | ||
| --> | ||
|
|
||
| # AI Agent Guidelines | ||
|
|
||
| Guidance for AI coding assistants working in this repository. | ||
|
|
||
| ## Do Not Generate Banner Comments | ||
|
|
||
| Do not generate banner-style decorative comments such as repeated `=` or `-` lines. | ||
| They add noise and will be rejected by the `no-banner-comment-check` hook. | ||
|
|
||
| Prefer clear names, small modules, and well-structured functions instead. | ||
|
|
||
| ## Code Style | ||
|
|
||
| ### Python | ||
|
|
||
| - Line length: 100 characters | ||
| - Formatter: `ruff format` | ||
| - Linter: `ruff check` with rules from `shared-config/ruff.toml` | ||
|
|
||
| ### Rust | ||
|
|
||
| - Formatter: `cargo fmt` with `shared-config/.rustfmt.toml` | ||
| - Linter: `cargo clippy --all-features --all-targets -- -D warnings` | ||
| - Max line width: 100 characters | ||
|
|
||
| ### Shell | ||
|
|
||
| - Shell scripts must pass `shellcheck` | ||
|
|
||
| ## License Headers (REUSE/SPDX) | ||
|
|
||
| Every source file must include SPDX license headers. For Markdown files like this one, use an HTML comment block. | ||
|
|
||
| Do not remove or alter SPDX headers added by `reuse-annotate`. | ||
|
|
||
| ## Sharing With Consumer Repos | ||
|
|
||
| Consumer repositories may copy or adapt this file for their own agent guidance. There is no automated distribution mechanism yet; keep copies in sync manually or reference a pinned canonical version. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.