From 6fc1bbdfd179cbd95e07ae7261fd290f76ce186b Mon Sep 17 00:00:00 2001 From: RogerHaase Date: Wed, 13 Nov 2024 13:54:25 -0700 Subject: [PATCH] update development docs with more info about "pre-commit install" --- docs/devel/development.rst | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/devel/development.rst b/docs/devel/development.rst index 363bd4e75..653838a90 100644 --- a/docs/devel/development.rst +++ b/docs/devel/development.rst @@ -107,9 +107,7 @@ add more tools, exercise tools * create local docs:: ./m docs # Windows: m docs -* install the pre-commit hook:: - pre-commit install # pre-commit is used for code linting / auto-format * set options on your favorite editor or IDE - convert tabs to 4 spaces @@ -121,6 +119,29 @@ add more tools, exercise tools * if you want a Python IDE, try https://www.jetbrains.com/pycharm/ Free Community Edition * join #moin-dev IRC channel; ask questions, learn what other developers are doing +install pre-commit hooks +------------------------ +Setup Black and Ruff pre-commit hooks:: + + pre-commit install # pre-commit is used for code linting / auto-format + +Black and Ruff will inspect your changes as part of Git commit processing. If your code +change violates Black's coding standards (a changed line of code is > 120 characters) Black will +update the file and fail the commit. Your repo will have 2 versions of the offending file: +the staged file with your changes and an unstaged version with Black's corrections. + +To fix, unstage the file to merge your channges into Black's version, then restage the +file and rerun commit. + +If Ruff finds an error, it will create an error message and fail the commit. In this case, +unstage the offending file, fix the error, restage the file and rerun commit. + +Note that these same checks are made as part of GitHub push-merge processing. +If there is an error the merge will fail. Fix the error, restage the file, and commit. + +Read more about Black at https://black.readthedocs.io/en/stable/index.html. +Read more about Ruff at https://github.com/astral-sh/ruff?tab=readme-ov-file#ruff. + review configuration options ----------------------------