From fffd7ff33d42a22b10d20f0c5a516a7153b0aefb Mon Sep 17 00:00:00 2001 From: TShapinsky Date: Tue, 6 Jun 2023 13:03:42 -0600 Subject: [PATCH 1/3] remove --check flags from pre-commit config --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b24123b7a..ec525039e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,12 +3,12 @@ repos: rev: 5.12.0 hooks: - id: isort - entry: poetry run isort --check + entry: poetry run isort - repo: https://github.com/psf/black rev: 22.3.0 hooks: - id: black - entry: poetry run black --check + entry: poetry run black - repo: https://github.com/pycqa/flake8 rev: 5.0.0 hooks: From fd5de47dc8a350f4141f2fcdba35b0b3fff363c0 Mon Sep 17 00:00:00 2001 From: TShapinsky Date: Tue, 6 Jun 2023 13:07:10 -0600 Subject: [PATCH 2/3] update developer documentation --- docs/reference/developer_documentation.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/reference/developer_documentation.md b/docs/reference/developer_documentation.md index b8d9a0b06..7243cf24d 100644 --- a/docs/reference/developer_documentation.md +++ b/docs/reference/developer_documentation.md @@ -52,17 +52,17 @@ The CI process for developers' local clones and the remote repository should be ### Local -Local CI is done automatically when pushing with `.pre-commit-config.yaml`, which runs *static* tests that can be run manually with the following command. +Local CI is done automatically when pushing with `.pre-commit-config.yaml`, which runs *static* tests that can be run manually with the following command. This command will also generate fixes to formatting errors in staged files. After running you will need to stage the fixes for these files before running again. ``` pre-commit run -a ``` Pre-commit commands can be run individually with the following commands. Configuration of `isort`, `black`, and `mypy` are done in [pyproject.toml](https://github.com/NREL/BuildingMOTIF/blob/develop/pyproject.toml) and configuration of `flake8` is done in [.flake8](https://github.com/NREL/BuildingMOTIF/blob/develop/.flake8). ``` -poetry run isort --check -poetry run black --check +poetry run isort +poetry run black poetry run flake8 buildingmotif -poetry run mypy +poetry run mypy --install-types --non-interactive --ignore-missing-imports ``` The above does not include *dynamic* testing (unit and integration), which can be run manually with the following command. To run tests with DEBUG prints add the `-o log_cli=true` argument to the command From 6df2a095afd36825a06fc375f2d6524cdeead725 Mon Sep 17 00:00:00 2001 From: TShapinsky Date: Tue, 13 Jun 2023 10:21:54 -0600 Subject: [PATCH 3/3] clarify pre-commit documentation --- docs/reference/developer_documentation.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/reference/developer_documentation.md b/docs/reference/developer_documentation.md index 7243cf24d..90df8f2fa 100644 --- a/docs/reference/developer_documentation.md +++ b/docs/reference/developer_documentation.md @@ -52,7 +52,10 @@ The CI process for developers' local clones and the remote repository should be ### Local -Local CI is done automatically when pushing with `.pre-commit-config.yaml`, which runs *static* tests that can be run manually with the following command. This command will also generate fixes to formatting errors in staged files. After running you will need to stage the fixes for these files before running again. +Local CI is done automatically when comitting with `.pre-commit-config.yaml`, which runs *static* tests against staged files and generates fixes as possible. If the pre-commit checks fail the generated fixes can be inspected and staged as desired before attempting to commit again. + + +The command below will test files and generate fixes to formatting errors in files (running without `-a` will only fix staged files) without generating a commit upon successful completion. ``` pre-commit run -a ```