2023-05-19 19:35:05 +02:00
|
|
|
# See https://pre-commit.com for more information
|
|
|
|
# See https://pre-commit.ci for more information
|
2023-04-12 07:58:19 +02:00
|
|
|
ci:
|
2023-05-18 09:17:01 +02:00
|
|
|
# Attempts to use networking and fails at name resolution, local hook
|
2023-06-04 10:41:12 +02:00
|
|
|
# skip: [bundler-audit, pylint, latexmk, exiftool]
|
2024-06-06 15:30:59 +02:00
|
|
|
skip: [pnpm-prettier]
|
2023-05-09 09:57:01 +02:00
|
|
|
# Forĝejo/Gitea mirrors will autoclose pull requests. This should decrease
|
|
|
|
# the frequency of unnecessary PRs.
|
|
|
|
# https://github.com/pre-commit-ci/issues/issues/83
|
2023-05-09 09:58:31 +02:00
|
|
|
autoupdate_schedule: quarterly
|
2023-04-12 07:58:19 +02:00
|
|
|
|
2023-09-24 10:39:37 +02:00
|
|
|
# Override hook language versions from system defaults
|
|
|
|
default_language_version:
|
2023-09-28 13:36:27 +02:00
|
|
|
python: pypy3
|
2023-09-24 10:39:37 +02:00
|
|
|
|
2023-02-21 15:16:09 +01:00
|
|
|
repos:
|
2023-10-16 08:52:01 +02:00
|
|
|
# The repo from `pre-commit sample-config`
|
2023-02-21 16:52:47 +01:00
|
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
2024-04-10 09:54:24 +02:00
|
|
|
rev: v4.6.0
|
2023-02-21 15:16:09 +01:00
|
|
|
hooks:
|
2023-10-21 07:56:00 +02:00
|
|
|
# `pre-commit sample-config` puts these four on top:
|
|
|
|
# trailing-whitespace, end-of-file-fixer, check-yaml,
|
|
|
|
# check-added-large-files
|
2023-05-07 17:15:16 +02:00
|
|
|
- id: trailing-whitespace
|
2023-10-16 08:06:37 +02:00
|
|
|
# Markdown allows double trailing space for forced line change. The
|
|
|
|
# hook appears to remove single ones.
|
2023-10-16 08:01:54 +02:00
|
|
|
args: ["--markdown-linebreak-ext", "md,markdown"]
|
2023-10-28 16:38:53 +02:00
|
|
|
# Let's not touch LICENSE files or reuse.software directory. Or if we
|
|
|
|
# do, that is a good example case anyway to keep as a comment?
|
|
|
|
#exclude: ^LICENSES\/.*|LICENSE$
|
2023-10-16 08:06:37 +02:00
|
|
|
# Other file extensions where trailing whitespace may be intentional
|
|
|
|
# and lack of it break things. Use identify-cli for figuring out more
|
|
|
|
# types to add.
|
|
|
|
exclude_types: [svg, tsv]
|
2023-10-21 07:56:00 +02:00
|
|
|
- id: end-of-file-fixer
|
2024-06-06 19:19:30 +02:00
|
|
|
exclude: ^etc\/nginx\/.*$
|
2023-10-21 07:56:00 +02:00
|
|
|
- id: check-yaml
|
|
|
|
- id: check-added-large-files
|
|
|
|
# These are not from `pre-commit sample-config`
|
|
|
|
- id: check-case-conflict
|
2023-10-10 09:39:42 +02:00
|
|
|
#- id: check-docstring-first
|
2023-10-23 09:26:43 +02:00
|
|
|
- id: check-executables-have-shebangs
|
2023-10-22 19:35:28 +02:00
|
|
|
- id: check-json
|
2023-10-10 09:39:42 +02:00
|
|
|
- id: check-merge-conflict
|
2023-10-23 09:26:43 +02:00
|
|
|
- id: check-shebang-scripts-are-executable
|
2023-10-10 09:39:42 +02:00
|
|
|
- id: check-toml
|
|
|
|
- id: check-xml
|
|
|
|
#- id: debug-statements
|
2023-10-23 09:26:43 +02:00
|
|
|
- id: destroyed-symlinks
|
|
|
|
- id: detect-private-key
|
|
|
|
- id: fix-byte-order-marker
|
2023-10-10 09:39:42 +02:00
|
|
|
- id: mixed-line-ending
|
2023-10-22 19:35:28 +02:00
|
|
|
args: [--fix=auto]
|
2024-05-19 18:49:46 +02:00
|
|
|
- id: pretty-format-json
|
|
|
|
args:
|
|
|
|
# Remember also: --no-sort-keys
|
|
|
|
# ASCII excludes the älphäbet amongst others
|
|
|
|
[--autofix, --no-ensure-ascii]
|
2023-10-23 09:26:43 +02:00
|
|
|
#- id: requirements-txt-fixer
|
2023-10-16 08:52:01 +02:00
|
|
|
|
2024-02-24 08:39:02 +01:00
|
|
|
# Synchronize dependencies between this file and package managers
|
|
|
|
- repo: https://github.com/pre-commit/sync-pre-commit-deps
|
|
|
|
rev: v0.0.1
|
|
|
|
hooks:
|
|
|
|
- id: sync-pre-commit-deps
|
|
|
|
|
2023-10-16 08:52:01 +02:00
|
|
|
# Checks the ci: section on top of the file
|
2023-09-24 11:03:08 +02:00
|
|
|
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
|
|
|
|
rev: v1.6.1
|
|
|
|
hooks:
|
|
|
|
- id: check-pre-commit-ci-config
|
|
|
|
|
2023-04-05 08:48:06 +02:00
|
|
|
# Markdown Table of Contents generation.
|
|
|
|
- repo: https://github.com/thlorenz/doctoc
|
|
|
|
rev: v2.2.0
|
|
|
|
hooks:
|
|
|
|
- id: doctoc
|
|
|
|
# https://github.com/Mikaela/gist/blob/master/doctoc.txt
|
2023-05-13 08:04:46 +02:00
|
|
|
args: [--update-only, --notitle]
|
2023-04-05 08:48:06 +02:00
|
|
|
|
2023-05-18 09:17:01 +02:00
|
|
|
# Python type checking
|
2023-05-18 09:20:21 +02:00
|
|
|
# - repo: https://github.com/pre-commit/mirrors-mypy
|
2023-10-17 06:46:07 +02:00
|
|
|
# rev: "v1.6.0"
|
2023-05-18 09:20:21 +02:00
|
|
|
# hooks:
|
|
|
|
# - id: mypy
|
2023-10-16 08:52:01 +02:00
|
|
|
|
2023-10-10 09:39:42 +02:00
|
|
|
# - repo: https://github.com/asottile/pyupgrade
|
|
|
|
# rev: v3.15.0
|
|
|
|
# hooks:
|
|
|
|
# - id: pyupgrade
|
2023-10-17 06:46:07 +02:00
|
|
|
# args: [--py311-plus]
|
2023-10-16 08:52:01 +02:00
|
|
|
|
2023-10-10 09:39:42 +02:00
|
|
|
# - repo: https://github.com/asottile/reorder-python-imports
|
|
|
|
# rev: v3.12.0
|
|
|
|
# hooks:
|
|
|
|
# - id: reorder-python-imports
|
2023-10-17 06:46:07 +02:00
|
|
|
# args: [--py311-plus]
|
2023-10-16 08:52:01 +02:00
|
|
|
|
2023-10-10 09:39:42 +02:00
|
|
|
# - repo: https://github.com/asottile/add-trailing-comma
|
|
|
|
# rev: v3.1.0
|
|
|
|
# hooks:
|
|
|
|
# - id: add-trailing-comma
|
2023-10-16 08:52:01 +02:00
|
|
|
|
2023-04-05 08:48:06 +02:00
|
|
|
# GitHub Actions etc. configuration validity checking
|
2023-10-23 09:26:43 +02:00
|
|
|
#- repo: https://github.com/python-jsonschema/check-jsonschema
|
|
|
|
#rev: 0.27.0
|
|
|
|
#hooks:
|
|
|
|
#- id: check-dependabot
|
|
|
|
#- id: check-github-actions
|
|
|
|
#- id: check-github-workflows
|
|
|
|
#- id: check-gitlab-ci
|
2023-04-05 08:48:06 +02:00
|
|
|
|
2023-05-18 09:20:21 +02:00
|
|
|
# - repo: https://github.com/jumanjihouse/pre-commit-hooks
|
|
|
|
# rev: 3.0.0
|
|
|
|
# hooks:
|
|
|
|
# - id: bundler-audit
|
|
|
|
# https://github.com/jumanjihouse/pre-commit-hooks/issues/111
|
|
|
|
#- id: check-mailmap
|
2023-04-09 12:58:35 +02:00
|
|
|
|
2023-04-05 08:48:06 +02:00
|
|
|
# Easierish licensing when attempting reuse compliancy
|
2023-05-21 12:09:30 +02:00
|
|
|
- repo: https://github.com/fsfe/reuse-tool
|
2024-05-30 15:40:31 +02:00
|
|
|
rev: v3.1.0a1
|
2023-05-21 12:09:30 +02:00
|
|
|
hooks:
|
|
|
|
- id: reuse
|
2023-04-05 08:48:06 +02:00
|
|
|
|
2023-10-23 09:26:43 +02:00
|
|
|
# Code formatters and especially editorconfig should probaly be last to
|
|
|
|
# ensure nothing breaks the rules.
|
2023-04-05 08:48:06 +02:00
|
|
|
|
2023-05-18 09:20:21 +02:00
|
|
|
# prettier, opinionated code formatter
|
2024-06-06 15:30:59 +02:00
|
|
|
|
|
|
|
- repo: local
|
2023-02-21 16:52:47 +01:00
|
|
|
hooks:
|
2024-06-06 15:30:59 +02:00
|
|
|
- id: pnpm-prettier
|
|
|
|
name: prettier
|
2024-06-06 16:34:05 +02:00
|
|
|
entry: pnpm exec prettier --cache --ignore-unknown --write
|
2024-06-06 15:30:59 +02:00
|
|
|
language: system
|
|
|
|
exclude_types: [json]
|
|
|
|
|
|
|
|
#- repo: https://github.com/pre-commit/mirrors-prettier
|
|
|
|
# - repo: https://github.com/rbubley/mirrors-prettier
|
|
|
|
# rev: "v3.2.5"
|
|
|
|
# hooks:
|
|
|
|
# - id: prettier
|
|
|
|
# additional_dependencies: [
|
|
|
|
# # https://www.npmjs.com/package/prettier
|
|
|
|
# "prettier@3.2.5",
|
|
|
|
# # https://www.npmjs.com/package/prettier-plugin-nginx
|
|
|
|
# "prettier-plugin-nginx@1.0.3",
|
|
|
|
# # https://www.npmjs.com/package/prettier-plugin-toml
|
|
|
|
# "prettier-plugin-toml@2.0.1",
|
|
|
|
# # https://www.npmjs.com/package/prettier-plugin-sort-json
|
|
|
|
# #"prettier-plugin-sort-json@4.0.0",
|
|
|
|
# ]
|
2023-05-18 09:20:21 +02:00
|
|
|
|
|
|
|
# Black, opinionated Python code formatter
|
|
|
|
# - repo: https://github.com/psf/black
|
2023-10-17 06:46:07 +02:00
|
|
|
# rev: 23.9.1
|
2023-05-18 09:20:21 +02:00
|
|
|
# hooks:
|
|
|
|
# - id: black
|
2023-10-17 06:46:07 +02:00
|
|
|
# args: ["--line-length", "79", "--target-version", "py311"]
|
2023-05-18 09:20:21 +02:00
|
|
|
#- id: black-jupyter
|
2023-04-05 08:48:06 +02:00
|
|
|
|
2023-05-18 10:58:51 +02:00
|
|
|
# Shell code formatter, requires Go
|
|
|
|
- repo: https://github.com/scop/pre-commit-shfmt
|
2024-02-17 17:20:03 +01:00
|
|
|
rev: v3.8.0-1
|
2023-05-18 10:58:51 +02:00
|
|
|
hooks:
|
|
|
|
- id: shfmt
|
|
|
|
#- id: shfmt-docker
|
|
|
|
|
2023-04-05 08:48:06 +02:00
|
|
|
# .editorconfig validity checking
|
2023-02-21 18:28:28 +01:00
|
|
|
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
|
2023-10-13 12:32:48 +02:00
|
|
|
rev: "2.7.3"
|
2023-02-21 17:23:28 +01:00
|
|
|
hooks:
|
2023-02-21 18:28:28 +01:00
|
|
|
- id: editorconfig-checker
|
2023-02-21 17:23:28 +01:00
|
|
|
alias: ec
|
2023-04-04 08:47:06 +02:00
|
|
|
# I don't actually care about line lengths as more than a guideline
|
|
|
|
args: [-disable-max-line-length]
|
2023-05-18 09:17:01 +02:00
|
|
|
|
2023-05-18 09:20:21 +02:00
|
|
|
# # Python linter
|
|
|
|
# - repo: local
|
|
|
|
# hooks:
|
|
|
|
# - id: pylint
|
|
|
|
# name: pylint
|
2023-11-01 07:12:35 +01:00
|
|
|
# # Use as many jobs as CPU cores, disable TODO warnings
|
|
|
|
# entry: pylint -j 0 -d W0511
|
2023-05-18 09:20:21 +02:00
|
|
|
# language: system
|
|
|
|
# types_or: [python, pyi]
|
2023-05-20 12:15:16 +02:00
|
|
|
|
|
|
|
# # Checking that LaTeX compiles
|
|
|
|
# - repo: local
|
|
|
|
# hooks:
|
|
|
|
# - id: latexmk
|
|
|
|
# name: latexmk
|
|
|
|
# entry: latexmk -quiet
|
|
|
|
# language: system
|
|
|
|
# types: [text, tex]
|
2023-06-04 10:41:12 +02:00
|
|
|
|
|
|
|
# Fedora: perl-Image-ExifTool
|
|
|
|
# - repo: local
|
|
|
|
# hooks:
|
|
|
|
# - id: exiftool
|
|
|
|
# name: Remove all EXIF metadata using exiftool
|
|
|
|
# entry: exiftool -all=
|
|
|
|
# language: system
|
|
|
|
# types: [image]
|