Skip to content

Commit 7197b1c

Browse files
authored
Merge pull request #24 from febus982/add_ruff_lint
Add ruff lint
2 parents cab3914 + 9211ddc commit 7197b1c

37 files changed

+197
-120
lines changed

.github/workflows/python-3.10.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ jobs:
2828
- name: Test with pytest
2929
run: |
3030
pytest
31+
- name: Check typing
32+
run: |
33+
mypy

.github/workflows/python-3.11.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ jobs:
2828
- name: Test with pytest
2929
run: |
3030
pytest
31+
- name: Check typing
32+
run: |
33+
mypy

.github/workflows/python-3.8.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ jobs:
2828
- name: Test with pytest
2929
run: |
3030
pytest
31+
- name: Check typing
32+
run: |
33+
mypy

.github/workflows/python-3.9.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ jobs:
2828
- name: Test with pytest
2929
run: |
3030
pytest
31+
- name: Check typing
32+
run: |
33+
mypy
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python code style
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
quality:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python 3.11
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: "3.11"
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install poetry
26+
poetry config virtualenvs.create false
27+
poetry install --no-root --with http,grpc,dev
28+
- name: Check code style with black
29+
run: |
30+
black --check sqlalchemy_bind_manager tests

.github/workflows/python-lint.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+
name: Python lint
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
quality:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Set up Python 3.11
19+
uses: actions/setup-python@v3
20+
with:
21+
python-version: "3.11"
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install poetry
26+
poetry config virtualenvs.create false
27+
poetry install --no-root --with http,grpc,dev
28+
- name: Lint with ruff
29+
uses: chartboost/ruff-action@v1

.github/workflows/python-quality.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,16 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v3
18-
- name: Set up Python 3.10
18+
- name: Set up Python 3.11
1919
uses: actions/setup-python@v3
2020
with:
21-
python-version: "3.10"
21+
python-version: "3.11"
2222
- name: Install dependencies
2323
run: |
2424
python -m pip install --upgrade pip
2525
python -m pip install poetry
2626
poetry config virtualenvs.create false
2727
poetry install --no-root --with dev
28-
- name: Check typing
29-
run: |
30-
mypy sqlalchemy_bind_manager
31-
- name: Lint with black
32-
run: |
33-
# stop the build if code style check fails
34-
black --check sqlalchemy_bind_manager tests
35-
- name: Lint with flake8
36-
run: |
37-
# stop the build if there are Python syntax errors or undefined names
38-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
39-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
40-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
4128
- name: Test & publish code coverage
4229
uses: paambaati/[email protected]
4330
env:

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ mypy:
66

77
format:
88
poetry run black sqlalchemy_bind_manager tests
9+
10+
lint:
11+
poetry run ruff . --fix

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[![Test Coverage](https://api.codeclimate.com/v1/badges/0140f7f4e559ae806887/test_coverage)](https://codeclimate.com/github/febus982/sqlalchemy-bind-manager/test_coverage)
1212
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
1313
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
14+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
1415

1516
This package provides an easy way to configure and use SQLAlchemy engines and sessions
1617
without depending on frameworks.

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ optional = true
4848
aiosqlite = "~0.18.0"
4949
coverage = "~6.5.0"
5050
black = "~22.10.0"
51-
flake8 = "~5.0.4"
5251
mypy = "~0.990"
5352
pytest = "~7.2.0"
5453
pytest-asyncio = "~0.20.3"
5554
pytest-cov = "~4.0.0"
5655
pytest-factoryboy = "~2.5.0"
5756
pytest-xdist = "~3.0.2"
57+
ruff = "~0.0.263"
5858

5959
[tool.pytest.ini_options]
6060
asyncio_mode = "auto"
@@ -66,3 +66,9 @@ testpaths = [
6666

6767
[tool.mypy]
6868
files = "sqlalchemy_bind_manager"
69+
70+
[tool.ruff]
71+
select = ["E", "F", "I"]
72+
73+
[tool.ruff.per-file-ignores]
74+
"__init__.py" = ["F401"]

0 commit comments

Comments
 (0)