From e78bc0b1f53b2325419897fca671e5026515b6f4 Mon Sep 17 00:00:00 2001 From: Vanessa Valderrama Date: Thu, 7 Mar 2024 11:27:22 -0600 Subject: Chore: Configure .github repo Add linting, gitreview, and pre-commit configuration files Change-Id: Ibe9f539170cc50468b797736c20ad41b314f20f0 Signed-off-by: Vanessa Valderrama --- .editorconfig | 20 ++++++++++++++++++++ .gitlint | 30 ++++++++++++++++++++++++++++++ .gitreview | 5 +++++ .pre-commit-config.yaml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 101 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitlint create mode 100644 .gitreview create mode 100644 .pre-commit-config.yaml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..61fbccb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4 + +[*.{json,yaml,yml}] +indent_size = 2 + +[*.markdown] +max_line_length = 80 + +[*.py] +max_line_legth = 120 + +[*.sh] +max_line_length = 80 diff --git a/.gitlint b/.gitlint new file mode 100644 index 0000000..3e8735e --- /dev/null +++ b/.gitlint @@ -0,0 +1,30 @@ +# All these sections are optional, edit this file as you like. +[general] +# Ignore certain rules, you can reference them by their id or by their full +# name +# ignore=title-trailing-punctuation, T3 + +# verbosity should be a value between 1 and 3, the command line -v flags take +# precedence over this +# verbosity = 2 + +# By default gitlint will ignore merge commits. Set to 'false' to disable. +# ignore-merge-commits=true + +# By default gitlint will ignore fixup commits. Set to 'false' to disable. +# ignore-fixup-commits=true + +# By default gitlint will ignore squash commits. Set to 'false' to disable. +# ignore-squash-commits=true + +# Enable debug mode (prints more output). Disabled by default. +# debug=true + +# Set the extra-path where gitlint will search for user defined rules +# See http://jorisroovers.github.io/gitlint/user_defined_rules for details +# extra-path=examples/ + +contrib=contrib-title-conventional-commits,contrib-body-requires-signed-off-by + +[contrib-title-conventional-commits] +types=Fix,Feat,Chore,Docs,Style,Refactor,Perf,Test,Revert,CI,Build diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..55d92ef --- /dev/null +++ b/.gitreview @@ -0,0 +1,5 @@ +[gerrit] +host=gerrit.fd.io +port=29418 +project=.github.git +defaultbranch=main diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5624ad6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,46 @@ +--- +ci: + autofix_commit_msg: "Chore: pre-commit autoupdate" + skip: + # pre-commit.ci does not have actionlint installed + - actionlint + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: f71fa2c1f9cf5cb705f73dffe4b21f7c61470ba9 # frozen: v4.4.0 + hooks: + - id: trailing-whitespace + - id: check-added-large-files + - id: check-ast + - id: check-json + - id: check-merge-conflict + - id: check-xml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: requirements-txt-fixer + - id: mixed-line-ending + args: ['--fix=lf'] + - id: no-commit-to-branch + args: + - --branch=dev + - --branch=master + - --branch=main + - --branch=rc + - --branch=production + + - repo: https://github.com/jorisroovers/gitlint + rev: acc9d9de6369b76d22cb4167029d2035e8730b98 # frozen: v0.19.1 + hooks: + - id: gitlint + + - repo: https://github.com/adrienverge/yamllint.git + rev: b05e028c5881819161d11cb543fd96a30c06cceb # frozen: v1.32.0 + hooks: + - id: yamllint + types: [yaml] + + - repo: https://github.com/rhysd/actionlint + rev: fd7ba3c382e13dcc0248e425b4cbc3f1185fa3ee # frozen: v1.6.24 + hooks: + - id: actionlint -- cgit 1.2.3-korg