Skip to content

Commit

Permalink
Added python script linting
Browse files Browse the repository at this point in the history
  • Loading branch information
palisadoes committed Jan 12, 2025
1 parent 99fd263 commit 6ffca5e
Show file tree
Hide file tree
Showing 11 changed files with 937 additions and 144 deletions.
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]

Check warning on line 1 in .flake8

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

File ignored by default.
ignore = E402,E722,E203,F401,W503
max-line-length = 80
51 changes: 51 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ jobs:
uses: tj-actions/changed-files@v45
with:
files: |
.flake8
.pydocstyle
pyproject.toml
.env*
vitest.config.js
src/App.tsx
Expand Down Expand Up @@ -449,3 +452,51 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_REPOSITORY: ${{ github.repository }}


Python-Compliance:
name: Check Python Code Style
runs-on: ubuntu-latest
needs: [Code-Quality-Checks]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python3 -m venv venv
source venv/bin/activate
python -m pip install --upgrade pip
pip install -r .github/workflows/requirements.txt
- name: Run Black Formatter Check
run: |
black --check .
- name: Run Flake8 Linter
run: |
flake8 --docstring-convention google --ignore E402,E722,E203,F401,W503 .github
- name: Run pydocstyle
run: |
pydocstyle --convention=google --add-ignore=D415,D205 .github
- name: Run docstring compliance check
run: |
source venv/bin/activate
python .github/workflows/scripts/check_docstrings.py --directories .github
14 changes: 14 additions & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#############################################################################

Check warning on line 1 in .github/workflows/requirements.txt

View workflow job for this annotation

GitHub Actions / Performs linting, formatting, type-checking, checking for different source and target branch

File ignored by default.
# DO NOT DELETE
#############################################################################
#
# Required for GitHub Action workflow python checks
#
#############################################################################
#############################################################################

black
pydocstyle
flake8
flake8-docstrings
docstring_parser
Loading

0 comments on commit 6ffca5e

Please sign in to comment.