Skip to content

Commit 690908c

Browse files
committed
Add isort as a pre-commit hook and as a CI check
1 parent 41606f9 commit 690908c

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

.github/workflows/autoblack.yml renamed to .github/workflows/isort-and-black-checks.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Othewrwise, Black is run and its changes are committed back to the incoming pull request.
44
# https://github.com/cclauss/autoblack
55

6-
name: autoblack
6+
name: isort and black check
77
on: [pull_request]
88
jobs:
99
build:
@@ -14,11 +14,11 @@ jobs:
1414
uses: actions/setup-python@v2
1515
with:
1616
python-version: 3.9
17-
- name: Install click
18-
run: pip install 'click==8.0.4'
19-
- name: Install Black
20-
run: pip install 'black==22.3.0'
21-
- name: Run black --check .
17+
- name: Install click, black and isort
18+
run: pip install 'click==8.0.4' 'black==22.3.0' 'isort==5.10.1'
19+
- name: Run isort --check .
20+
run: isort --check .
21+
- name: Run isort --check .
2222
run: black --check .
2323
- name: If needed, commit black changes to the pull request
2424
if: failure()

.isort.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[settings]
2+
multi_line_output = 3
3+
include_trailing_comma = True
4+
force_grid_wrap = 0
5+
use_parentheses = True
6+
line_length = 88
7+
known_crunch = cr, zz9d, zz9lib, pycrunch, silhouette
8+
sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,CRUNCH,LOCALFOLDER
9+
default_section = THIRDPARTY
10+
combine_as_imports = 1
11+
profile = black

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ repos:
99
stages: [commit]
1010
- id: end-of-file-fixer
1111
stages: [commit]
12+
- repo: https://github.com/pycqa/isort
13+
rev: 5.10.1
14+
hooks:
15+
- id: isort
16+
stages: [commit]
1217
- repo: https://github.com/psf/black
1318
rev: 22.3.0
1419
hooks:

0 commit comments

Comments
 (0)