-
Notifications
You must be signed in to change notification settings - Fork 3
23 lines (22 loc) · 963 Bytes
/
format.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
name: Black
on: [push]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install isort>=5.10 black>=22.1
- name: Format
# Both isort and black have a --check option, but to get the imports sorted and formatted correctly,
# I need to run isort _and then_ black, _and then_ check for differences.
run: |
find generative/ tests/ tools/ -name '*.py' -and -not -path '*geom2graph*' -exec isort {} +
find generative/ tests/ tools/ -name '*.py' -and -not -path '*geom2graph*' -exec black --line-length 100 {} +
git diff --exit-code