From cde14ac9dd0ddec5f9859a86cc342b39219ba6f6 Mon Sep 17 00:00:00 2001 From: ckunki Date: Wed, 17 Apr 2024 10:13:14 +0200 Subject: [PATCH 1/4] Added pre-commit hook --- .pre-commit-config.yaml | 37 ++++++++++++++++++++++++++++++++++++ doc/changes/changes_0.1.0.md | 4 ++++ 2 files changed, 41 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 0000000..7214984 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,37 @@ +default_stages: [ commit ] +repos: + + - repo: local + hooks: + - id: code-format + name: code-format + types: [ python ] + files: "pyproject.toml" + pass_filenames: false + language: system + entry: poetry run nox -s fix + + - repo: local + hooks: + - id: type-check + name: type-check + types: [ python ] + pass_filenames: false + language: system + entry: poetry run nox -s type-check + + - repo: local + hooks: + - id: lint + name: lint + types: [ python ] + pass_filenames: false + language: system + entry: poetry run nox -s lint + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace diff --git a/doc/changes/changes_0.1.0.md b/doc/changes/changes_0.1.0.md index 5207b20..e2322d2 100644 --- a/doc/changes/changes_0.1.0.md +++ b/doc/changes/changes_0.1.0.md @@ -7,3 +7,7 @@ This is the initial release of the Exasol SaaS API for Python enabling Python ap ## Changes n/a + +## Refactoring + +* #10: Add pre-commit hook From eefe895bebdf400d866a183538d0e9a82971418f Mon Sep 17 00:00:00 2001 From: ckunki Date: Wed, 17 Apr 2024 15:09:32 +0200 Subject: [PATCH 2/4] Added hook to generate API --- .pre-commit-config.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7214984..52221e6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,15 @@ repos: language: system entry: poetry run nox -s lint + - repo: local + hooks: + - id: generate-api + name: generate-api + types: [ python ] + pass_filenames: false + language: system + entry: poetry run nox -s generate-api + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: From 8001ce2de13855a72413b4ab7d097faaf947d02e Mon Sep 17 00:00:00 2001 From: ckunki Date: Thu, 18 Apr 2024 08:32:47 +0200 Subject: [PATCH 3/4] Added developer guide section on pre-commit hooks --- doc/developer_guide/developer_guide.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 doc/developer_guide/developer_guide.md diff --git a/doc/developer_guide/developer_guide.md b/doc/developer_guide/developer_guide.md new file mode 100644 index 0000000..0154e3e --- /dev/null +++ b/doc/developer_guide/developer_guide.md @@ -0,0 +1,14 @@ +# SaaS API for Python — Developer Guide + +## Git Pre-Commit Hooks + +saas-api-python includes a file `.pre-commit-config.yaml`. + +The following command installs the pre-commit hooks, see also [framework pre-commmit](https://pre-commit.com/) and Git +documentation on [Customizing Git Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks): + +```shell +poetry run pre-commit install +``` + +When the hooks are installed, then git will run each of the hooks on the resp. stage, e.g. before executing a commit. From a6e30c1e9c8ae151f6f0775927065684ef53be82 Mon Sep 17 00:00:00 2001 From: ckunki Date: Thu, 18 Apr 2024 11:55:22 +0200 Subject: [PATCH 4/4] Added openapi to linter ignore --- pyproject.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 2076eb8..524f3dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -75,6 +75,10 @@ ignore = [ "version.py", "noxconfig.py", ] +ignore-paths = [ + ".*/exasol/saas/client/openapi/.*", +] + [[tool.mypy.overrides]] module = [