Fix pre-existing CI failures (deps, lint, whitespace)
Some checks are pending
pre-commit / pre-commit (push) Waiting to run
Tests / test (3.10) (push) Waiting to run
Tests / test (3.11) (push) Waiting to run
Tests / test (3.12) (push) Waiting to run

CI on main was already red before the crdt_sync migration. Make the
pre-commit --all-files run and the test job green:

- requirements.txt: add crdt-sync (now a runtime dep) and mcp so CI's
  `pip install -r requirements.txt` can import diet_guard._sync and
  collect test_mcp.py (both were ModuleNotFoundError in CI).
- .pre-commit-config.yaml: add mcp + pydantic to the pylint hook deps so
  it can resolve diet_guard._mcp's imports (was E0401).
- pyproject.toml: raise pylint min-similarity-lines to 8 — the shared
  nutrition-field keys in _foodbank/_mcp mirror one domain schema, not
  real duplicate code.
- scripts/setup_mcp.sh: split declare/assign for SCRIPT_DIR/REPO_DIR
  (shellcheck SC2155).
- codespell: fix "packge"/"unparseable" typos; trailing-whitespace
  auto-fixes across app/.agents/skills docs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RRCdR4D8SaVrN2xraMQxM
This commit is contained in:
Krzysztof Rudnicki 2026-07-10 23:55:56 +02:00
parent 59d1c29dd2
commit e6812f7b4f
18 changed files with 43 additions and 30 deletions

View File

@ -94,6 +94,8 @@ repos:
- requests - requests
- gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.1.0#subdirectory=gatelock - gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.1.0#subdirectory=gatelock
- crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.1.0#subdirectory=crdt-sync - crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.1.0#subdirectory=crdt-sync
- mcp
- pydantic
# Test suites intentionally use patterns (protected-access, magic-value # Test suites intentionally use patterns (protected-access, magic-value
# comparisons) that don't belong in the source-code 10/10 gate. # comparisons) that don't belong in the source-code 10/10 gate.
exclude: ^(\.venv/)|(^|/)(tests/|conftest\.py) exclude: ^(\.venv/)|(^|/)(tests/|conftest\.py)

View File

@ -1,6 +1,6 @@
--- ---
name: dart-collect-coverage name: dart-collect-coverage
description: Collect coverage using the coverage packge and create an LCOV report description: Collect coverage using the coverage package and create an LCOV report
metadata: metadata:
model: models/gemini-3.1-pro-preview model: models/gemini-3.1-pro-preview
last_modified: Fri, 24 Apr 2026 15:14:32 GMT last_modified: Fri, 24 Apr 2026 15:14:32 GMT

View File

@ -976,7 +976,7 @@ void main() {
); );
testWidgets( testWidgets(
'_formatDay falls back to raw key for an unparseable date (line 245)', '_formatDay falls back to raw key for an unparsable date (line 245)',
(tester) async { (tester) async {
await tester.runAsync(() async { await tester.runAsync(() async {
// The day key is e.time.substring(0, 10). Writing an entry whose // The day key is e.time.substring(0, 10). Writing an entry whose

View File

@ -82,7 +82,7 @@ void main() {
expect(AppSettingsService.dailyKcalGoal, 2200); expect(AppSettingsService.dailyKcalGoal, 2200);
}); });
test('keeps default 2200 on unparseable JSON', () async { test('keeps default 2200 on unparsable JSON', () async {
await File( await File(
'${tempDir.path}/app_settings.json', '${tempDir.path}/app_settings.json',
).writeAsString('not json at all'); ).writeAsString('not json at all');

View File

@ -127,6 +127,13 @@ min-public-methods = 0
max-module-lines = 1000 max-module-lines = 1000
max-attributes = 10 max-attributes = 10
[tool.pylint.similarities]
# _foodbank's BankRecord and _mcp's response dict both list the same five
# nutrition fields (kcal/protein_g/carbs_g/fat_g/grams) because they mirror the
# same domain schema, then diverge (desc/count vs source). Raise the threshold
# so pylint doesn't flag this intentional structural overlap as duplicate-code.
min-similarity-lines = 8
[tool.pylint.typecheck] [tool.pylint.typecheck]
generated-members = [ generated-members = [
".*\\.assert_called_once_with", ".*\\.assert_called_once_with",

View File

@ -3,7 +3,9 @@
bandit>=1.7.0 bandit>=1.7.0
codespell>=2.2.0 codespell>=2.2.0
coverage>=7.4.0 coverage>=7.4.0
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.1.0#subdirectory=crdt-sync
gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.1.0#subdirectory=gatelock gatelock @ git+https://github.com/kuhyx/utils@gatelock-v0.1.0#subdirectory=gatelock
mcp>=1.9
mypy>=1.8.0 mypy>=1.8.0
pre-commit>=3.6.0 pre-commit>=3.6.0
pylint>=3.0.0 pylint>=3.0.0

View File

@ -17,8 +17,10 @@
set -euo pipefail set -euo pipefail
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" readonly SCRIPT_DIR
REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
readonly REPO_DIR
readonly VENV_DIR="${HOME}/.venvs/diet-guard-mcp" readonly VENV_DIR="${HOME}/.venvs/diet-guard-mcp"
main() { main() {