mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-07-04 11:43:12 +02:00
Adds a React/TypeScript frontend (web/) with a Python stdlib HTTP server backend. The UI mirrors the CLI `stats` command in the browser, with real-time sliders for ProtonDB rating, HLTB confidence thresholds, daily play time, per-game time cap, playtime mode, no-HLTB-data fallback, and a target-date planner. A parity badge confirms the client-side totals reproduce the CLI defaults exactly (786 / 67031.1h / 143017.2h / 238447.9h). Python side: - `_web_dataset.py`: offline projection of HLTB/ProtonDB/snapshot caches into a compact, secret-free JSON payload; 100% branch coverage - `_web_server.py`: zero-dependency stdlib HTTP server serving the built Vite bundle and the /api/dataset endpoint; 100% branch coverage - `main.py`: new `serve` command wiring Frontend (Vitest + RTL, 100% branch coverage enforced): - TypeScript port of ProtonDB compound rating rule with full parity - Pure client-side filtering via estimate.ts (no server round-trips) - SVG completion timeline chart, sortable/searchable game table - Steam dark theme; responsive layout Pre-commit: adds `vitest-coverage` hook at pre-push stage requiring 100% branch coverage on the React codebase. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
179 lines
6.3 KiB
YAML
179 lines
6.3 KiB
YAML
# Pre-commit Configuration for steam-backlog-enforcer
|
|
# Install: pre-commit install && pre-commit install --hook-type pre-push
|
|
# Run: pre-commit run --all-files
|
|
# Update: pre-commit autoupdate
|
|
|
|
default_language_version:
|
|
python: python3
|
|
default_stages: [pre-commit]
|
|
fail_fast: false
|
|
|
|
repos:
|
|
# ===========================================================================
|
|
# GENERAL HOOKS
|
|
# ===========================================================================
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.6.0
|
|
hooks:
|
|
- id: trailing-whitespace
|
|
args: [--markdown-linebreak-ext=md]
|
|
- id: end-of-file-fixer
|
|
- id: check-yaml
|
|
- id: check-json
|
|
- id: check-toml
|
|
- id: check-added-large-files
|
|
args: [--maxkb=2000]
|
|
- id: check-merge-conflict
|
|
- id: check-case-conflict
|
|
- id: detect-private-key
|
|
- id: debug-statements
|
|
- id: name-tests-test
|
|
args: [--pytest-test-first]
|
|
- id: check-ast
|
|
- id: check-builtin-literals
|
|
- id: check-docstring-first
|
|
- id: mixed-line-ending
|
|
args: [--fix=lf]
|
|
- id: requirements-txt-fixer
|
|
|
|
# ===========================================================================
|
|
# NOQA BLOCKER
|
|
# ===========================================================================
|
|
- repo: local
|
|
hooks:
|
|
- id: no-noqa
|
|
name: Block noqa comments
|
|
entry: '(?i)#\s*(noqa|type:\s*ignore)'
|
|
language: pygrep
|
|
types: [python]
|
|
- id: no-ruff-noqa
|
|
name: Block ruff noqa file-level comments
|
|
entry: '(?i)#\s*ruff:\s*noqa'
|
|
language: pygrep
|
|
types: [python]
|
|
|
|
# ===========================================================================
|
|
# RUFF - Linter + formatter
|
|
# ===========================================================================
|
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
rev: v0.15.2
|
|
hooks:
|
|
- id: ruff
|
|
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
|
types_or: [python, pyi]
|
|
- id: ruff-format
|
|
types_or: [python, pyi]
|
|
|
|
# ===========================================================================
|
|
# MYPY - Type checking
|
|
# ===========================================================================
|
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
rev: v1.13.0
|
|
hooks:
|
|
- id: mypy
|
|
args:
|
|
- --ignore-missing-imports
|
|
- --no-error-summary
|
|
- --disable-error-code=no-untyped-def
|
|
- --disable-error-code=no-untyped-call
|
|
- --disable-error-code=var-annotated
|
|
- --disable-error-code=no-any-unimported
|
|
- --disable-error-code=type-arg
|
|
- --disable-error-code=no-any-return
|
|
- --disable-error-code=misc
|
|
- --disable-error-code=unused-ignore
|
|
- --disable-error-code=unreachable
|
|
- --disable-error-code=assignment
|
|
- --disable-error-code=no-redef
|
|
- --disable-error-code=attr-defined
|
|
- --disable-error-code=arg-type
|
|
- --disable-error-code=union-attr
|
|
- --disable-error-code=call-overload
|
|
- --disable-error-code=return-value
|
|
- --disable-error-code=redundant-cast
|
|
- --disable-error-code=empty-body
|
|
- --disable-error-code=list-item
|
|
additional_dependencies:
|
|
- types-requests
|
|
|
|
# ===========================================================================
|
|
# PYLINT
|
|
# ===========================================================================
|
|
- repo: https://github.com/pylint-dev/pylint
|
|
rev: v3.3.2
|
|
hooks:
|
|
- id: pylint
|
|
args:
|
|
- --rcfile=pyproject.toml
|
|
- --fail-under=8.0
|
|
- --jobs=4
|
|
additional_dependencies:
|
|
- pytest
|
|
- requests
|
|
|
|
# ===========================================================================
|
|
# BANDIT - Security linter
|
|
# ===========================================================================
|
|
- repo: https://github.com/PyCQA/bandit
|
|
rev: 1.7.10
|
|
hooks:
|
|
- id: bandit
|
|
args:
|
|
- -c
|
|
- pyproject.toml
|
|
- --severity-level=high
|
|
- --confidence-level=medium
|
|
- --skip=B113
|
|
additional_dependencies: ["bandit[toml]"]
|
|
exclude: ^(tests/|.*test.*\.py$)
|
|
|
|
# ===========================================================================
|
|
# PYTEST + COVERAGE (push stage)
|
|
# ===========================================================================
|
|
- repo: local
|
|
hooks:
|
|
- id: pytest-coverage
|
|
name: pytest with coverage enforcement
|
|
entry: python -m pytest steam_backlog_enforcer/tests/ --cov=steam_backlog_enforcer --cov-branch --cov-fail-under=100
|
|
language: system
|
|
types: [python]
|
|
pass_filenames: false
|
|
require_serial: true
|
|
stages: [pre-push]
|
|
|
|
# ===========================================================================
|
|
# VITEST + COVERAGE (push stage)
|
|
# ===========================================================================
|
|
- repo: local
|
|
hooks:
|
|
- id: vitest-coverage
|
|
name: vitest with 100% coverage enforcement
|
|
entry: npm --prefix web run coverage
|
|
language: system
|
|
files: ^web/src/
|
|
pass_filenames: false
|
|
require_serial: true
|
|
stages: [pre-push]
|
|
|
|
# ===========================================================================
|
|
# CODESPELL - Spell checking
|
|
# ===========================================================================
|
|
- repo: https://github.com/codespell-project/codespell
|
|
rev: v2.3.0
|
|
hooks:
|
|
- id: codespell
|
|
args:
|
|
- --skip=*.json,*.lock,.git,__pycache__,.venv
|
|
- --ignore-words-list=als,ans,ect,nd,som,sur,te,nam,numer,lew,sie,wil,postion,clen,ther,folow,derrive,ony,tje,noe,theses,crate,doubleclick,wile,tabel,pary,blok,bloc,proces,serwer,parametr,adres,hart,dout,metod,tekst,synonim,grup,mosty,lokal,skalar,milion,nowe,tre,hel,alph
|
|
|
|
# ===========================================================================
|
|
# SHELLCHECK - Shell script linting
|
|
# ===========================================================================
|
|
- repo: local
|
|
hooks:
|
|
- id: shellcheck
|
|
name: shellcheck
|
|
entry: bash -c 'printf "%s\0" "$@" | xargs -0 -n 40 shellcheck --severity=warning' --
|
|
language: system
|
|
types: [shell]
|