From 8f9c4f39388425c37f10b061869e2445c7e1e0e3 Mon Sep 17 00:00:00 2001 From: Wallun Date: Sun, 28 Nov 2021 13:22:33 +0100 Subject: [PATCH] ci(pre-commit): add pre-commit configuration --- .gitlint | 25 +++++++++++++++ .pre-commit-config.yaml | 28 +++++++++++++++++ .yamllint | 68 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 .gitlint create mode 100644 .pre-commit-config.yaml create mode 100644 .yamllint diff --git a/.gitlint b/.gitlint new file mode 100644 index 0000000..ffe2403 --- /dev/null +++ b/.gitlint @@ -0,0 +1,25 @@ +[general] +verbosity=3 +ignore-merge-commits=false +ignore-revert-commits=false +ignore-fixup-commits=false +ignore-squash-commits=false +ignore-stdin=true +staged=false +debug=false + +contrib=contrib-title-conventional-commits + +ignore=T5,title-must-not-contain-word,B6,body-is-missing + +[title-max-length] +line-length=50 + +[title-min-length] +min-length=10 + +[body-max-line-length] +line-length=72 + +[contrib-title-conventional-commits] +types = build,chore,ci,docs,fix,feat,perf,refactor,revert,style,test diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..afe6873 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +--- +default_stages: [ commit, manual ] + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: no-commit-to-branch + args: [ --branch, main ] + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.0.1 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: fix-byte-order-marker + + - repo: https://github.com/ansible-community/ansible-lint.git + rev: v5.2.1 + hooks: + - name: Run ansible-lint + id: ansible-lint + + - repo: https://github.com/jorisroovers/gitlint + rev: v0.16.0 + hooks: + - name: Run gitlint + id: gitlint diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..46acfa6 --- /dev/null +++ b/.yamllint @@ -0,0 +1,68 @@ +--- +rules: + braces: + forbid: false + min-spaces-inside: 1 + max-spaces-inside: 1 + min-spaces-inside-empty: 0 + max-spaces-inside-empty: 0 + brackets: + forbid: false + min-spaces-inside: 1 + max-spaces-inside: 1 + min-spaces-inside-empty: 0 + max-spaces-inside-empty: 0 + colons: + max-spaces-before: 0 + max-spaces-after: 1 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + require-starting-space: true + ignore-shebangs: true + min-spaces-from-content: 2 + comments-indentation: {} + document-end: + present: false + level: error + ignore: | + vault.yaml + document-start: + present: true + level: error + ignore: | + vault.yaml + empty-lines: + max: 2 + max-start: 0 + max-end: 0 + empty-values: + forbid-in-block-mappings: true + forbid-in-flow-mappings: true + hyphens: + max-spaces-after: 1 + indentation: + spaces: 2 + indent-sequences: true + check-multi-line-strings: false + key-duplicates: {} + line-length: + max: 80 + allow-non-breakable-words: true + allow-non-breakable-inline-mappings: false + new-lines: + type: unix + octal-values: + forbid-implicit-octal: true + forbid-explicit-octal: true + quoted-strings: + quote-type: any + required: only-when-needed + extra-required: [] + extra-allowed: [] + trailing-spaces: {} + truthy: + allowed-values: [ 'true', 'false' ] + check-keys: true