Skip to content

Commit 958380f

Browse files
Add pre-commit hook / linter (#229)
1 parent 163df2f commit 958380f

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

.github/workflows/lint.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: style
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
format:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: [3.9]
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Set up Python ${{ matrix.python-version }}
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: ${{ matrix.python-version }}
19+
20+
- name: Install packages
21+
run: |
22+
pip install --upgrade pip
23+
pip install -r requirements.txt
24+
25+
- name: Lint
26+
run: pre-commit run --all-files --show-diff-on-failure --color always

.pre-commit-config.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Install pre-commit hooks via
2+
# pre-commit install
3+
4+
repos:
5+
- repo: https://github.com/psf/black
6+
rev: 22.1.0
7+
hooks:
8+
- id: black
9+
10+
- repo: https://github.com/pre-commit/mirrors-prettier
11+
rev: v2.6.0
12+
hooks:
13+
- id: prettier
14+
files: \.(md|yml|yaml)
15+
args: [--prose-wrap=preserve]

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pre-commit>=2.17

0 commit comments

Comments
 (0)