mirror of
https://github.com/agateau/pixelwheels.git
synced 2025-10-05 17:32:39 +02:00
Setup pre-commit
This commit is contained in:
14
.markdownlint.yml
Normal file
14
.markdownlint.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
default: true
|
||||||
|
ul-indent:
|
||||||
|
indent: 4
|
||||||
|
|
||||||
|
fenced-code-language: false
|
||||||
|
|
||||||
|
line_length: false
|
||||||
|
first-line-h1: false
|
||||||
|
no-trailing-punctuation: false
|
||||||
|
no-inline-html: false
|
||||||
|
commands-show-output: false
|
||||||
|
|
||||||
|
# Changelog files are full of duplicate headers
|
||||||
|
no-duplicate-header: false
|
43
.pre-commit-config.yaml
Normal file
43
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# See https://pre-commit.com for more information
|
||||||
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.4.0
|
||||||
|
hooks:
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: check-yaml
|
||||||
|
- id: check-added-large-files
|
||||||
|
|
||||||
|
# Markdown
|
||||||
|
- repo: https://github.com/igorshubovych/markdownlint-cli
|
||||||
|
rev: v0.32.2
|
||||||
|
hooks:
|
||||||
|
- id: markdownlint-fix
|
||||||
|
args: [--ignore, "fastlane"]
|
||||||
|
|
||||||
|
# Python
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 23.3.0
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
- repo: https://github.com/PyCQA/isort
|
||||||
|
rev: 5.12.0
|
||||||
|
hooks:
|
||||||
|
- id: isort
|
||||||
|
args: [--profile, black]
|
||||||
|
|
||||||
|
# Java
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: codingstyle
|
||||||
|
name: codingstyle
|
||||||
|
entry: tools/apply-codingstyle
|
||||||
|
language: script
|
||||||
|
files: \.java$
|
||||||
|
|
||||||
|
# Check GitHub workflows
|
||||||
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||||
|
rev: 0.23.1
|
||||||
|
hooks:
|
||||||
|
- id: check-github-workflows
|
@@ -25,7 +25,7 @@ usage() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: $PROGNAME [OPTION ...]
|
Usage: $PROGNAME [OPTION ...] [FILES]
|
||||||
Apply coding style.
|
Apply coding style.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@@ -37,6 +37,7 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
check=0
|
check=0
|
||||||
|
files=""
|
||||||
while [ $# -gt 0 ] ; do
|
while [ $# -gt 0 ] ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help)
|
-h|--help)
|
||||||
@@ -49,7 +50,7 @@ while [ $# -gt 0 ] ; do
|
|||||||
usage "Unknown option '$1'"
|
usage "Unknown option '$1'"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "Too many arguments"
|
files="$files $1"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
@@ -59,7 +60,10 @@ download_formatter
|
|||||||
|
|
||||||
cd $(dirname $0)/..
|
cd $(dirname $0)/..
|
||||||
|
|
||||||
create_file_list /tmp/files.lst
|
if [ -z "$files" ] ; then
|
||||||
|
create_file_list /tmp/files.lst
|
||||||
|
files=@/tmp/files.lst
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $check -eq 1 ] ; then
|
if [ $check -eq 1 ] ; then
|
||||||
args="--dry-run --set-exit-if-changed"
|
args="--dry-run --set-exit-if-changed"
|
||||||
@@ -69,6 +73,6 @@ else
|
|||||||
echo "Applying coding style..."
|
echo "Applying coding style..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
java -jar "$FORMATTER_JAR" $DEFAULT_ARGS $args @/tmp/files.lst
|
java -jar "$FORMATTER_JAR" $DEFAULT_ARGS $args $files
|
||||||
|
|
||||||
# vim:set ts=4 sw=4 et:
|
# vim:set ts=4 sw=4 et:
|
||||||
|
Reference in New Issue
Block a user