Skip to content

refactor: extract validation and path utilities (fixes #3)#1

Open
autogainz wants to merge 2 commits intomainfrom
refactor/extract-validation-utils
Open

refactor: extract validation and path utilities (fixes #3)#1
autogainz wants to merge 2 commits intomainfrom
refactor/extract-validation-utils

Conversation

@autogainz
Copy link
Owner

Summary

Extracted scattered validation logic and duplicate path helpers into dedicated utility modules to improve code organization and reduce duplication.

Changes

  • Created commands/utils_validation.py with centralized validation functions:
    • validate_description() - validates task description length and content
    • validate_task_file() - validates tasks file exists
    • validate_task_id() - validates task ID is in valid range
  • Created commands/utils_paths.py with path utilities:
    • get_tasks_file() - centralized path to tasks.json (was duplicated in add.py, list.py, done.py)

Benefits

  • Eliminates 3 duplicate get_tasks_file() implementations
  • Centralizes all validation logic for easier maintenance
  • Improves code reusability across commands
  • Makes validation rules consistent across the codebase

Testing

Validation functions maintain identical behavior to original scattered implementations. All existing task operations continue to work as expected.

Payment

Bounty payment address (EVM/USDC on Base): 0xC50982e88dae25cf117a7eee7B489bc8a1FFD21a
Alternative (SOL): 9V75782FPZtTm4oS71ZeMU6Awv2WW3XuUr4dnLhgJ18P

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.

1 participant