WIP Add CI #1
33
backend/.woodpecker/.lint.yaml
Normal file
33
backend/.woodpecker/.lint.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
when:
|
||||
- event: pull_request
|
||||
branch:
|
||||
exclude: [master, release/*]
|
||||
|
||||
steps:
|
||||
- name: prepare
|
||||
image: python:3.12-alpine
|
||||
commands: |
|
||||
cd ./backend
|
||||
python3 -m venv local
|
||||
wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s latest -b ./local/bin/
|
||||
source ./local/bin/activate
|
||||
pip install poetry
|
||||
poetry install --only=linters --no-root
|
||||
|
||||
- name: ruff
|
||||
image: python:3.12-alpine
|
||||
failure: ignore
|
||||
secrets: ["reviewdog_gitea_api_token", "gitea_address"]
|
||||
commands: |
|
||||
cd ./backend
|
||||
source ./local/bin/activate
|
||||
poetry run ruff --output-format sarif . | ./local/bin/reviewdog -f sarif -reporter gitea-pr-review -filter-mode nofilter
|
||||
|
||||
- name: mypy
|
||||
image: python:3.12-alpine
|
||||
failure: ignore
|
||||
secrets: ["reviewdog_gitea_api_token", "gitea_address"]
|
||||
commands: |
|
||||
cd ./backend
|
||||
source ./local/bin/activate
|
||||
poetry run mypy --no-incremental . | ./local/bin/reviewdog -f mypy -reporter gitea-pr-review -filter-mode nofilter
|
@@ -35,6 +35,26 @@ if TYPE_CHECKING:
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
# import cProfile
|
||||
# import io
|
||||
# import pstats
|
||||
# import contextlib
|
||||
|
||||
|
||||
# @contextlib.contextmanager
|
||||
# def profiled():
|
||||
# pr = cProfile.Profile()
|
||||
# pr.enable()
|
||||
# yield
|
||||
# pr.disable()
|
||||
# s = io.StringIO()
|
||||
# ps = pstats.Stats(pr, stream=s).sort_stats("cumulative")
|
||||
# ps.print_stats()
|
||||
# # uncomment this to see who's calling what
|
||||
# # ps.print_callers()
|
||||
# print(s.getvalue())
|
||||
|
||||
|
||||
class StopAreaStopAssociations(Base):
|
||||
|
||||
id = mapped_column(BigInteger, primary_key=True)
|
||||
|
@@ -18,13 +18,14 @@ from api.routers import line, stop
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
|
||||
async def lifespan(app: FastAPI):
|
||||
async def lifespan(app: FastAPI) -> None:
|
||||
Adrien
commented
🚫 [mypy] reported by reviewdog 🐶 🚫 **[mypy]** <sub>reported by [reviewdog](https://github.com/reviewdog/reviewdog) :dog:</sub><br>The return type of an async generator function should be "AsyncGenerator" or one of its supertypes [misc]
|
||||
FastAPICache.init(redis_backend, prefix="api", enable=settings.cache.enable)
|
||||
|
||||
await db.connect(settings.db, settings.clear_static_data)
|
||||
if settings.clear_static_data:
|
||||
await idfm_interface.startup()
|
||||
|
||||
print("OK")
|
||||
yield
|
||||
|
||||
await db.disconnect()
|
||||
|
@@ -24,6 +24,7 @@ psycopg = "^3.1.9"
|
||||
pyyaml = "^6.0"
|
||||
fastapi-cache2 = {extras = ["redis"], version = "^0.2.1"}
|
||||
pydantic-settings = "^2.0.3"
|
||||
ruff = "^0.2.1"
|
||||
|
||||
[tool.poetry.group.db_updater.dependencies]
|
||||
aiofiles = "^22.1.0"
|
||||
@@ -52,28 +53,36 @@ build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
pylsp-mypy = "^0.6.2"
|
||||
mccabe = "^0.7.0"
|
||||
rope = "^1.3.0"
|
||||
python-lsp-black = "^1.2.1"
|
||||
black = "^22.10.0"
|
||||
types-aiofiles = "^22.1.0.2"
|
||||
wrapt = "^1.14.1"
|
||||
pydocstyle = "^6.2.2"
|
||||
dill = "^0.3.6"
|
||||
python-lsp-ruff = "^1.0.5"
|
||||
python-lsp-server = "^1.7.1"
|
||||
autopep8 = "^2.0.1"
|
||||
pyflakes = "^3.0.1"
|
||||
yapf = "^0.32.0"
|
||||
whatthepatch = "^1.0.4"
|
||||
mypy = "^1.0.0"
|
||||
icecream = "^2.1.3"
|
||||
|
||||
|
||||
|
||||
[tool.poetry.group.linters.dependencies]
|
||||
autopep8 = "^2.0.1"
|
||||
black = "^22.10.0"
|
||||
mccabe = "^0.7.0"
|
||||
mypy = "^1.0.0"
|
||||
pydocstyle = "^6.2.2"
|
||||
pyflakes = "^3.0.1"
|
||||
rope = "^1.3.0"
|
||||
ruff = "^0.2.1"
|
||||
types-aiofiles = "^22.1.0.2"
|
||||
types-sqlalchemy-utils = "^1.0.1"
|
||||
types-pyyaml = "^6.0.12.9"
|
||||
types-tqdm = "^4.65.0.1"
|
||||
whatthepatch = "^1.0.4"
|
||||
yapf = "^0.32.0"
|
||||
sqlalchemy = "^2.0.26"
|
||||
|
||||
[tool.mypy]
|
||||
plugins = "sqlalchemy.ext.mypy.plugin"
|
||||
exclude = ['docker', 'docs']
|
||||
strict = true
|
||||
|
||||
[tool.black]
|
||||
target-version = ['py311']
|
||||
|
Reference in New Issue
Block a user
🚫 [mypy] reported by reviewdog 🐶
Argument 1 to "asynccontextmanager" has incompatible type "CallableAny], None]"; expected "Callable[[Any], AsyncIterator[Never" [arg-type]