From 3304555ea64e565aa490e1ec62173ac7c1bbefdd Mon Sep 17 00:00:00 2001 From: "Julien M." Date: Thu, 11 Jan 2024 12:38:58 +0100 Subject: [PATCH 1/3] tooling: update git hooks --- .pre-commit-config.yaml | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c86a7fe0..b369c983 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,23 +17,25 @@ repos: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: "v0.1.11" + hooks: + - id: ruff + args: ["--fix-only", "--target-version=py39"] + - repo: https://github.com/psf/black rev: 23.12.1 hooks: - id: black + args: ["--target-version=py39"] - - repo: https://github.com/asottile/pyupgrade - rev: v3.15.0 - hooks: - - id: pyupgrade - args: - - "--py39-plus" - - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.1.9" - hooks: - - id: ruff - args: ["--fix-only"] + # 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 @@ -42,13 +44,13 @@ repos: args: ["--profile", "black", "--filter-files"] - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.0.0 hooks: - id: flake8 language: python files: ^qtribu/.*\.py$ types: [python] - additional_dependencies: ["flake8-qgis<2"] + additional_dependencies: ["flake8-qgis"] args: [ "--config=setup.cfg", From 9bd40e1f080f8a37321e7941da4be7b026523d7e Mon Sep 17 00:00:00 2001 From: "Julien M." Date: Thu, 11 Jan 2024 12:39:25 +0100 Subject: [PATCH 2/3] tooling: update development and tests dependencies --- requirements/development.txt | 5 ++--- requirements/testing.txt | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/requirements/development.txt b/requirements/development.txt index ecb28a61..7977ee54 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -2,8 +2,7 @@ # ----------------------- black -flake8>=5 flake8-builtins>=1.5 -flake8-isort>=4.0 +flake8-isort>=6 flake8-qgis>=1 -pre-commit>=3,<3.7 +pre-commit>=3,<4 diff --git a/requirements/testing.txt b/requirements/testing.txt index bc236104..01a1b35f 100644 --- a/requirements/testing.txt +++ b/requirements/testing.txt @@ -1,5 +1,5 @@ # Testing dependencies # -------------------- -pytest-cov>=2.11,<4.2 +pytest-cov>=4.1 semver>=2.13,<2.14 From 475691cd4cb14cffc92c733ff1d25dc31fc2e8fa Mon Sep 17 00:00:00 2001 From: "Julien M." Date: Thu, 11 Jan 2024 12:40:00 +0100 Subject: [PATCH 3/3] tooling: update VS Code config --- .vscode/settings.json | 54 +++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e8c97be8..2bb14e11 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,34 +1,42 @@ { // Editor "editor.bracketPairColorization.enabled": true, - "editor.codeActionsOnSave": { - "source.organizeImports": true - }, - "editor.formatOnSave": true, "editor.guides.bracketPairs": "active", - "editor.rulers": [ - 88 - ], - "editor.wordWrapColumn": 88, + "editor.formatOnSave": true, "files.associations": { "./requirements/*.txt": "pip-requirements", - "metadata.txt": "ini" + "metadata.txt": "ini", + "**/*.ts": "xml", + "**/*.ui": "xml" }, - // Formatter - "python.formatting.provider": "black", - "python.formatting.blackArgs": [ - "--target-version=py39" - ], - // Linter - "python.linting.enabled": true, - "python.linting.flake8Enabled": true, - "python.linting.flake8Args": [ + // Python + "python.analysis.autoFormatStrings": true, + "python.analysis.typeCheckingMode": "basic", + "python.terminal.activateEnvInCurrentTerminal": true, + "python.terminal.activateEnvironment": true, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + "editor.rulers": [ + 88 + ], + "editor.wordWrapColumn": 88, + }, + // Tests + "python.testing.pytestArgs": [], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + // Extensions + "autoDocstring.docstringFormat": "sphinx", + "autoDocstring.guessTypes": true, + "flake8.args": [ "--config=setup.cfg", "--verbose" ], - "python.linting.pylintEnabled": false, - // Git - "git.enableCommitSigning": true, - // Extensions - "autoDocstring.docstringFormat": "sphinx" + "yaml.schemas": { + "https://json.schemastore.org/github-workflow.json": ".github/workflows/*.yml" + } }