Skip to content

Cron Utilities: Parse, Lint, Simplify #7

@niteshpurohit

Description

@niteshpurohit

Feature Request

Description

Add convenience methods for validating, simplifying, and linting cron expressions.

Use Case

Developers need feedback and safer defaults when authoring schedules.

Proposed Solution

  • Implement:
    • RailsCrons.valid?(expr) -> true/false
    • RailsCrons.simplify(expr) -> string (e.g., "@daily")
    • RailsCrons.lint(expr) -> Array<String> for warnings/errors (e.g., step out of range).
  • Use fugit as the underlying parser for robustness.
  • Provide helpful messages and examples in errors.

Alternatives Considered

Homegrown parser — rejected to reduce maintenance.

Additional Context

Ensure compatibility with standard 5-field cron and predefined macros like @daily, @weekly.

Checklist

  • I have searched for a similar feature request and didn't find any duplicates.
  • I have included all the required information.
  • I have tagged the issue with the label "enhancement".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions