Skip to content

Commit 6f10ea6

Browse files
Add linting action and pre-commit config
1 parent 851101c commit 6f10ea6

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

.github/workflows/lint.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Lint
2+
on:
3+
pull_request:
4+
branches:
5+
- "master"
6+
jobs:
7+
black:
8+
runs-on: ubuntu-24.04
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
- name: Set up python
13+
uses: actions/setup-python@v4
14+
with:
15+
python-version: "3.12"
16+
- name: Install and run linter
17+
run: |
18+
pip install black==22.10.0
19+
black --check --verbose --diff --color -S .
20+
isort:
21+
runs-on: ubuntu-24.04
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v3
25+
- name: Set up python
26+
uses: actions/setup-python@v4
27+
with:
28+
python-version: "3.12"
29+
- name: Install and run linter
30+
run: |
31+
pip install isort==5.13.2
32+
isort . --check-only --diff
33+
flake8:
34+
runs-on: ubuntu-24.04
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v3
38+
- name: Set up python
39+
uses: actions/setup-python@v4
40+
with:
41+
python-version: "3.12"
42+
- name: Install and run linter
43+
run: |
44+
pip install flake8==7.1.0 flake8-bugbear
45+
flake8

.pre-commit-config.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: check-added-large-files
11+
- repo: https://github.com/pycqa/isort
12+
rev: 5.13.2
13+
hooks:
14+
- id: isort
15+
- repo: https://github.com/pycqa/flake8
16+
rev: 7.1.0
17+
hooks:
18+
- id: flake8
19+
additional_dependencies:
20+
- flake8-bugbear==24.2.6
21+
- repo: https://github.com/psf/black
22+
rev: 22.10.0
23+
hooks:
24+
- id: black

0 commit comments

Comments
 (0)