Skip to content

Commit

Permalink
Added pre-commit for code quality.
Browse files Browse the repository at this point in the history
  • Loading branch information
elongl committed Jun 3, 2023
1 parent 04d2ec7 commit eaf72be
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[flake8]
ignore =
W503
E203
E501

24 changes: 24 additions & 0 deletions .github/workflows/run-precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run pre-commit hooks
on:
push:
paths:
- '**.py'
workflow_dispatch:

jobs:
code-quality:
runs-on: ubuntu-latest
steps:
uses: actions/checkout@v3

- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.8'

- name: Install dev requirements
run: pip install -r dev-requirements.txt

- name: Run pre-commit hooks
run: pre-commit run --all-files --show-diff-on-failure

23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/psf/black
rev: 22.12.0
hooks:
- id: black

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: [ "--profile", "black" ]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8

- repo: local
hooks:
- id: no_commit
name: Check for NO_COMMIT marker
entry: bash -c "git diff --cached -U0 | (! grep NO_COMMIT)"
language: system
2 changes: 2 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pre-commit

0 comments on commit eaf72be

Please sign in to comment.