Skip to content

Commit

Permalink
Use Ruff to check python syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
pgiraud committed Aug 12, 2024
1 parent 459068f commit 5f60fbb
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
# Default ruff value
max_line_length = 88

[*.{css,scss,js,jsx,ts,vue,json,yml}]
charset = utf-8
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/python_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check python syntax

on:
push:

jobs:
ruff:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.11"]
steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Set Python Version
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Python Ruff Lint and Format
run: ruff check
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ This project relies on a few frameworks / libraries including:
For the following steps, we assume you use PoWA web in debug mode (for example
by running `./run-powa.py` or using podman dev environment).

### Python syntax

Python syntax must conform to ruff. CI checks new code with ruff.

If not already available, you can create a virtualenv for developpement purpose:

```shell
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
```

You can then do a syntax check by running the following command:

``` shell
ruff check
```

## Requirements

- A recent version of `NodeJS` (16+) and `npm` are required.
Expand Down
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements.txt
ruff --only-binary=ruff

0 comments on commit 5f60fbb

Please sign in to comment.