MCPcopy Create free account
hub / github.com/driangle/taskmd / runSetVerification

Function runSetVerification

apps/cli/internal/cli/set.go:398–435  ·  view source on GitHub ↗

runSetVerification runs verify checks if --verify is set and status is being set to completed.

(task *model.Task, req taskfile.UpdateRequest)

Source from the content-addressed store, hash-verified

396
397// runSetVerification runs verify checks if --verify is set and status is being set to completed.
398func runSetVerification(task *model.Task, req taskfile.UpdateRequest) error {
399 if !setVerify {
400 return nil
401 }
402 isCompleting := req.Status != nil && *req.Status == string(model.StatusCompleted)
403 if !isCompleting {
404 return nil
405 }
406 if len(task.Verify) == 0 {
407 return nil
408 }
409
410 if errs := model.ValidateVerifySteps(task.Verify); len(errs) > 0 {
411 return fmt.Errorf("invalid verify steps:\n %s", strings.Join(errs, "\n "))
412 }
413
414 flags := GetGlobalFlags()
415 projectRoot := resolveProjectRoot()
416 opts := verify.Options{
417 ProjectRoot: projectRoot,
418 FailFast: true,
419 Timeout: 60 * time.Second,
420 Verbose: flags.Verbose,
421 LogFunc: func(format string, args ...any) {
422 if !flags.Quiet {
423 fmt.Fprintf(os.Stderr, format+"\n", args...)
424 }
425 },
426 }
427
428 vResult := verify.Run(task.Verify, opts)
429 printVerifyTable(vResult)
430
431 if vResult.HasFailures() {
432 return fmt.Errorf("verification failed: %d check(s) failed — status change aborted", vResult.Failed)
433 }
434 return nil
435}
436
437// parseCommaSeparatedIDs splits a comma-separated string into a slice of trimmed IDs.
438// An empty string returns an empty slice (used to clear the field).

Callers 1

runSetFunction · 0.85

Calls 4

GetGlobalFlagsFunction · 0.85
resolveProjectRootFunction · 0.85
printVerifyTableFunction · 0.85
HasFailuresMethod · 0.80

Tested by

no test coverage detected