evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a commit message validator that enforces or warns about subject length limits with configurable strictness levels.
Git commit messages should be concise and well-formatted. A common convention is to limit the subject line (the first line) to a maximum length, typically 50-72 characters. However, teams may want different levels of enforcement: some teams want to strictly block commits that exceed this limit, while others prefer gentle warnings that allow developers to proceed anyway.
Create a validator function that checks commit message subject length against a maximum limit. The validator should support two modes:
Your function should accept:
Return an object with:
valid: boolean indicating if the subject length is within the limitmessage: string describing the validation result (error or warning text, or success message)severity: string indicating "error", "warning", or "success"export interface ValidationResult {
valid: boolean;
message: string;
severity: 'success' | 'warning' | 'error';
}
export interface ValidatorOptions {
maxSubjectLength?: number;
ignoreCheckMaxSubjectLength?: boolean;
}
export function validateSubjectLength(
subject: string,
options?: ValidatorOptions
): ValidationResult;Provides interactive commit message generation with configurable validation modes.