From b1c5d7b2768f6c575929a6d9d1c7c6731454f670 Mon Sep 17 00:00:00 2001 From: Adam Parkin Date: Wed, 27 Oct 2021 15:17:57 -0700 Subject: [PATCH] Minor improvements to pre-commit.md Changes to the most recent version of isort, as well as explain better the `types` section. --- docs/configuration/pre-commit.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/configuration/pre-commit.md b/docs/configuration/pre-commit.md index 19362f816..4238483bb 100644 --- a/docs/configuration/pre-commit.md +++ b/docs/configuration/pre-commit.md @@ -7,9 +7,20 @@ isort provides official support for [pre-commit](https://pre-commit.com/). To use isort's official pre-commit integration add the following config: +```yaml + - repo: https://github.com/pycqa/isort + rev: 5.9.3 + hooks: + - id: isort + name: isort (python) ``` + +under the `repos` section of your projects `.pre-commit-config.yaml` file. Optionally if you want to have different hooks +over different file types (ex: python vs cython vs pyi) you can do so with the following config: + +```yaml - repo: https://github.com/pycqa/isort - rev: 5.8.0 + rev: 5.9.3 hooks: - id: isort name: isort (python) @@ -21,8 +32,6 @@ To use isort's official pre-commit integration add the following config: types: [pyi] ``` -under the `repos` section of your projects `.pre-commit-config.yaml` file. - ### seed-isort-config Older versions of isort used a lot of magic to determine import placement, that could easily break when running on CI/CD.