Skip to content

Commit a4da726

Browse files
committed
Add ruff, bandit and coverage
1 parent b5585a8 commit a4da726

6 files changed

Lines changed: 43 additions & 35 deletions

File tree

.github/workflows/test-suite.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
run: pip install -e .[test]
2727

2828
- name: Tests
29-
run: scripts/test.sh
29+
run: scripts/test
3030

3131
- name: Upload coverage
3232
uses: codecov/codecov-action@v3

pyproject.toml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,17 @@ changelog = "https://fastapi-debug-toolbar.domake.io/changelog/"
6060

6161
[project.optional-dependencies]
6262
test = [
63-
"black",
64-
"codecov",
65-
"flake8",
63+
"bandit",
64+
"coverage",
6665
"httpx",
67-
"isort",
6866
"itsdangerous",
6967
"mypy",
7068
"pytest",
7169
"pytest-asyncio",
72-
"pytest-cov",
7370
"python-multipart",
71+
"ruff",
7472
"SQLAlchemy",
75-
"tortoise-orm >=0.19.0",
76-
"types-setuptools",
73+
"tortoise-orm",
7774
]
7875

7976
doc = [
@@ -92,11 +89,28 @@ packages = ["debug_toolbar"]
9289
[tool.hatch.version]
9390
path = "debug_toolbar/__init__.py"
9491

95-
[tool.isort]
96-
profile = "black"
97-
9892
[tool.mypy]
9993
ignore_missing_imports = true
10094

95+
[tool.ruff.lint]
96+
select = [
97+
"E", # pycodestyle errors
98+
"W", # pycodestyle warnings
99+
"F", # pyflakes
100+
"I", # isort
101+
"C", # flake8-comprehensions
102+
"B", # flake8-bugbear
103+
]
104+
105+
[tool.ruff.lint.flake8-bugbear]
106+
extend-immutable-calls = ["fastapi.Depends"]
107+
108+
[tool.bandit]
109+
skips = ["B101"]
110+
101111
[tool.pytest.ini_options]
112+
addopts = ["--strict-config", "--strict-markers"]
102113
asyncio_mode = "auto"
114+
115+
[tool.coverage.run]
116+
source_pkgs = ["app", "tests"]

scripts/lint

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set -x
5+
6+
ruff debug_toolbar tests scripts
7+
ruff format debug_toolbar tests --check
8+
bandit --configfile pyproject.toml --recursive debug_toolbar
9+
mypy --install-types --non-interactive debug_toolbar tests

scripts/lint.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

scripts/test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
set -e
4+
set -x
5+
6+
scripts/lint
7+
coverage run -m pytest $@
8+
coverage report --show-missing
9+
coverage xml

scripts/test.sh

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)