diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 9d2769a..e65014f 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -37,7 +37,7 @@ jobs: with: submodules: false - name: Format and Clippy - Stable toolchain - uses: eclipse-opensovd/cicd-workflows/rust-lint-and-format-action@b90aee53ba1739e08f7991d24241b23903a8c11a + uses: eclipse-opensovd/cicd-workflows/rust-lint-and-format-action@feat/pre-commit-hook-args-config with: toolchain: 1.88.0 github-token: ${{ secrets.GITHUB_TOKEN }} @@ -48,7 +48,7 @@ jobs: rustfmt-enable-reviewdog: "false" error-on-unformatted: "false" - name: Format and Clippy - Nightly toolchain pinned - uses: eclipse-opensovd/cicd-workflows/rust-lint-and-format-action@b90aee53ba1739e08f7991d24241b23903a8c11a + uses: eclipse-opensovd/cicd-workflows/rust-lint-and-format-action@feat/pre-commit-hook-args-config with: toolchain: nightly-2025-07-14 github-token: ${{ secrets.GITHUB_TOKEN }} @@ -61,7 +61,7 @@ jobs: - name: Format and Clippy - Nightly toolchain latest id: nightly-clippy continue-on-error: true - uses: eclipse-opensovd/cicd-workflows/rust-lint-and-format-action@b90aee53ba1739e08f7991d24241b23903a8c11a + uses: eclipse-opensovd/cicd-workflows/rust-lint-and-format-action@feat/pre-commit-hook-args-config with: toolchain: nightly github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index c842a1d..3b051ff 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -20,10 +20,6 @@ on: permissions: contents: read -env: - PYTHON_VERSION: 3.13 - PRE_COMMIT_VERSION: 4.2 - concurrency: group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true @@ -33,4 +29,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Run checks - uses: eclipse-opensovd/cicd-workflows/pre-commit-action@b90aee53ba1739e08f7991d24241b23903a8c11a + uses: eclipse-opensovd/cicd-workflows/pre-commit-action@feat/pre-commit-hook-args-config + with: + rust-toolchain: "1.88" diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..ecc62da --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2025 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 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..af093c8 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 + +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-docker + - 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 + rev: b2b41099a192fdc1c7f88e85e1823600f1c9faa0 + hooks: + - id: reuse-annotate + - id: no-unicode-check + args: + - --allowed-chars=µ,§ + - id: no-banner-comment-check + - id: validate-cargo-lints + - id: cargo-fmt + - id: clippy + - id: check-hooks diff --git a/rustfmt.toml b/.rustfmt.toml similarity index 58% rename from rustfmt.toml rename to .rustfmt.toml index 90fbb2e..5711a1a 100644 --- a/rustfmt.toml +++ b/.rustfmt.toml @@ -7,13 +7,8 @@ # 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 - +style_edition = "2024" max_width = 100 - -# in case rustfmt stopps working again, enable these options -# to get more information about the error -# requires to run rustfmt with nightly toolchain -# for example: `rustfmt +nightly src/diagtype/mod.rs --edition 2024 --verbose` -# error_on_unformatted = true -# error_on_line_overflow = true -#format_strings = true +newline_style = "Unix" +group_imports = "StdExternalCrate" +imports_granularity = "Crate" diff --git a/.yamlfmt b/.yamlfmt new file mode 100644 index 0000000..fa3e99a --- /dev/null +++ b/.yamlfmt @@ -0,0 +1,12 @@ +# SPDX-License-Identifier: Apache-2.0 +# SPDX-FileCopyrightText: 2025 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