From 4d10f400a658b204c2f8aa7c42f7c033ff266bd2 Mon Sep 17 00:00:00 2001 From: pat-s Date: Sat, 13 Jun 2026 21:14:36 +0200 Subject: [PATCH] ci: add prek/pre-commit hooks (prettier, markdownlint, editorconfig, yamllint, air) --- .pre-commit-config.yaml | 37 +++++++++++++++++++++++++++++++++++++ .yamllint.yaml | 19 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 .yamllint.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..7ff6df3 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,37 @@ +# cSpell:ignore autofix autoupdate +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace + args: + - --markdown-linebreak-ext=md + - repo: https://github.com/DavidAnson/markdownlint-cli2 + rev: v0.22.1 + hooks: + - id: markdownlint-cli2 + - repo: https://github.com/rbubley/mirrors-prettier + rev: v3.8.4 + hooks: + - id: prettier + - repo: https://github.com/posit-dev/air-pre-commit + rev: 0.8.2 + hooks: + - id: air-format + - repo: https://github.com/editorconfig-checker/editorconfig-checker + rev: v3.7.0 + hooks: + - id: editorconfig-checker + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.38.0 + hooks: + - id: yamllint + args: [--strict, -c=.yamllint.yaml] + - repo: local + hooks: + - id: yaml-file-extension + name: Check if YAML files has *.yaml extension. + entry: YAML filenames must have .yaml extension. + language: fail + files: .yml$ diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..d0370a3 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,19 @@ +rules: + comments: + require-starting-space: false + ignore-shebangs: true + min-spaces-from-content: 1 + braces: + min-spaces-inside-empty: 0 + max-spaces-inside-empty: 0 + min-spaces-inside: 0 + max-spaces-inside: 1 + document-start: + present: false + indentation: + spaces: 2 + indent-sequences: true + # .crow/* workflows embed long single-line R commands (>1k chars) + line-length: disable + new-lines: + type: unix