Commit Graph
3 Commits
Author SHA1 Message Date
oqyude 8af1d9a010 D2: починить lint-гейт — ruff check . проходит
Было: `ruff check .` → 10 ошибок, CI-гейт на ruff был бы красным сразу.
- 9× I001 (порядок импортов) — application/forecast.py:1,
  application/scenarios.py:1, domain/currency.py:1,
  infrastructure/ai/assistant.py:1, infrastructure/cli/app.py:11,
  infrastructure/cli/commands/init.py:2, infrastructure/cli/services.py:2,
  tests/test_model.py:1, tests/test_repositories.py:1
- 1× E501 — infrastructure/cli/services.py:30, сигнатура build_services
  перенесена на три строки

Поведение не меняется: переупорядочены только импорты, убраны пустые
строки, перенесена длинная сигнатура. Порядок импорта в app.py не влияет
на момент вызова setup_i18n() — он по-прежнему после импорта команд.

Проверка: 75/75 тестов зелёные, ruff check . — All checks passed.
2026-10-23 18:29:48 +03:00
oqyude d58547e8f8 T8: ISO 4217 per-currency decimals + format_money()
- Add CURRENCY_DECIMALS dict (JPY=0, BHD/KWD/OMR=3, rest=2) and DEFAULT_CURRENCY_DECIMALS=2
- Add CurrencyConverter.format_money() staticmethod with ROUND_HALF_UP; symbol-prefix for known, code-prefix for unknown
- Replace 14 :,.2f literals across services.py / info.py / config_cmd.py with format_money() calls
- Refactor 2 i18n templates (transaction_add.ok, recurring_add.ok): {amount:.2f} -> {amount_str}; callers pass pre-formatted string
- New _account_currency() helper for transaction currency lookup
- Extend test_currency.py: 8 new tests (JPY/BHD/USD/CHF/negative/zero/float-int/lowercase)
- 75/75 tests pass; 0 :,.2f literals remain in infrastructure/cli/
2026-10-09 19:24:47 +03:00
oqyude b6b64a9878 T6: Decompose CLI — main.py → 9 command files, config.py → config_cmd.py
Split infrastructure/cli/:
- main.py (330 LOC) → 9 files in infrastructure/cli/commands/:
  * init.py, forecast.py, scenario.py, whatif.py, compare.py
  * import_xlsx.py, export_xlsx.py, analyze.py, info.py
- config.py (428 LOC) → commands/config_cmd.py (15 sub-commands)
- main.py → app.py (entry point: registers all commands)
- New: paths.py (MODEL_PATH, DATA_DIR)
- New: services.py (composition root + helpers: load_model, save_model,
  build_services, resolve_currency, convert_value, fmt_amount)
- cli/__init__.py (empty) удалён

Each command module: <100 LOC.
pyproject.toml: cf = infrastructure.cli.app:app
tests/test_cli.py: import обновлён на infrastructure.cli.app

CLI behavior идентично, все команды работают.
Tests: 67/67 pass.
2026-10-08 16:56:49 +03:00