TaskValidator.Validators.CategoryValidator (TaskValidator v0.9.1)

View Source

Validates task category assignment based on task ID numbers.

This validator ensures that tasks are properly categorized based on their task ID numbers. It supports both standard categories and custom category configurations. Category-specific section validation is handled by the SectionValidator.

Validation Rules

  1. Category Assignment: Tasks are categorized based on ID number ranges (Elixir/Phoenix-specific)

    • OTP/GenServer (001-099): Supervision trees, GenServers, Agents
    • Phoenix Web (100-199): Controllers, views, LiveView, channels
    • Business Logic (200-299): Contexts, schemas, core logic
    • Data Layer (300-399): Ecto schemas, migrations, repos
    • Infrastructure (400-499): Releases, deployment, monitoring
    • Testing (500-599): Unit, integration, property-based tests
  2. ID Format Support: Handles multiple ID formats

    • Standard format: SSH001, VAL0004 (extracts number for categorization)
    • Custom format: PROJ-001, CORE-123 (extracts number after dash)
  3. Configurable Categories: Category ranges configurable

    • Default ranges can be overridden in configuration
    • Custom categories can be defined with specific ranges

Error Types

  • :invalid_category_range - Task ID number doesn't fit any category
  • :invalid_id_for_categorization - Cannot extract number for categorization

Examples

# Task ID OTP001 -> Category :otp_genserver (range 1-99)
# Task ID PHX101 -> Category :phoenix_web (range 100-199)
# Task ID CTX201 -> Category :business_logic (range 200-299)
# Task ID DB301 -> Category :data_layer (range 300-399)
# Task ID INF401 -> Category :infrastructure (range 400-499)
# Task ID TST501 -> Category :testing (range 500-599)

# Also supports custom formats:
# Task ID PROJ-001 -> Category :otp_genserver
# Task ID CORE-123 -> Category :phoenix_web

Summary

Functions

Returns low priority (35) since category validation is useful for organization but not critical for basic task functionality.

Validates task category assignment and category-specific requirements.

Functions

priority()

Returns low priority (35) since category validation is useful for organization but not critical for basic task functionality.

validate(task, context)

Validates task category assignment and category-specific requirements.

Context Requirements

  • :config - TaskValidator configuration (optional, uses defaults)

Returns

  • Success if all category validations pass
  • Failure with specific error details for each validation issue