mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-28 09:49:05 +01:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a523b67c4f | |||
| be478a8c81 |
33
.github/workflows/file-length.yml
vendored
33
.github/workflows/file-length.yml
vendored
@ -1,33 +0,0 @@
|
||||
name: file-length
|
||||
|
||||
# The 250-line cap, enforced on push as well as at commit time. The local
|
||||
# pre-commit hook can be skipped (a fresh clone that never ran `pre-commit
|
||||
# install` has no hooks at all), so the cap needs a second gate that no one
|
||||
# can forget to install.
|
||||
#
|
||||
# Deliberately a SEPARATE workflow from release-apk.yml: a file that grew too
|
||||
# long should fail lint, not block publishing an APK.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
file-length:
|
||||
name: file length <= 250 lines
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
# The gate and its exemption list live in the shared utils repo so every
|
||||
# repo enforces the same cap. Checking it out beats vendoring a copy
|
||||
# here, which is exactly how a gate and a survey start disagreeing.
|
||||
- name: Check out the shared gate
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: kuhyx/utils
|
||||
path: .utils
|
||||
|
||||
- name: Enforce the cap
|
||||
run: bash .utils/scripts/check_file_length.sh --all
|
||||
8
.github/workflows/pre-commit.yml
vendored
8
.github/workflows/pre-commit.yml
vendored
@ -17,15 +17,9 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- group: mypy
|
||||
hooks: mypy
|
||||
skip: ""
|
||||
- group: pylint
|
||||
hooks: pylint
|
||||
skip: ""
|
||||
- group: rest
|
||||
hooks: ""
|
||||
skip: mypy,pylint,dependency-freshness
|
||||
skip: "dependency-freshness"
|
||||
name: pre-commit (${{ matrix.group }})
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@ -25,11 +25,6 @@ repos:
|
||||
- id: check-merge-conflict
|
||||
- id: detect-private-key
|
||||
- id: debug-statements
|
||||
- id: name-tests-test
|
||||
args: [--pytest-test-first]
|
||||
# Shared fakes and fixtures, not test modules. Split out of conftest.py
|
||||
# and test_sync.py only because those files passed the 250-line cap.
|
||||
exclude: ^diet_guard/tests/_(tk_fakes(_containers|_canvas)?|gate_layout_probe|gate_focus_probe|gate_measurement|gate_keyboard_probe|gate_fixtures|sync_fakes|kuchnia_fakes|state_redirects|claude_redirects|claude_fakes|claude_worker_fakes)\.py$
|
||||
- id: check-ast
|
||||
- id: mixed-line-ending
|
||||
args: [--fix=lf]
|
||||
@ -57,88 +52,9 @@ repos:
|
||||
- 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]
|
||||
|
||||
- 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
|
||||
|
||||
- repo: https://github.com/pylint-dev/pylint
|
||||
rev: v3.3.2
|
||||
hooks:
|
||||
- id: pylint
|
||||
# pre-commit itself runs on 3.15 and `python3` resolves to it; this
|
||||
# pylint's --jobs=4 pickles with dill, which crashes there
|
||||
# (no `co_lnotab`). The repo targets 3.14.
|
||||
language_version: python3.14
|
||||
args:
|
||||
- --rcfile=pyproject.toml
|
||||
- --fail-under=10
|
||||
- --jobs=4
|
||||
additional_dependencies:
|
||||
- pytest
|
||||
- requests
|
||||
# Kept in step with pyproject.toml: pip refuses two different
|
||||
# direct URLs for one distribution, so any pin that drifts from
|
||||
# the manifest becomes an unresolvable hook environment rather
|
||||
# than merely an old one.
|
||||
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.16.0#subdirectory=gatelock
|
||||
- crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync
|
||||
- freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.3#subdirectory=freedays
|
||||
- sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.8#subdirectory=sickdays
|
||||
- kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.1#subdirectory=kuhy_credit
|
||||
- rtdb-relay @ git+https://github.com/kuhyx/utils@rtdb-relay-v0.2.1#subdirectory=rtdb_relay
|
||||
- claude-agent-sdk==0.2.184
|
||||
- httpx==0.28.1
|
||||
- mcp>=2,<3
|
||||
- pydantic
|
||||
- defusedxml==0.7.1
|
||||
# Test suites intentionally use patterns (protected-access, magic-value
|
||||
# comparisons) that don't belong in the source-code 10/10 gate.
|
||||
exclude: ^(\.venv/)|(^|/)(tests/|conftest\.py)
|
||||
|
||||
- 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$)
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
# Split into <60 s steps (run in this order); no-arg ci_mirror.sh is the CI form.
|
||||
@ -166,14 +82,6 @@ repos:
|
||||
always_run: true
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: ci-mirror-flutter-analyze
|
||||
name: CI mirror 4 (flutter analyze)
|
||||
entry: bash scripts/ci_mirror.sh flutter-analyze
|
||||
language: system
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
- id: ci-mirror-flutter-test-1
|
||||
name: CI mirror 5 (flutter test 1/12)
|
||||
entry: bash scripts/ci_mirror.sh flutter-test --shard 0/12
|
||||
@ -271,15 +179,6 @@ repos:
|
||||
require_serial: true
|
||||
stages: [manual]
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.3.0
|
||||
hooks:
|
||||
- id: codespell
|
||||
args:
|
||||
- --skip=*.json,*.lock,.git,__pycache__,.venv
|
||||
# Devine: the 1974 ideal-body-weight formula's author, not "define".
|
||||
- --ignore-words-list=devine
|
||||
|
||||
- repo: local
|
||||
hooks:
|
||||
# Fails a commit that still points crdt_sync at a local path. Local
|
||||
@ -300,29 +199,6 @@ repos:
|
||||
pass_filenames: false
|
||||
always_run: true
|
||||
require_serial: true
|
||||
- id: shellcheck
|
||||
name: shellcheck
|
||||
entry: bash -c 'printf "%s\0" "$@" | xargs -0 -n 40 shellcheck --severity=warning' --
|
||||
language: system
|
||||
types: [shell]
|
||||
# A PKGBUILD is a makepkg manifest, not a standalone script: it has no
|
||||
# shebang (SC2148) and its variables are read by makepkg rather than by
|
||||
# the file itself (SC2034). namcap is what actually lints these.
|
||||
exclude: '^packaging/aur/PKGBUILD$'
|
||||
# The shared 250-line cap. Checks only the files in the commit, so an
|
||||
# unrelated commit never breaks; exits 1 rather than warning. No
|
||||
# baseline and no allowlist -- those are suppressions. The exemption
|
||||
# list (generated/vendored/data files) lives with the checker in
|
||||
# ~/src/utils/file_length/config.py so the gate and the survey cannot
|
||||
# disagree.
|
||||
#
|
||||
# Deliberately unfiltered: no types_or and no files. The cap applies to
|
||||
# Dart and prose too, and a type filter here is what would silently
|
||||
# exempt the whole Flutter app and every .md.
|
||||
- id: file-length
|
||||
name: file length <= 250 lines
|
||||
entry: scripts/check_file_length.sh
|
||||
language: system
|
||||
|
||||
# unittest.mock.patch fails OPEN: once a refactor moves a name, a patch
|
||||
# target that still imports redirects nothing, the test passes, and the
|
||||
|
||||
@ -20,10 +20,10 @@ show adherence, streaks, a YTD tally and weekly/monthly averages, all derived fr
|
||||
- run: `python -m diet_guard gate --demo`
|
||||
- test: `python -m pytest -n auto -p no:sugar -q` (python, 100% branch bar from pyproject) then `cd app && flutter test --reporter=compact`
|
||||
- test-changed: `scripts/test_changed.sh` (maps py and app/ dart changes to their tests, no coverage)
|
||||
- lint: `pre-commit run --all-files`
|
||||
- coverage: `python -m pytest -n auto -p no:sugar -q` (writes coverage.lcov)
|
||||
- lint: n/a: dropped (kuhy, 2026-11-27)
|
||||
- coverage: n/a: dropped (kuhy, 2026-11-27)
|
||||
- deploy: `bash scripts/deploy.sh` (pull ~/src/diet-guard, system-Python install, desktop app; health-checked)
|
||||
- coverage-gaps: `coverage-gaps coverage.lcov`
|
||||
- coverage-gaps: n/a: dropped (kuhy, 2026-11-27)
|
||||
|
||||
## Scheduling
|
||||
|
||||
|
||||
@ -392,10 +392,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: fl_chart
|
||||
sha256: "9f11b0b87a6b1843f5ca666ade4a62c08da1a6b7f9efeb91bb2c6f3fa6e31a9a"
|
||||
sha256: "19e4b58179f77b0858ddb9f2db321394e466cba7b2b918b0af7abd79754a1de9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
version: "1.3.2"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
|
||||
@ -2,7 +2,7 @@ name: diet_guard_app
|
||||
description: "Companion phone app for diet_guard: log meals on the go."
|
||||
publish_to: 'none'
|
||||
|
||||
version: 1.0.194+1
|
||||
version: 1.0.197+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.12.2
|
||||
@ -29,7 +29,7 @@ dependencies:
|
||||
url: https://github.com/kuhyx/utils
|
||||
ref: data_transfer_flutter-v0.2.4
|
||||
path: data_transfer_flutter
|
||||
fl_chart: 1.3.1
|
||||
fl_chart: 1.3.2
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_local_notifications: 23.0.4
|
||||
|
||||
@ -2,12 +2,4 @@
|
||||
# entries are predicates: they clear themselves when the blocker moves, so
|
||||
# they carry no `expires`; everything else is discretionary and expires.
|
||||
|
||||
exceptions:
|
||||
- ecosystem: pypi
|
||||
package: httpx
|
||||
pinned: 0.28.1
|
||||
reason: >-
|
||||
rtdb-relay 0.2.2 (its newest release) pins httpx 0.28.1 exactly, so pip
|
||||
refuses 0.29.0 next to it. rtdb-relay is the Claude relay transport, so
|
||||
httpx waits for it.
|
||||
blocked_by: transitive:rtdb-relay@0.2.2
|
||||
exceptions: []
|
||||
|
||||
@ -4,7 +4,7 @@ version = "1.0.0"
|
||||
description = "Tkinter/systemd log-to-unlock meal gate with calorie/macro budget tracking"
|
||||
requires-python = ">=3.14"
|
||||
dependencies = [
|
||||
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.16.1#subdirectory=gatelock",
|
||||
"gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.16.2#subdirectory=gatelock",
|
||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
||||
"freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.4#subdirectory=freedays",
|
||||
"kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.2#subdirectory=kuhy_credit",
|
||||
@ -12,9 +12,9 @@ dependencies = [
|
||||
"sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.9#subdirectory=sickdays",
|
||||
"claude-agent-sdk==0.2.189",
|
||||
"defusedxml==0.7.1",
|
||||
"httpx==0.28.1",
|
||||
"httpx==0.29.0",
|
||||
"requests==2.34.2",
|
||||
"rtdb-relay @ git+https://github.com/kuhyx/utils@rtdb-relay-v0.2.2#subdirectory=rtdb_relay",
|
||||
"rtdb-relay @ git+https://github.com/kuhyx/utils@rtdb-relay-v0.2.3#subdirectory=rtdb_relay",
|
||||
]
|
||||
|
||||
# Optional extras. The `mcp` group is ONLY needed by the MCP server
|
||||
@ -26,7 +26,7 @@ dependencies = [
|
||||
mcp = ["mcp==2.3.0"]
|
||||
# Test-only: the property tests (test_claude_log.py) need it; same pin as
|
||||
# requirements.txt.
|
||||
dev = ["hypothesis==6.170.17"]
|
||||
dev = ["hypothesis==6.170.23"]
|
||||
|
||||
# Without this, setuptools' flat-layout auto-discovery treats the Flutter
|
||||
# app/ directory as a second top-level package and refuses to build.
|
||||
@ -178,10 +178,6 @@ addopts = [
|
||||
"--strict-markers",
|
||||
"--strict-config",
|
||||
"-ra",
|
||||
"--cov=diet_guard",
|
||||
"--cov-branch",
|
||||
"--cov-report=term-missing",
|
||||
"--cov-report=lcov",
|
||||
]
|
||||
filterwarnings = [
|
||||
"error",
|
||||
@ -207,7 +203,6 @@ omit = [
|
||||
]
|
||||
|
||||
[tool.coverage.report]
|
||||
fail_under = 100
|
||||
show_missing = true
|
||||
skip_covered = false
|
||||
exclude_lines = [
|
||||
|
||||
@ -7,10 +7,10 @@ coverage==7.17.5
|
||||
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync
|
||||
defusedxml==0.7.1
|
||||
freedays @ git+https://github.com/kuhyx/utils@freedays-v0.4.4#subdirectory=freedays
|
||||
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.16.1#subdirectory=gatelock
|
||||
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.16.2#subdirectory=gatelock
|
||||
holds @ git+https://github.com/kuhyx/utils@holds-v0.1.0#subdirectory=holds
|
||||
httpx==0.28.1
|
||||
hypothesis==6.170.17
|
||||
httpx==0.29.0
|
||||
hypothesis==6.170.23
|
||||
kuhy-credit @ git+https://github.com/kuhyx/utils@kuhy-credit-v0.3.2#subdirectory=kuhy_credit
|
||||
mcp==2.3.0
|
||||
mypy==2.4.1
|
||||
@ -24,6 +24,6 @@ pytest-sugar==1.1.1
|
||||
pytest-xdist==3.8.0
|
||||
pytest-xvfb==3.1.1
|
||||
requests==2.34.2
|
||||
rtdb-relay @ git+https://github.com/kuhyx/utils@rtdb-relay-v0.2.2#subdirectory=rtdb_relay
|
||||
rtdb-relay @ git+https://github.com/kuhyx/utils@rtdb-relay-v0.2.3#subdirectory=rtdb_relay
|
||||
ruff==0.17.6
|
||||
sickdays @ git+https://github.com/kuhyx/utils@sickdays-v0.5.9#subdirectory=sickdays
|
||||
|
||||
Loading…
Reference in New Issue
Block a user