From 55348f8e99c3981df5baabb2e9911ed96036e7be Mon Sep 17 00:00:00 2001 From: xprilion Date: Mon, 27 Apr 2026 15:27:43 +0530 Subject: [PATCH 1/2] Try to add qodana for frontend --- .github/workflows/qodana_code_quality.yml | 43 ++++++++++++++++++----- .pre-commit-config.yaml | 26 ++++++++++++++ Makefile | 14 ++++++++ backend/pyproject.toml | 1 + qodana.yaml => qodana-backend.yaml | 7 ++++ qodana-frontend.yaml | 23 ++++++++++++ 6 files changed, 105 insertions(+), 9 deletions(-) create mode 100644 .pre-commit-config.yaml rename qodana.yaml => qodana-backend.yaml (87%) create mode 100644 qodana-frontend.yaml diff --git a/.github/workflows/qodana_code_quality.yml b/.github/workflows/qodana_code_quality.yml index 99c11c4..a55dfc2 100644 --- a/.github/workflows/qodana_code_quality.yml +++ b/.github/workflows/qodana_code_quality.yml @@ -3,26 +3,51 @@ on: workflow_dispatch: pull_request: push: - branches: # Specify your branches here - - main # The 'main' branch - - 'releases/*' # The release branches + branches: + - main + - 'releases/*' jobs: - qodana: + qodana-backend: + name: Qodana (Backend) runs-on: ubuntu-latest permissions: contents: write pull-requests: write checks: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit - fetch-depth: 0 # a full history is required for pull request analysis - - name: 'Qodana Scan' + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: 'Qodana Scan — Backend (Python)' + uses: JetBrains/qodana-action@v2025.3 + with: + args: --config,qodana-backend.yaml + pr-mode: false + env: + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_BACKEND }} + QODANA_ENDPOINT: 'https://qodana.cloud' + + qodana-frontend: + name: Qodana (Frontend) + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + checks: write + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: 'Qodana Scan — Frontend (JS/TS)' uses: JetBrains/qodana-action@v2025.3 with: + args: --config,qodana-frontend.yaml pr-mode: false env: - QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_765401756 }} + QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_FRONTEND }} QODANA_ENDPOINT: 'https://qodana.cloud' diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d4c6539 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,26 @@ +# Pre-commit hooks for OpenMLR +# Install: make hooks +# Run manually: make hooks-run + +repos: + # ── Backend (Python) ── ruff linter + formatter ── + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.12 + hooks: + - id: ruff + name: ruff lint (backend) + args: [--fix] + files: ^backend/ + - id: ruff-format + name: ruff format (backend) + files: ^backend/ + + # ── Frontend (TypeScript/React) ── eslint ── + - repo: local + hooks: + - id: eslint + name: eslint (frontend) + entry: bash -c 'cd frontend && npx eslint --max-warnings 50 "$@"' -- + language: system + files: ^frontend/src/.*\.(ts|tsx)$ + types: [file] diff --git a/Makefile b/Makefile index a5cb9b8..6b73bd8 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,20 @@ install-backend: ## Install Python backend dependencies install-frontend: ## Install frontend dependencies cd $(FRONTEND) && pnpm install +# ─── Git Hooks ──────────────────────────────────────────── + +.PHONY: hooks +hooks: ## Install pre-commit hooks (ruff + eslint) + cd $(BACKEND) && uv run pre-commit install + +.PHONY: hooks-run +hooks-run: ## Run all pre-commit hooks on entire repo + cd $(BACKEND) && uv run pre-commit run --all-files + +.PHONY: hooks-update +hooks-update: ## Update pre-commit hook versions + cd $(BACKEND) && uv run pre-commit autoupdate + # ─── Development ────────────────────────────────────────── .PHONY: dev diff --git a/backend/pyproject.toml b/backend/pyproject.toml index aebbc44..f6ac4d8 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -67,6 +67,7 @@ dev-dependencies = [ "aiosqlite>=0.20.0", "httpx>=0.28.0", "ruff>=0.8.0", + "pre-commit>=4.0.0", ] [tool.ruff] diff --git a/qodana.yaml b/qodana-backend.yaml similarity index 87% rename from qodana.yaml rename to qodana-backend.yaml index 66eac95..219d4b0 100644 --- a/qodana.yaml +++ b/qodana-backend.yaml @@ -12,3 +12,10 @@ bootstrap: | python3.12 --version 2>/dev/null || python3 --version include: - name: CheckDependencyLicenses +exclude: + - name: All + paths: + - frontend + - site + - assets + - node_modules diff --git a/qodana-frontend.yaml b/qodana-frontend.yaml new file mode 100644 index 0000000..9c9d87c --- /dev/null +++ b/qodana-frontend.yaml @@ -0,0 +1,23 @@ +#################################################################################################################### +# WARNING: Do not store sensitive information in this file, as its contents will be included in the Qodana report. # +#################################################################################################################### + +version: "1.0" +linter: jetbrains/qodana-js:2025.3 +profile: + name: qodana.recommended +bootstrap: | + # Install frontend dependencies so Qodana can resolve TypeScript imports + corepack enable && corepack prepare pnpm@latest --activate + cd frontend && pnpm install --frozen-lockfile +include: + - name: CheckDependencyLicenses +exclude: + - name: All + paths: + - backend + - site + - assets + - node_modules + - frontend/dist + - frontend/node_modules From 0da59f69710f7a3d8396f0e935fe7e9595dab733 Mon Sep 17 00:00:00 2001 From: xprilion Date: Mon, 27 Apr 2026 15:38:44 +0530 Subject: [PATCH 2/2] remove qodana --- .github/workflows/qodana_code_quality.yml | 53 ----------------------- qodana-backend.yaml | 21 --------- qodana-frontend.yaml | 23 ---------- 3 files changed, 97 deletions(-) delete mode 100644 .github/workflows/qodana_code_quality.yml delete mode 100644 qodana-backend.yaml delete mode 100644 qodana-frontend.yaml diff --git a/.github/workflows/qodana_code_quality.yml b/.github/workflows/qodana_code_quality.yml deleted file mode 100644 index a55dfc2..0000000 --- a/.github/workflows/qodana_code_quality.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Qodana -on: - workflow_dispatch: - pull_request: - push: - branches: - - main - - 'releases/*' - -jobs: - qodana-backend: - name: Qodana (Backend) - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - checks: write - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: 'Qodana Scan — Backend (Python)' - uses: JetBrains/qodana-action@v2025.3 - with: - args: --config,qodana-backend.yaml - pr-mode: false - env: - QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_BACKEND }} - QODANA_ENDPOINT: 'https://qodana.cloud' - - qodana-frontend: - name: Qodana (Frontend) - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - checks: write - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: 'Qodana Scan — Frontend (JS/TS)' - uses: JetBrains/qodana-action@v2025.3 - with: - args: --config,qodana-frontend.yaml - pr-mode: false - env: - QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_FRONTEND }} - QODANA_ENDPOINT: 'https://qodana.cloud' diff --git a/qodana-backend.yaml b/qodana-backend.yaml deleted file mode 100644 index 219d4b0..0000000 --- a/qodana-backend.yaml +++ /dev/null @@ -1,21 +0,0 @@ -#################################################################################################################### -# WARNING: Do not store sensitive information in this file, as its contents will be included in the Qodana report. # -#################################################################################################################### - -version: "1.0" -linter: jetbrains/qodana-python-community:2025.3 -projectJDK: "python3.12" -profile: - name: qodana.recommended -bootstrap: | - # Ensure Qodana uses Python 3.12+ for correct type hint inspection (PEP 604, PEP 585) - python3.12 --version 2>/dev/null || python3 --version -include: - - name: CheckDependencyLicenses -exclude: - - name: All - paths: - - frontend - - site - - assets - - node_modules diff --git a/qodana-frontend.yaml b/qodana-frontend.yaml deleted file mode 100644 index 9c9d87c..0000000 --- a/qodana-frontend.yaml +++ /dev/null @@ -1,23 +0,0 @@ -#################################################################################################################### -# WARNING: Do not store sensitive information in this file, as its contents will be included in the Qodana report. # -#################################################################################################################### - -version: "1.0" -linter: jetbrains/qodana-js:2025.3 -profile: - name: qodana.recommended -bootstrap: | - # Install frontend dependencies so Qodana can resolve TypeScript imports - corepack enable && corepack prepare pnpm@latest --activate - cd frontend && pnpm install --frozen-lockfile -include: - - name: CheckDependencyLicenses -exclude: - - name: All - paths: - - backend - - site - - assets - - node_modules - - frontend/dist - - frontend/node_modules