From ae9f6866b7f7fdf3bfddd4be0ff7be5647f96409 Mon Sep 17 00:00:00 2001 From: Arnaud Poncet-Montanges Date: Fri, 15 Nov 2024 11:35:12 +0100 Subject: [PATCH] Create .pre-commit-config.yaml --- .pre-commit-config.yaml | 70 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..1dff8c28 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,70 @@ +# files: '^.*\.py|.*\.tpl|.*\.sql|.*\.yaml|.*\.txt|.*\.md$' +exclude: '^.*\.xtf|.*\.xml|.*\.ili|qgepqwat2ili/bin.*$' + +repos: + # Fix end of files + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: mixed-line-ending + args: + - "--fix=lf" + + # Remove unused imports/variables + - repo: https://github.com/PyCQA/autoflake + rev: v2.3.1 + hooks: + - id: autoflake + args: + - "--in-place" + - "--remove-all-unused-imports" + - "--remove-unused-variable" + + # Sort imports + - repo: https://github.com/pycqa/isort + rev: "5.13.2" + hooks: + - id: isort + args: + - --profile + - black + + # Black formatting + - repo: https://github.com/psf/black + rev: "24.10.0" + hooks: + - id: black + args: ["--line-length=99"] + + # tool to automatically upgrade syntax for newer versions of the language + - repo: https://github.com/asottile/pyupgrade + rev: v3.17.0 + hooks: + - id: pyupgrade + args: [--py37-plus] + + # Lint files + - repo: https://github.com/pycqa/flake8 + rev: "7.1.1" + hooks: + - id: flake8 + args: [ + "--max-line-length=115", + # ignore long comments (E501), as long lines are formatted by black + "--ignore=E501,E203,W503", + ] + +# # Static type-checking with mypy +# - repo: https://github.com/pre-commit/mirrors-mypy +# rev: 'v1.5.1' +# hooks: +# - id: mypy +# additional_dependencies: [types-pytz, types-Deprecated, types-PyYAML, types-requests, types-tabulate, types-jsonschema, django-stubs] +# pass_filenames: false +# entry: bash -c 'mypy -p docker-qgis -p docker-app "$@"' -- + +ci: + autofix_prs: true + autoupdate_schedule: quarterly