Files
comet-ml--opik/.pre-commit-config.yaml
wehub-resource-sync 5a558eb09e
Backend Tests / discover-tests (push) Waiting to run
Backend Tests / ${{ matrix.name }} (push) Blocked by required conditions
Build and Publish SDK / build-and-publish (push) Waiting to run
Build Opik Docker Images / set-version (push) Waiting to run
Build Opik Docker Images / build-backend (push) Blocked by required conditions
Build Opik Docker Images / build-sandbox-executor-python (push) Blocked by required conditions
Build Opik Docker Images / build-python-backend (push) Blocked by required conditions
Build Opik Docker Images / build-frontend (push) Blocked by required conditions
Build Opik Docker Images / create-git-tag (push) Blocked by required conditions
ClickHouse Migration Cluster Check / validate-clickhouse-migrations (push) Waiting to run
🐙 Code Quality / detect (push) Waiting to run
🐙 Code Quality / lint (${{ matrix.leg.name }}) (push) Blocked by required conditions
🐙 Code Quality / summary (push) Blocked by required conditions
Docs - Publish / run (push) Waiting to run
E2E Tests - Post Merge (v2) / 🧪 E2E v2 Tests (${{ github.event.inputs.tier || 't1' }}) (push) Waiting to run
E2E Tests - Post Merge (v2) / 📢 Slack Notification (push) Blocked by required conditions
Frontend Unit Tests / Test on Node 20 (push) Waiting to run
Guardrails E2E Tests / Select Python version matrix (push) Waiting to run
Guardrails E2E Tests / Guardrails E2E Tests ${{matrix.python_version}} (push) Blocked by required conditions
Guardrails E2E Tests / 📢 Slack Notification (push) Blocked by required conditions
Guardrails Backend Unit Tests / Guardrails Backend Unit Tests (push) Waiting to run
Guardrails Backend Unit Tests / 📢 Slack Notification (push) Blocked by required conditions
SDK Library Integration Tests Runner / Check Secrets (push) Waiting to run
SDK Library Integration Tests Runner / Missed OpenAI API Key Warning (push) Blocked by required conditions
SDK Library Integration Tests Runner / Build (push) Blocked by required conditions
SDK Library Integration Tests Runner / openai_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / langchain_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / langchain_legacy_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / llama_index_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / anthropic_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / mistral_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / groq_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / aisuite_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / haystack_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / dspy_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / crewai_v0_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / crewai_v1_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / genai_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / adk_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / adk_legacy_1_3_0_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / evaluation_metrics_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / bedrock_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / litellm_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / harbor_tests (push) Blocked by required conditions
SDK Library Integration Tests Runner / Slack Notification (push) Blocked by required conditions
Lint Opik Helm Chart / lint-helm-chart (Helm v3.21.0) (push) Waiting to run
Lint Opik Helm Chart / lint-helm-chart (Helm v4.2.0) (push) Waiting to run
Lint Opik Helm Chart / unittest-helm-chart (push) Waiting to run
Lint Opik Helm Chart / render-equality (push) Waiting to run
Opik Optimizer - E2E Tests / build-opik (push) Waiting to run
Opik Optimizer - E2E Tests / Opik Optimizer E2E Tests Python ${{matrix.python_version}} (push) Blocked by required conditions
Opik Optimizer - E2E Tests / Opik Optimizer Integration Smoke Tests (push) Blocked by required conditions
Opik Optimizer - Unit Tests / Opik Optimizer Unit Tests Python ${{matrix.python_version}} (push) Waiting to run
Python BE E2E Tests / Python BE E2E (push) Waiting to run
Python Backend Tests / run-python-backend-tests (push) Waiting to run
Python SDK Compatibility V1.x E2E Tests / Select Python version matrix (push) Waiting to run
Python SDK Compatibility V1.x E2E Tests / build-opik (push) Waiting to run
Python SDK Compatibility V1.x E2E Tests / Python SDK Compatibility V1.x E2E Tests ${{matrix.python_version}} (push) Blocked by required conditions
Python SDK E2E Tests / Select Python version matrix (push) Waiting to run
Python SDK E2E Tests / build-opik (push) Waiting to run
Python SDK E2E Tests / Python SDK E2E Tests ${{matrix.python_version}} (push) Blocked by required conditions
Python SDK Unit Tests / Python SDK Unit Tests ${{matrix.python_version}} (push) Waiting to run
Release Drafter / update_release_draft (push) Waiting to run
SDK E2E Libraries Integration Tests / Check Secrets (push) Waiting to run
SDK E2E Libraries Integration Tests / Missed OpenAI API Key Warning (push) Blocked by required conditions
SDK E2E Libraries Integration Tests / build-opik (push) Blocked by required conditions
SDK E2E Libraries Integration Tests / E2E Lib Integration Python ${{matrix.python_version}} (push) Blocked by required conditions
TypeScript SDK Compatibility V1.x E2E Tests / Select Node version matrix (push) Waiting to run
TypeScript SDK Compatibility V1.x E2E Tests / build-opik (push) Waiting to run
TypeScript SDK Compatibility V1.x E2E Tests / TypeScript SDK Compatibility V1.x E2E Tests Node ${{matrix.node_version}} (push) Blocked by required conditions
TypeScript SDK E2E Tests / Select Node version matrix (push) Waiting to run
TypeScript SDK E2E Tests / build-opik (push) Waiting to run
TypeScript SDK E2E Tests / TypeScript SDK E2E Tests Node ${{matrix.node_version}} (push) Blocked by required conditions
TypeScript SDK Integration Build & Publish / build-and-publish (opik-gemini) (push) Waiting to run
TypeScript SDK Integration Build & Publish / build-and-publish (opik-langchain) (push) Waiting to run
TypeScript SDK Integration Build & Publish / build-and-publish (opik-openai) (push) Waiting to run
TypeScript SDK Integration Build & Publish / build-and-publish (opik-otel) (push) Waiting to run
TypeScript SDK Integration Build & Publish / build-and-publish (opik-vercel) (push) Waiting to run
TypeScript SDK Library Integration Tests / Check Secrets (push) Waiting to run
TypeScript SDK Library Integration Tests / opik-vercel (Vercel AI SDK / eve) (push) Blocked by required conditions
TypeScript SDK Build & Publish / build-and-publish (push) Waiting to run
TypeScript SDK Unit Tests / Test on Node ${{ matrix.node-version }} (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:25:44 +08:00

337 lines
13 KiB
YAML

---
# Single source of truth for Opik's pre-commit checks across the monorepo.
# Each scope is gated by `files:` so a commit only runs the hooks for the paths
# it touches. Local commits and the unified lint CI workflow both drive off this.
#
# Versions of remote linters are pinned per `rev:` (the framework's design — it
# provisions each tool in an isolated env so contributors need no Python/JS/Java
# install to run the Python hooks). Keep them fresh with `pre-commit autoupdate`.
repos:
# ---------------------------------------------------------------------------
# Python SDK (sdks/python)
# ---------------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
name: 🐍 trim trailing whitespace — python sdk
files: ^sdks/python
exclude: "(sdks/python/src/opik/rest_api/)"
- id: end-of-file-fixer
name: 🐍 fix end of files — python sdk
files: ^sdks/python
exclude: "(sdks/python/src/opik/rest_api/)"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
hooks:
- id: ruff
name: 🐍 ruff — python sdk
args: [--fix, --show-fixes]
files: ^sdks/python
exclude: "(sdks/python/src/opik/rest_api/)"
- id: ruff-format
name: 🐍 ruff-format — python sdk
files: ^sdks/python
exclude: "(sdks/python/src/opik/rest_api/)"
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
name: 🐍 mypy — python sdk
files: ^sdks/python
# `exclude` option will work only from here.
# The rest of mypy configuration can be moved to pyproject.toml
exclude: "(sdks/python/tests/)|(sdks/python/examples/)|(sdks/python/src/opik/rest_api/)|(sdks/python/.cursor/)"
args:
[
--config-file,
sdks/python/pyproject.toml,
--disable-error-code,
misc,
]
# ---------------------------------------------------------------------------
# Optimizer SDK (sdks/opik_optimizer)
# ---------------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
name: 🤖 trim trailing whitespace — optimizer
files: ^sdks/opik_optimizer
- id: end-of-file-fixer
name: 🤖 fix end of files — optimizer
files: ^sdks/opik_optimizer
- id: check-yaml
name: 🤖 check yaml — optimizer
files: ^sdks/opik_optimizer
- id: check-json
name: 🤖 check json — optimizer
files: ^sdks/opik_optimizer
- id: check-toml
name: 🤖 check toml — optimizer
files: ^sdks/opik_optimizer
- id: check-added-large-files
name: 🤖 check for added large files — optimizer
args: ['--maxkb=1000']
files: ^sdks/opik_optimizer
- id: detect-private-key
name: 🔐 detect private key — optimizer
files: ^sdks/opik_optimizer
- id: check-merge-conflict
name: 🤖 check for merge conflicts — optimizer
files: ^sdks/opik_optimizer
- id: check-case-conflict
name: 🤖 check for case conflicts — optimizer
files: ^sdks/opik_optimizer
- repo: https://github.com/asottile/pyupgrade
rev: v3.21.2
hooks:
- id: pyupgrade
name: 🤖 pyupgrade — optimizer
args: [--py310-plus]
files: ^sdks/opik_optimizer
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
hooks:
- id: ruff
name: 🤖 ruff — optimizer
args: [ --fix, --show-fixes]
files: ^sdks/opik_optimizer
- id: ruff-format
name: 🤖 ruff-format — optimizer
files: ^sdks/opik_optimizer
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
name: 🤖 mypy — optimizer
files: ^sdks/opik_optimizer
exclude: '(sdks/opik_optimizer/scripts/benchmarks/|sdks/opik_optimizer/benchmarks/benchmark_results/)'
args: [--config-file, sdks/opik_optimizer/pyproject.toml, --install-types, --non-interactive]
additional_dependencies: [types-requests, types-PySocks, types-Pygments, types-pexpect, types-protobuf, types-setuptools, types-ujson, pytest, pyrate_limiter, modal]
- repo: https://github.com/kynan/nbstripout
rev: 0.9.0
hooks:
- id: nbstripout
name: 📓 nbstripout — optimizer notebooks
files: ^sdks/opik_optimizer/.*\.ipynb$
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.47.0
hooks:
- id: markdownlint
name: 📝 markdownlint — optimizer
files: ^sdks/opik_optimizer/.*\.md$
exclude: '^sdks/opik_optimizer/scripts/arc_agi/prompts/.*\.md$'
args: ['--disable=MD013', '--disable=MD033', '--disable=MD060']
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: codespell
name: 🔤 codespell — optimizer
files: ^sdks/opik_optimizer
exclude: '(\.ipynb$)|(\.json$)|(\.jsonl$)|(benchmark_results/)'
args: ['--skip=*.ipynb,*.json,*.jsonl','--write-changes']
- repo: local
hooks:
- id: radon-cc
name: 📊 radon cc — optimizer
entry: radon cc -s -a -n C sdks/opik_optimizer/src
language: python
types: [python]
files: ^sdks/opik_optimizer/src/
pass_filenames: false
additional_dependencies: [radon==6.0.1]
- id: radon-raw
name: 📊 radon raw — optimizer
entry: radon raw -s
language: python
types: [python]
files: ^sdks/opik_optimizer/src/
pass_filenames: true
additional_dependencies: [radon==6.0.1]
- id: xenon
name: 📊 xenon — optimizer
entry: bash -c 'set -o pipefail; xenon --max-absolute D --max-average C --max-modules C sdks/opik_optimizer/src | head -n 200'
language: python
types: [python]
files: ^sdks/opik_optimizer/src/
pass_filenames: false
additional_dependencies: [xenon==0.9.3]
- id: lizard
name: 📊 lizard — optimizer
entry: bash -c 'set -o pipefail; lizard -C 25 -l python -w sdks/opik_optimizer/src | head -n 200'
language: python
types: [python]
files: ^sdks/opik_optimizer/src/
pass_filenames: false
additional_dependencies: [lizard==1.19.0]
- repo: https://github.com/jendrikseipp/vulture
rev: v2.14
hooks:
- id: vulture
name: 🧹 vulture — optimizer
files: ^sdks/opik_optimizer
args: ['sdks/opik_optimizer/src', 'sdks/opik_optimizer/benchmarks', '--min-confidence=80', '--exclude=benchmarks/.venv']
# ---------------------------------------------------------------------------
# Guardrails backend (apps/opik-guardrails-backend)
# ---------------------------------------------------------------------------
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
name: 🛡️ trim trailing whitespace — guardrails
files: ^apps/opik-guardrails-backend
- id: end-of-file-fixer
name: 🛡️ fix end of files — guardrails
files: ^apps/opik-guardrails-backend
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.14
hooks:
- id: ruff
name: 🛡️ ruff — guardrails
args: [ --fix, --show-fixes]
files: ^apps/opik-guardrails-backend
- id: ruff-format
name: 🛡️ ruff-format — guardrails
files: ^apps/opik-guardrails-backend
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.19.1
hooks:
- id: mypy
name: 🛡️ mypy — guardrails
files: ^apps/opik-guardrails-backend
# `exclude` option will work only from here.
# The rest of mypy configuration can be moved to pyproject.toml
exclude: '(^apps/opik-guardrails-backend/tests/)|(^apps/opik-guardrails-backend/scripts/)'
args: [--config-file, apps/opik-guardrails-backend/pyproject.toml]
# ---------------------------------------------------------------------------
# Helm chart docs
# ---------------------------------------------------------------------------
- repo: local
hooks:
- id: helm-docs
name: ⚓ helm-docs
language: docker_image
entry: jnorwood/helm-docs:v1.14.2
args:
- --chart-search-root=deployment/helm_chart/opik
files: (README\.md\.gotmpl|values\.yaml|Chart\.yaml)$
pass_filenames: false
- id: no-private-fe-plugins
name: block non-public FE plugins
language: system
entry: scripts/check-public-fe-plugins.sh
files: ^apps/opik-frontend/src/plugins/
pass_filenames: false
# ---------------------------------------------------------------------------
# Backend (Java) — Spotless, on changed files only (language: system → uses
# the repo's own Maven/JDK; only triggers for commits that touch .java).
# ---------------------------------------------------------------------------
- repo: local
hooks:
- id: spotless
name: ☕ spotless — java backend
entry: scripts/precommit-spotless.sh
language: system
files: ^apps/opik-backend/.*\.java$
require_serial: true
# ---------------------------------------------------------------------------
# Self-check: smoke-test the pre-commit wrapper scripts when any of them change,
# so a broken wrapper (regex/routing/flags) is caught before it ships.
# ---------------------------------------------------------------------------
- repo: local
hooks:
- id: precommit-wrapper-tests
name: 🧪 pre-commit wrapper smoke tests
entry: scripts/test_precommit_wrappers.sh
language: system
files: ^scripts/precommit-.*\.sh$|^scripts/test_precommit_wrappers\.sh$
pass_filenames: false
# ---------------------------------------------------------------------------
# Frontend (apps/opik-frontend) — eslint --fix on changed files; whole-project
# typecheck (tsc can't be per-file: path aliases + cross-file inference).
# language: system → uses the repo's own node_modules; files-gated to src.
# ---------------------------------------------------------------------------
- repo: local
hooks:
- id: fe-eslint
name: 🌐 eslint — frontend
entry: scripts/precommit-fe-lint.sh
language: system
files: ^apps/opik-frontend/src/.*\.(ts|tsx|js|jsx|css|scss|sass)$
- id: fe-typecheck
name: 🌐 typecheck — frontend
entry: npm --prefix apps/opik-frontend run typecheck
language: system
files: ^apps/opik-frontend/src/.*\.(ts|tsx)$
pass_filenames: false
# ---------------------------------------------------------------------------
# TypeScript SDK (sdks/typescript) — eslint + whole-project typecheck.
# ---------------------------------------------------------------------------
- repo: local
hooks:
- id: ts-sdk-eslint
name: 📘 eslint — typescript sdk
entry: scripts/precommit-ts-sdk-lint.sh
language: system
files: ^sdks/typescript/.*\.(ts|tsx)$
- id: ts-sdk-typecheck
name: 📘 typecheck — typescript sdk
entry: npm --prefix sdks/typescript run typecheck
language: system
files: ^sdks/typescript/.*\.(ts|tsx)$
pass_filenames: false
# ---------------------------------------------------------------------------
# GitHub Actions workflows / composite actions — actionlint. Runs at the default
# info+ severity (no SHELLCHECK_OPTS), matching the floor set by OPIK-6584. The
# `language: golang` hook builds actionlint from the pinned source, so this hook
# (run by code_quality.yml) replaces the standalone actionlint.yml as the SSOT.
# ---------------------------------------------------------------------------
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
name: ⚙️ actionlint — github workflows
# Workflows only — actionlint cannot lint composite `action.yml` files
# directly (they have no `jobs:`/`on:`); those are validated transitively
# when a workflow that `uses:` them is linted. Matches actionlint's own
# default files pattern.
files: ^\.github/workflows/.+\.(yml|yaml)$
# ---------------------------------------------------------------------------
# Dockerfiles — hadolint. The docker-image hook needs only Docker (no local
# binary), matching CI runners. Runs hadolint's default rule set (failure
# threshold `info`); the few deliberate exceptions are `# hadolint ignore=`
# comments inline in the Dockerfiles, so no repo-level config file is needed.
# ---------------------------------------------------------------------------
- repo: https://github.com/hadolint/hadolint
rev: v2.14.0
hooks:
- id: hadolint-docker
name: 🐳 hadolint — dockerfiles
# Explicit files: regex (not the upstream `types: [dockerfile]`) so the
# CI matrix builder in scripts/precommit-detect-hooks.py can route a
# changed Dockerfile to this leg — it matches on paths, not content type.
files: (^|/)Dockerfile(\..+)?$
...