Skip to content

Commit

Permalink
Merge pull request #11 from Guts/tooling/add-pre-commit
Browse files Browse the repository at this point in the history
Tooling: add git hooks (through pre commit microframework)
  • Loading branch information
kannes authored Sep 24, 2024
2 parents cee42f6 + 282917e commit 1a7fd18
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# IDE
.idea
.pyc
__pycache__

# packaging
zip_build
68 changes: 68 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
exclude: ".venv|tests/dev/|tests/fixtures/"
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
args:
- --maxkb=500
- id: check-case-conflict
- id: check-xml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args:
- --remove
- id: trailing-whitespace
args:
- --markdown-linebreak-ext=md

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.5.0"
hooks:
- id: ruff
args:
- --fix-only
- --target-version=py39

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black
args:
- --target-version=py39

# Disabled until PyQt translation support f-strings
# - repo: https://github.com/asottile/pyupgrade
# rev: v3.15.0
# hooks:
# - id: pyupgrade
# args:
# - "--py39-plus"

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args:
- --profile
- black
- --filter-files

- repo: https://github.com/pycqa/flake8
rev: 7.1.0
hooks:
- id: flake8
additional_dependencies: ["flake8-qgis"]
args:
[
"--config=setup.cfg",
"--select=E9,F63,F7,F82,QGS101,QGS102,QGS103,QGS104,QGS106",
]

ci:
autofix_prs: true
autoupdate_schedule: quarterly
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Contributing Guidelines

First off, thanks for considering to contribute to this project!

These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.

## Git hooks

We use git hooks through [pre-commit](https://pre-commit.com/) to enforce and automatically check some "rules". Please install them (`pre-commit install`) before to push any commit.

See the relevant configuration file: `.pre-commit-config.yaml`.

0 comments on commit 1a7fd18

Please sign in to comment.