validate method
Implementation
@override
Future<ValidationCheck> validate(ReleaseContext context) async {
final isRepo = await _gitClient.isGitRepository(context.projectPath);
if (!isRepo) {
return ValidationCheck(
name: name,
status: CheckStatus.warning,
message: 'Directory is not a Git repository.',
);
}
final branch =
await _gitClient.getCurrentBranch(context.projectPath) ?? 'unknown';
final isClean = await _gitClient.hasCleanWorkingTree(context.projectPath);
if (!isClean) {
final allowDirty = context.config.allowDirty || context.allowDirty;
if (allowDirty) {
return ValidationCheck(
name: name,
status: CheckStatus.warning,
message: 'Working tree has uncommitted changes (Branch: $branch)',
details: 'Allowed via --allow-dirty',
);
} else {
return ValidationCheck(
name: name,
status: CheckStatus.failed,
message: 'Working tree has uncommitted changes (Branch: $branch)',
details: 'Commit or stash changes, or use --allow-dirty',
);
}
}
return ValidationCheck(
name: name,
status: CheckStatus.passed,
message: 'Git repository clean (Branch: $branch)',
);
}