From 6adea37109ee03d6de23b36054e7bad420a20e1a Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Wed, 12 May 2021 18:37:13 +0200
Subject: [PATCH] [enh] #162: Introduce isort pre-commit hook

Use black profile:
https://github.com/PyCQA/isort/issues/1518#issuecomment-703056188
https://pycqa.github.io/isort/docs/configuration/config_files/
https://pycqa.github.io/isort/docs/configuration/profiles/

Add pylint configuration in pyproject.toml

Exclude 'docs' folder check when running:
pre-commit run isort -a
---
 .pre-commit-config.yaml | 6 ++++++
 pyproject.toml          | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index c9e91dcd..651b1e3a 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -3,6 +3,12 @@ repos:
     rev: 21.5b0
     hooks:
     - id: black
+-   repo: https://github.com/PyCQA/isort
+    rev: 5.8.0
+    hooks:
+    - id: isort
+      args: ["--profile", "black"]
+      exclude: ^docs/
 -   repo: https://github.com/pre-commit/mirrors-mypy
     rev: v0.812
     hooks:
diff --git a/pyproject.toml b/pyproject.toml
index 4a2d590f..a81bb69f 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -42,3 +42,7 @@ pylint = "^2.7.2"
 pre-commit = "^2.12.1"
 sphinx = "^3.2.1"
 sphinx_rtd_theme = "^0.5.0"
+
+[tool.isort]
+profile = "black"
+src_paths = ["duniterpy", "tests", "examples"]
-- 
GitLab