Skip to content
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ venv*
LICENSE
install_service.sh
Marzban.code-workspace
.ruff_cache
15 changes: 3 additions & 12 deletions .github/workflows/ruff-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
- name: Run Ruff check
uses: astral-sh/ruff-action@v3
with:
python-version: "3.12"

- name: Install Ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff Format
run: |
ruff check --output-format=github .
args: check --respect-gitignore --config pyproject.toml --output-format=github .
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,5 @@ xray-core
#ignore node-module for dashboard
node_modules/
deadlock-analysis.md

.ruff_cache
16 changes: 7 additions & 9 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,10 @@ async def lifespan(app: FastAPI):
await func(app)
else:
await func()
elif "app" in func.__code__.co_varnames:
func(app)
else:
if "app" in func.__code__.co_varnames:
func(app)
else:
func()
func()
yield

for func in shutdown_functions:
Expand All @@ -51,11 +50,10 @@ async def lifespan(app: FastAPI):
await func(app)
else:
await func()
elif "app" in func.__code__.co_varnames:
func(app)
else:
if "app" in func.__code__.co_varnames:
func(app)
else:
func()
func()


app = FastAPI(
Expand Down Expand Up @@ -102,7 +100,7 @@ def validate_paths():

on_startup(scheduler.start)
on_shutdown(scheduler.shutdown)
on_startup(lambda: logger.info(f"PasarGuard v{__version__}"))
on_startup(lambda: logger.info("PasarGuard v%s", __version__))


@app.exception_handler(RequestValidationError)
Expand Down
Loading