From b7db0e17cd5cd1f1a2e65a98bb190c282816774d Mon Sep 17 00:00:00 2001 From: Timtor Chen Date: Mon, 25 Nov 2024 23:30:59 +0800 Subject: [PATCH] change yamllint to dprint --- .github/workflows/dummy-check.yaml | 11 ----------- .github/workflows/format-check.yaml | 16 ++++++++++++++++ .pre-commit-config.yaml | 9 ++++++--- .tasks/dprint.yaml | 10 ++++++++++ .yamllint.yaml | 25 ------------------------- Taskfile.yaml | 1 + dprint.json | 7 +++++++ 7 files changed, 40 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/dummy-check.yaml create mode 100644 .github/workflows/format-check.yaml create mode 100644 .tasks/dprint.yaml delete mode 100644 .yamllint.yaml create mode 100644 dprint.json diff --git a/.github/workflows/dummy-check.yaml b/.github/workflows/dummy-check.yaml deleted file mode 100644 index 4e05aabd..00000000 --- a/.github/workflows/dummy-check.yaml +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: dummy-check -"on": - pull_request: - branches: ["main"] - -jobs: - echo: - runs-on: "ubuntu-latest" - steps: - - run: echo "dummy-check" diff --git a/.github/workflows/format-check.yaml b/.github/workflows/format-check.yaml new file mode 100644 index 00000000..0e6b9103 --- /dev/null +++ b/.github/workflows/format-check.yaml @@ -0,0 +1,16 @@ +--- +name: format-check + +on: + pull_request: + push: + branches: + - "**" + +jobs: + lint: + name: Format check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 + - uses: dprint/check@2f1cf31537886c3bfb05591c031f7744e48ba8a1 # v2.2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aefc4cd1..7138459c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,10 @@ repos: rev: v8.8.2 hooks: - id: gitleaks - - repo: https://github.com/adrienverge/yamllint - rev: v1.27.1 + - repo: local hooks: - - id: yamllint + - id: format-docs + name: Format docs + entry: dprint fmt + language: system + pass_filenames: false diff --git a/.tasks/dprint.yaml b/.tasks/dprint.yaml new file mode 100644 index 00000000..05fa32bb --- /dev/null +++ b/.tasks/dprint.yaml @@ -0,0 +1,10 @@ +--- +version: "3" +silent: true + +tasks: + check: + cmd: dprint check {{.CLI_ARGS}} + + fmt: + cmd: dprint fmt {{.CLI_ARGS}} diff --git a/.yamllint.yaml b/.yamllint.yaml deleted file mode 100644 index 65b2070e..00000000 --- a/.yamllint.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -extends: default - -ignore: | - *.sops.yaml - policy.yaml - -rules: - indentation: - spaces: 2 - - braces: - max-spaces-inside: 1 - - truthy: - allowed-values: ["true", "false"] - check-keys: true - - line-length: - max: 120 - allow-non-breakable-words: true - allow-non-breakable-inline-mappings: true - - empty-lines: - max: 1 diff --git a/Taskfile.yaml b/Taskfile.yaml index 16e694f4..d21caf8a 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -10,6 +10,7 @@ includes: taskfile: talos/.taskfile.yaml dir: talos kubernetes: kubernetes/.taskfile.yaml + format: .tasks/dprint.yaml tasks: pre-commit:init: diff --git a/dprint.json b/dprint.json new file mode 100644 index 00000000..9f06c321 --- /dev/null +++ b/dprint.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "https://plugins.dprint.dev/json-0.15.3.wasm", + "https://plugins.dprint.dev/markdown-0.13.3.wasm", + "https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm" + ] +}