Skip to content

refactor(cli): extract shared epochs validation helper#163

Open
nk-pavan-official wants to merge 4 commits into
robocurve:mainfrom
nk-pavan-official:fix-cli-epochs-helper-152
Open

refactor(cli): extract shared epochs validation helper#163
nk-pavan-official wants to merge 4 commits into
robocurve:mainfrom
nk-pavan-official:fix-cli-epochs-helper-152

Conversation

@nk-pavan-official

Copy link
Copy Markdown
Contributor

Summary

This PR refactors the CLI handling for --epochs by extracting the duplicated ConfigError handling into a shared helper. It also simplifies the error message for invalid epoch values while preserving task attribution in the eval-set path.

Changes

  • Added _apply_epochs_or_exit() next to _resolve_or_exit()
  • Moved replace(task, epochs=...) and ConfigError handling into the shared helper
  • Removed duplicated try/except blocks from _cmd_run and _cmd_eval_set
  • Moved the Task import under TYPE_CHECKING
  • Simplified the error message to --epochs must be >= 1, got N
  • Preserved task attribution for the eval-set path (--epochs must be >= 1, got N (task 'NAME'))
  • Updated the CLI tests to use exact pytest.raises(..., match=...) assertions
  • Updated CHANGELOG.md under the Unreleased section

Checklist

  • pre-commit install done; hooks pass (or ran pre-commit run --all-files)
  • Tests added/updated
  • Coverage stays at 100% (pytest --cov)
  • ruff check . and ruff format --check . pass
  • mypy passes (strict)
  • CHANGELOG.md updated under "Unreleased"
  • No public API changes
  • Core stays NumPy-only (no new dependencies)

Related

Closes #152

…back

Fixes robocurve#145. Wraps the two replace(task, epochs=...) call sites in
_cmd_run and _cmd_eval_set with a ConfigError catch, matching the
existing _resolve_or_exit pattern. eval-set names the failing task.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(cli): extract epochs ConfigError handling into a shared helper and polish the message

1 participant