Skip to content

Commit

Permalink
feat: add GHAs for linting and pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tushar5526 committed Jan 18, 2024
1 parent 57d6910 commit c06ca0d
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Pre-commit

on:
push:
branches:
- main
pull_request:

jobs:
pre-commit:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit hooks
run: pre-commit run --all-files
33 changes: 33 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
repos:
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
name: isort (python)

- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
language_version: python3
exclude: migrations

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
name: flake8
args: [--config, api/.flake8]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-yaml
- id: check-json
- id: check-toml

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.0
hooks:
- id: prettier
exclude: ^(frontend/|CHANGELOG.md)
3 changes: 2 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pytest==7.4.4
pytest-mock==3.12.0
pytest-mock==3.12.0
pre-commit==3.6.0

0 comments on commit c06ca0d

Please sign in to comment.