diff options
author | Joris Roovers <joris.roovers@gmail.com> | 2023-01-11 10:39:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-11 10:39:08 +0100 |
commit | 6f25224c9f31bbff5dbfdeca196673369e24f16f (patch) | |
tree | ecd98a5937b4dc1fa3551cab6f6f81e48e410645 | |
parent | 06323d00be298df0bb30a7aa3457d52c9570a954 (diff) |
Docs: tweak contributing docs (#409)
Mention of autoformat and autofix hatch scripts.
-rw-r--r-- | docs/contributing.md | 15 | ||||
-rw-r--r-- | pyproject.toml | 5 |
2 files changed, 12 insertions, 8 deletions
diff --git a/docs/contributing.md b/docs/contributing.md index c57fc01..3ea323a 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -91,7 +91,7 @@ hatch run test:unit-tests-no-cov # run unit tests without test coverage hatch run qa:install-local # One-time install: install the local gitlint source copy for integration testing hatch run qa:integration-tests # Run integration tests -# Formatting check +# Formatting check (black) hatch run test:format # Run formatting checks # Linting (ruff) @@ -100,14 +100,19 @@ hatch run test:lint # Run Ruff # Project stats hatch run test:stats ``` -## Formatting +## Autoformatting and autofixing We use [black](https://black.readthedocs.io/en/stable/) for code formatting. -To use it, just run black against the code you modified: ```sh -hatch run test:black . # format all python code -hatch run test:black gitlint-core/gitlint/lint.py # format a specific file +hatch run test:autoformat # format all python code +hatch run test:autoformat gitlint-core/gitlint/lint.py # format a specific file +``` + +We use [ruff](https://github.com/charliermarsh/ruff) for linting, it can autofix many of the issue it finds +(although not always perfect). +```sh +hatch run test:autofix # Attempt to fix linting issues ``` ## Documentation diff --git a/pyproject.toml b/pyproject.toml index 6c206ac..406cc3d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,10 +98,9 @@ unit-tests = [ ] u = "unit-tests" unit-tests-no-cov = "pytest -rw -s {args:gitlint-core}" -format = "black --check --diff ." -plint = "pylint gitlint-core/gitlint qa" +format = "black --check --diff {args:.}" lint = "ruff {args:gitlint-core/gitlint qa}" -autoformat = "black ." +autoformat = "black {args:.}" autofix = [ "ruff --fix gitlint-core/gitlint qa", "autoformat", |