Skip to content

Refactor: Extract validation to utils module #3

@scooke11

Description

@scooke11

/bounty 100

Description

Input validation logic is currently scattered across different command files (add.py, list.py, done.py). This creates code duplication and makes validation logic harder to maintain and test.

Current State

  • validate_description() in commands/add.py
  • validate_task_file() in commands/list.py
  • validate_task_id() in commands/done.py
  • Each command also has duplicate get_tasks_file() helper

Proposed Solution

  • Create new utils/validation.py module
  • Extract all validation functions to this module
  • Create utils/paths.py for shared path helpers like get_tasks_file()
  • Update all commands to import and use shared validators
  • Ensure NO behavior changes (pure refactor)

Requirements

  • Create utils/ directory with proper __init__.py
  • Move validation functions to utils/validation.py
  • Move path helpers to utils/paths.py
  • Update all command imports
  • All existing tests must still pass
  • No duplicate validation code remains

Acceptance Criteria

  • All validation logic in utils/validation.py
  • All path helpers in utils/paths.py
  • All commands updated to use shared utilities
  • Tests still pass (no behavior changes)
  • No duplicate validation code in command files

Metadata

Metadata

Assignees

No one assigned

    Labels

    💎 BountyTest bounty issue for ai-gitops workflow validation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions