Set up pre-commit hooks to enhance code formatting and linting #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Python Style Check | |
on: | |
pull_request: | |
branches: | |
- dev | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.10' | |
- name: Clean up Python bytecode | |
run: | | |
find . -name "*.pyc" -delete | |
find . -name "__pycache__" -delete | |
find . -name ".pytest_cache" -type d -exec rm -r "{}" + | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8==7.0.0 black==24.2.0 docformatter==1.7.5 | |
- name: Check with Black | |
run: | | |
black --check --line-length 88 --exclude='/neurobench/examples/' . | |
- name: Check with docformatter | |
run: | | |
docformatter --wrap-summaries 88 --wrap-descriptions 88 --pre-summary-newline --exclude /neurobench/examples/ --recursive --blank --black --check . | |
- name: Run Flake8 | |
run: | | |
flake8 --count --ignore=E501,E203,W291,W503,F403,F401 --max-line-length=88 --statistics --show-source --exclude=/neurobench/examples/ . |