shell-things/.pre-commit-config.yaml

190 lines
5.9 KiB
YAML
Raw Normal View History

# See https://pre-commit.com for more information
# See https://pre-commit.ci for more information
ci:
# Attempts to use networking and fails at name resolution, local hook
# skip: [bundler-audit, pylint, latexmk, exiftool]
# 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
autoupdate_schedule: quarterly
# Override hook language versions from system defaults
default_language_version:
python: pypy3
repos:
# The repo from `pre-commit sample-config`
2023-02-21 16:52:47 +01:00
- repo: https://github.com/pre-commit/pre-commit-hooks
2023-10-09 10:06:55 +02:00
rev: v4.5.0
hooks:
# `pre-commit sample-config` puts these four on top:
# trailing-whitespace, end-of-file-fixer, check-yaml,
# check-added-large-files
- id: trailing-whitespace
# Markdown allows double trailing space for forced line change. The
# hook appears to remove single ones.
args: ["--markdown-linebreak-ext", "md,markdown"]
# 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$
# 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]
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
# These are not from `pre-commit sample-config`
- id: check-case-conflict
#- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
- id: check-toml
- id: check-xml
#- id: debug-statements
- id: destroyed-symlinks
- id: detect-private-key
- id: fix-byte-order-marker
#- id: fix-encoding-pragma
#args: [--remove]
- id: mixed-line-ending
args: [--fix=auto]
- id: pretty-format-json
args:
# Remember also: --no-sort-keys
# ASCII excludes the älphäbet amongst others
2023-10-22 19:39:51 +02:00
[--autofix, --no-ensure-ascii]
#- id: requirements-txt-fixer
# Checks the ci: section on top of the file
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
- id: check-pre-commit-ci-config
# 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
args: [--update-only, --notitle]
# Python type checking
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: "v1.6.0"
# hooks:
# - id: mypy
# - repo: https://github.com/asottile/pyupgrade
# rev: v3.15.0
# hooks:
# - id: pyupgrade
# args: [--py311-plus]
# - repo: https://github.com/asottile/reorder-python-imports
# rev: v3.12.0
# hooks:
# - id: reorder-python-imports
# args: [--py311-plus]
# - repo: https://github.com/asottile/add-trailing-comma
# rev: v3.1.0
# hooks:
# - id: add-trailing-comma
# GitHub Actions etc. configuration validity checking
#- 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
# - 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
# Easierish licensing when attempting reuse compliancy
- repo: https://github.com/fsfe/reuse-tool
2024-01-20 11:37:40 +01:00
rev: v3.0.1
hooks:
- id: reuse
# Code formatters and especially editorconfig should probaly be last to
# ensure nothing breaks the rules.
# prettier, opinionated code formatter
2023-02-21 16:52:47 +01:00
- repo: https://github.com/pre-commit/mirrors-prettier
2023-12-25 11:45:51 +01:00
rev: "v4.0.0-alpha.8"
2023-02-21 16:52:47 +01:00
hooks:
- id: prettier
# These are handled by Black below or pretty-format-json above
exclude_types: [python, pyi, jupyter, json]
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",
]
# Black, opinionated Python code formatter
# - repo: https://github.com/psf/black
# rev: 23.9.1
# hooks:
# - id: black
# args: ["--line-length", "79", "--target-version", "py311"]
#- id: black-jupyter
2023-05-18 10:58:51 +02:00
# Shell code formatter, requires Go
- repo: https://github.com/scop/pre-commit-shfmt
2023-11-29 08:45:31 +01:00
rev: v3.7.0-4
2023-05-18 10:58:51 +02:00
hooks:
- id: shfmt
#- id: shfmt-docker
# .editorconfig validity checking
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
2023-10-13 12:32:48 +02:00
rev: "2.7.3"
hooks:
- id: editorconfig-checker
alias: ec
# I don't actually care about line lengths as more than a guideline
args: [-disable-max-line-length]
# # Python linter
# - repo: local
# hooks:
# - id: pylint
# name: pylint
# # Use as many jobs as CPU cores, disable TODO warnings
# entry: pylint -j 0 -d W0511
# language: system
# types_or: [python, pyi]
# # Checking that LaTeX compiles
# - repo: local
# hooks:
# - id: latexmk
# name: latexmk
# entry: latexmk -quiet
# language: system
# types: [text, tex]
# Fedora: perl-Image-ExifTool
# - repo: local
# hooks:
# - id: exiftool
# name: Remove all EXIF metadata using exiftool
# entry: exiftool -all=
# language: system
# types: [image]