Add isort and ruff linter

Both linters are pretty common among modern python code bases.

The isort tool provides stable sorting and grouping, as well as pruning
of unused imports.

Ruff is a modern linter, that is very fast due to being written in rust.
It can detect many common issues in a python codebase.

Removes the pylint dev requirement, since ruff replaces it.
This commit is contained in:
Martin Weinelt 2023-05-23 01:06:14 +02:00
parent 1e17dbaa91
commit b339f53bb4
No known key found for this signature in database
GPG Key ID: 87C1E9888F856759
3 changed files with 17 additions and 5 deletions

View File

@ -70,11 +70,17 @@ jobs:
python-version: ${{ env.DEFAULT_PYTHON }} python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install requirements - name: Install requirements
run: | run: |
pip install pip python3 -m pip install -U pip
pip install -r requirements-dev.txt python3 -m pip install -r requirements-dev.txt
- name: Lint - name: Check black
run: | run: |
python3 -m black frigate --check black --check --diff frigate migrations docker *.py
- name: Check isort
run: |
isort --check --diff frigate migrations docker *.py
- name: Check ruff
run: |
ruff check frigate migrations docker *.py
python_tests: python_tests:
runs-on: ubuntu-latest runs-on: ubuntu-latest

5
pyproject.toml Normal file
View File

@ -0,0 +1,5 @@
[tool.isort]
profile = "black"
[tool.ruff]
ignore = ["E501"]

View File

@ -1,2 +1,3 @@
pylint == 2.17.*
black == 23.3.* black == 23.3.*
isort
ruff