Skip to content

Commit 577c82d

Browse files
authored
Merge pull request #7 from elementary-data/ele-997-add-pre-commit-to-github-action
Ele 997 add pre commit to GitHub action
2 parents c89e48a + 29470aa commit 577c82d

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

.flake8

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[flake8]
2+
ignore =
3+
W503
4+
E203
5+
E501
6+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Run pre-commit hooks
2+
on:
3+
push:
4+
paths:
5+
- '**.py'
6+
workflow_dispatch:
7+
8+
jobs:
9+
code-quality:
10+
runs-on: ubuntu-latest
11+
steps:
12+
uses: actions/checkout@v3
13+
14+
- name: Set up Python
15+
uses: actions/setup-python@v4.3.0
16+
with:
17+
python-version: '3.8'
18+
19+
- name: Install dev requirements
20+
run: pip install -r dev-requirements.txt
21+
22+
- name: Run pre-commit hooks
23+
run: pre-commit run --all-files --show-diff-on-failure
24+

.pre-commit-config.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 22.12.0
4+
hooks:
5+
- id: black
6+
7+
- repo: https://github.com/pycqa/isort
8+
rev: 5.12.0
9+
hooks:
10+
- id: isort
11+
args: [ "--profile", "black" ]
12+
13+
- repo: https://github.com/pycqa/flake8
14+
rev: 6.0.0
15+
hooks:
16+
- id: flake8
17+
18+
- repo: local
19+
hooks:
20+
- id: no_commit
21+
name: Check for NO_COMMIT marker
22+
entry: bash -c "git diff --cached -U0 | (! grep NO_COMMIT)"
23+
language: system

dev-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pre-commit
2+

0 commit comments

Comments
 (0)