From 1fa89dbf8645068f853833c7a3e2b20fdbc49f15 Mon Sep 17 00:00:00 2001 From: Gereon V <72784429+GereonV@users.noreply.github.com> Date: Wed, 27 Nov 2024 20:21:58 +0100 Subject: [PATCH] Add many nice tools --- .editorconfig | 17 +++++++++++++++ .github/workflows/main.yml | 18 ++++++++++++++++ .gitlab-ci.yml | 15 +++++++++++++ .gitlint | 15 +++++++++++++ .pre-commit-config.yaml | 44 ++++++++++++++++++++++++++++++++++++++ .yamllint.yaml | 16 ++++++++++++++ README.md | 1 + 7 files changed, 126 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/workflows/main.yml create mode 100644 .gitlab-ci.yml create mode 100644 .gitlint create mode 100644 .pre-commit-config.yaml create mode 100644 .yamllint.yaml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..eba1d40 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +https://editorconfig.org + +root = true + +[*] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[Makefile] +indent_style = tab + +[*.{yml,yaml}] +indent_size = 2 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..b07c613 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,18 @@ +name: Global +on: [push] +jobs: + pre-commit: + runs-on: ubuntu:latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: 3.13 + - name: Install pre-commit + run: pip install pre-commit + - name: Run pre-commit 'manual' hooks + run: pre-commit run --color=always + --all-files + --hook-stage manual + --show-diff-on-failure + --verbose diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..c6acfd9 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,15 @@ +pre-commit: + image: python:latest + stage: test + variables: + PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit + cache: + key: pre-commit + paths: ["${PRE_COMMIT_HOME}"] + script: + - pip install pre-commit + - pre-commit run --color=always + --all-files + --hook-stage manual + --show-diff-on-failure + --verbose diff --git a/.gitlint b/.gitlint new file mode 100644 index 0000000..3070793 --- /dev/null +++ b/.gitlint @@ -0,0 +1,15 @@ +[general] +ignore=body-is-missing +verbosity=3 + +[title-max-length] +line-length=80 + +[title-min-length] +min-length=5 + +[body-max-line-length] +line-length=120 + +[body-min-length] +min-length=5 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..ea4f4c0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,44 @@ +default_install_hook_types: [commit-msg, pre-commit, pre-merge-commit, pre-push] +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-added-large-files + args: [--maxkb=100] + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-illegal-windows-names + - id: check-json + - id: check-merge-conflict + - id: check-shebang-scripts-are-executable + - id: check-symlinks + - id: check-toml + - id: check-xml + - id: check-yaml + - id: destroyed-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: fix-byte-order-marker + - id: mixed-line-ending + args: [--fix=lf] + - id: pretty-format-json + args: [--autofix, --ident=4, --no-sort-keys] + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] +- repo: https://github.com/editorconfig-checker/editorconfig-checker.python + rev: 3.0.3 + hooks: + - id: editorconfig-checker +- repo: https://github.com/jorisroovers/gitlint + rev: v0.19.1 + hooks: + - id: gitlint + - id: gitlint-ci +- repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.43.0 + hooks: + - id: markdownlint +- repo: https://github.com/adrienverge/yamllint + rev: v1.35.1 + hooks: + - id: yamllint diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..5fe5547 --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,16 @@ +extends: default +rules: + document-end: + present: false + document-start: + present: false + indentation: + spaces: 2 + indent-sequences: false + key-duplicates: {} + line-length: + max: 80 + level: warning + quoted-strings: + required: only-when-needed + trailing-spaces: {} diff --git a/README.md b/README.md index 993102b..14c045b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Project templates + [![Python](https://github.com/GereonV/templates/actions/workflows/python.yml/badge.svg)](https://github.com/GereonV/templates/tree/python) [![GitLab CI](https://gitlab.com/gereon36/templates/badges/python/pipeline.svg)](https://gitlab.com/gereon36/templates/-/tree/python)\ [![C++](https://github.com/GereonV/templates/actions/workflows/cpp.yml/badge.svg)](https://github.com/GereonV/templates/tree/cpp)