-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pre-commit): streamline the configs
- Loading branch information
Per Macha
committed
Mar 30, 2024
1 parent
177d017
commit ffcf155
Showing
6 changed files
with
494 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# This file contains ignores rule violations for ansible-lint | ||
.gitlab-ci.yml yaml[quoted-strings] | ||
.pre-commit-config-legacy.yaml yaml[line-length] | ||
.releaserc.yaml yaml[document-end] | ||
.releaserc.yaml yaml[document-start] | ||
.releaserc.yaml yaml[quoted-strings] | ||
ansible/fetch-secrets-from-ucs-machine.yaml no-changed-when | ||
ansible/fetch-secrets-from-ucs-machine.yaml risky-file-permissions | ||
ansible/fetch-secrets-from-ucs-machine.yaml yaml[document-end] | ||
ansible/fetch-secrets-from-ucs-machine.yaml yaml[quoted-strings] | ||
docker-compose.yaml yaml[empty-values] | ||
docker-compose.yaml yaml[line-length] | ||
docker-compose.yaml yaml[quoted-strings] | ||
helm/udm-rest-api/Chart.yaml yaml[document-end] | ||
helm/udm-rest-api/Chart.yaml yaml[quoted-strings] | ||
helm/udm-rest-api/linter_values.yaml yaml[quoted-strings] | ||
helm/udm-rest-api/values.yaml yaml[document-end] | ||
helm/udm-rest-api/values.yaml yaml[line-length] | ||
helm/udm-rest-api/values.yaml yaml[quoted-strings] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
[flake8] | ||
|
||
# yapf with 79 sometimes use 80 | ||
# default=79 | ||
max-line-length = 100 | ||
|
||
max-complexity = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,235 @@ | ||
--- | ||
|
||
# SPDX-FileCopyrightText: 2023-2024 Univention GmbH | ||
# SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
# See https://pre-commit.com for more information | ||
# See https://pre-commit.com/hooks.html for more hooks | ||
|
||
repos: | ||
# "Copy .env.udm-rest-api.example so that docker-compose.yaml can be linted" | ||
- repo: "local" | ||
hooks: | ||
- id: "copy-udm-rest-api" | ||
name: "copy-udm-rest-api" | ||
entry: "sh -c 'if [ ! -f .env.udm-rest-api ]; then cp .env.udm-rest-api.example .env.udm-rest-api; fi'" | ||
language: "system" | ||
files: "docker-compose.yaml" | ||
pass_filenames: false | ||
|
||
- repo: "https://github.com/pre-commit/pre-commit-hooks" | ||
rev: "v4.5.0" | ||
hooks: | ||
- id: "check-added-large-files" | ||
name: "check for added large files" | ||
- id: "check-ast" | ||
name: "check python ast" | ||
- id: "check-case-conflict" | ||
name: "check for case conflicts" | ||
- id: "check-docstring-first" | ||
name: "check docstring is first" | ||
- id: "check-executables-have-shebangs" | ||
name: "check that executables have shebangs" | ||
- id: "check-json" | ||
name: "check json" | ||
- id: "check-merge-conflict" | ||
name: "check for merge conflicts" | ||
- id: "check-yaml" | ||
name: "check yaml" | ||
exclude: "^helm/.+/templates/" | ||
args: | ||
- "--allow-multiple-documents" | ||
# Allow custom tags like Gitlab's "!reference" tag. | ||
- "--unsafe" | ||
- id: "check-symlinks" | ||
name: "check for broken symlinks" | ||
- id: "detect-private-key" | ||
name: "detect private key" | ||
- id: "end-of-file-fixer" | ||
name: "fix end of files" | ||
exclude: "^helm/.+/README.md$" | ||
- id: "fix-byte-order-marker" | ||
name: "fix utf-8 byte order marker" | ||
- id: "trailing-whitespace" | ||
name: "trim trailing whitespace" | ||
|
||
- repo: "https://github.com/compilerla/conventional-pre-commit" | ||
rev: "v3.0.0" | ||
hooks: | ||
- id: "conventional-pre-commit" | ||
name: "Conventional Commit" | ||
stages: ["commit-msg"] | ||
|
||
- repo: "https://git.knut.univention.de/univention/dist/pre-commit-hooks/addlicense" | ||
rev: "v1.0.1" | ||
hooks: | ||
- id: "addlicense" | ||
name: "Check or add license headers to files" | ||
types_or: | ||
- "dockerfile" | ||
- "python" | ||
- "yaml" | ||
|
||
- repo: "https://github.com/adrienverge/yamllint" | ||
rev: "v1.33.0" | ||
hooks: | ||
- id: "yamllint" | ||
name: "yamllint" | ||
types: | ||
- "yaml" | ||
exclude: "^helm/.+/templates/" | ||
args: | ||
- "--config-file=.yamllint" | ||
- "--format=parsable" | ||
# TODO replace no-warnings with strict | ||
# - "--strict" | ||
- "--no-warnings" | ||
|
||
- repo: "https://github.com/ansible/ansible-lint" | ||
rev: "v6.22.1" | ||
hooks: | ||
- id: "ansible-lint" | ||
name: "Ansible-lint" | ||
args: | ||
- "--ignore-file=.ansible-lint-ignore-legacy" | ||
|
||
- repo: "https://github.com/google/yapf" | ||
rev: "v0.40.2" | ||
hooks: | ||
- id: "yapf" | ||
name: "yapf" | ||
types: | ||
- "python" | ||
exclude: "^(docs/conf.py|tests/integration/conftest.py|tests/integration/test_users_user.py)" | ||
|
||
- repo: "https://github.com/astral-sh/ruff-pre-commit" | ||
rev: "v0.1.9" | ||
hooks: | ||
- id: "ruff" | ||
name: "ruff" | ||
types: | ||
- "python" | ||
args: | ||
- "--fix" | ||
- "--show-source" | ||
- "--exit-non-zero-on-fix" | ||
- "--extend-select=COM" | ||
|
||
- repo: "https://github.com/hhatto/autopep8" | ||
rev: "v2.0.4" | ||
hooks: | ||
- id: "autopep8" | ||
name: "autopep8" | ||
types: | ||
- "python" | ||
args: | ||
- "--in-place" | ||
- "--aggressive" | ||
- "--aggressive" | ||
- "--experimental" | ||
|
||
- repo: "https://github.com/PyCQA/flake8" | ||
rev: "6.1.0" | ||
hooks: | ||
- id: "flake8" | ||
name: "flake8" | ||
types: | ||
- "python" | ||
|
||
- repo: "https://github.com/pylint-dev/pylint" | ||
rev: "v3.0.3" | ||
hooks: | ||
- id: "pylint" | ||
name: "pylint" | ||
types: | ||
- "python" | ||
additional_dependencies: | ||
- "pytest" | ||
- "requests" | ||
- "sphinx" | ||
# TODO: remove args | ||
args: | ||
# C0103: Constant name "pdf_doc_base" doesn't conform to UPPER_CASE naming style (invalid-name) | ||
- "--disable=invalid-name" | ||
# C0114: Missing module docstring (missing-module-docstring) | ||
- "--disable=missing-module-docstring" | ||
# C0116: Missing function or method docstring (missing-function-docstring) | ||
- "--disable=missing-function-docstring" | ||
# C0209: Formatting a regular string which could be an f-string (consider-using-f-string) | ||
- "--disable=consider-using-f-string" | ||
# E1101: Instance of '<class>' has no '<member>' member (no-member) | ||
- "--disable=no-member" | ||
# W0621: Redefining name 'session' from outer scope (line 55) (redefined-outer-name) | ||
- "--disable=redefined-outer-name" | ||
# W0622: Redefining built-in 'copyright' (redefined-builtin) | ||
- "--disable=redefined-builtin" | ||
|
||
- repo: "https://github.com/hadolint/hadolint" | ||
rev: "v2.12.0" | ||
hooks: | ||
- id: "hadolint" | ||
name: "Lint Dockerfiles" | ||
types: | ||
- "dockerfile" | ||
args: | ||
- "--no-color" | ||
- "--strict-labels" | ||
# DL3050 info: Superfluous label(s) present. | ||
- "--ignore=DL3050" | ||
|
||
- repo: "https://gitlab.com/univention/pre-commit-hooks/docker-compose-check" | ||
rev: "7702a8801a158b8595569dd29e2dd655d8a08310" | ||
hooks: | ||
- id: "docker-compose-check" | ||
name: "Validate docker-compose files (python)" | ||
types: | ||
- "yaml" | ||
|
||
# Cloned from github.com/IamTheFij/docker-pre-commit | ||
- repo: "https://gitlab.com/univention/pre-commit-hooks/docker-pre-commit" | ||
rev: "v3.0.1" | ||
hooks: | ||
- id: "docker-compose-check" | ||
name: "Validate docker compose files (bash)" | ||
types: | ||
- "yaml" | ||
|
||
- repo: "https://gitlab.com/univention/pre-commit-hooks/pre-commit-shell" | ||
rev: "v1.0.6+uv1" | ||
hooks: | ||
- id: "shell-lint" | ||
name: "Shell Syntax Check" | ||
types: | ||
- "shell" | ||
args: | ||
- "--enable=all" | ||
- "--external-sources" | ||
# SC2250 (style): Prefer putting braces around variable references even when not strictly required. | ||
- "--exclude=SC2250" | ||
|
||
- repo: "https://github.com/gruntwork-io/pre-commit" | ||
rev: "v0.1.23" | ||
hooks: | ||
- id: "helmlint" | ||
name: "helmlint" | ||
|
||
- repo: "https://github.com/norwoodj/helm-docs" | ||
rev: "v1.12.0" | ||
hooks: | ||
- id: "helm-docs" | ||
name: "Helm Docs" | ||
args: | ||
- "--chart-search-root=helm" | ||
- "--template-files=README.md.gotmpl" | ||
always_run: true | ||
|
||
# Uses `GITLAB_SERVER`, `GITLAB_PROJECT_ID` and `GITLAB_PRIVATE_TOKEN` | ||
- repo: "https://gitlab.com/univention/pre-commit-hooks/gitlab-ci-linter" | ||
rev: "v1.0.6+uv2" | ||
hooks: | ||
- id: "gitlab-ci-linter" | ||
name: ".gitlab-ci.yml linter" | ||
stages: | ||
- "manual" | ||
|
||
... |
Oops, something went wrong.