Skip to content

refactor: #3 extract validation and path helpers to utils module#57

Open
tarai-dl wants to merge 1 commit intoApexOpsStudio:mainfrom
tarai-dl:az/refactor-extract-validation-utils
Open

refactor: #3 extract validation and path helpers to utils module#57
tarai-dl wants to merge 1 commit intoApexOpsStudio:mainfrom
tarai-dl:az/refactor-extract-validation-utils

Conversation

@tarai-dl
Copy link
Copy Markdown

What does this PR do?

Fixes #3 — Extracts scattered validation logic and path helpers into a shared utils/ module.

Changes

  • utils/__init__.py — package init
  • utils/paths.pyget_tasks_file() (was duplicated in all 3 command files)
  • utils/validation.pyvalidate_description(), validate_task_id(), validate_task_file()
  • Updated commands/add.py, commands/done.py, commands/list.py to import from utils
  • Updated test imports to use utils.validation
  • Added .gitignore for __pycache__/, *.pyc, .pytest_cache/

Why

Validation logic was duplicated across command files:

  • get_tasks_file() appeared in add.py, done.py, list.py
  • Each command had its own validation function with the same patterns

Verification

  • All existing tests pass
  • CLI behavior unchanged (add/list/done all work as before)
  • No duplicate validation code remains in command files

Fixes #3

…s module

- Create utils/__init__.py, utils/validation.py, utils/paths.py
- Move get_tasks_file() to utils/paths.py (was duplicated in 3 files)
- Move validate_description(), validate_task_id(), validate_task_file() to utils/validation.py
- Update commands/add.py, commands/done.py, commands/list.py to import from utils
- Update test imports to use utils.validation
- Add .gitignore for __pycache__/, *.pyc, .pytest_cache/
- All tests pass, no behavior changes

Fixes ApexOpsStudio#3
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: Extract validation to utils module

1 participant