Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add precommit config #227

Merged
merged 5 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# files: '^.*\.py|.*\.tpl|.*\.sql|.*\.yaml|.*\.txt|.*\.md$'
exclude: '^.*\.xtf|.*\.xml|.*\.ili'

repos:
# Fix end of files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.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/myint/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.4.2"
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.16.0
hooks:
- id: pyupgrade
args: [--py37-plus]

# Lint files
- repo: https://github.com/pycqa/flake8
rev: "7.1.0"
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
1 change: 0 additions & 1 deletion .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ source_file = i18n/pot/translation.pot
source_lang = en
file_filter = i18n/<lang>/translation.po
type = PO

Loading
Loading