From b76e6b83990c5870813806cc4a1c459216e258ce Mon Sep 17 00:00:00 2001 From: Julien Moura Date: Thu, 5 Sep 2024 19:25:46 +0200 Subject: [PATCH 1/2] update(tooling): exclude extended Python related files and folders --- .gitignore | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e30755a..3467369 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,13 @@ -__pycache__ -.pyc \ No newline at end of file +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class From 896697e1c99b7d511791a17002dc9c8008894d55 Mon Sep 17 00:00:00 2001 From: Julien Moura Date: Thu, 5 Sep 2024 19:26:17 +0200 Subject: [PATCH 2/2] update(tooling): add git hooks through pre-commit config and contributing guidelines --- .pre-commit-config.yaml | 68 +++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 12 ++++++++ 2 files changed, 80 insertions(+) create mode 100644 .pre-commit-config.yaml create mode 100644 CONTRIBUTING.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..bc91912 --- /dev/null +++ b/.pre-commit-config.yaml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..6197ebf --- /dev/null +++ b/CONTRIBUTING.md @@ -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`. +