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

Function findReferencingTasks

apps/cli/internal/cli/rm.go:151–169  ·  view source on GitHub ↗

findReferencingTasks returns tasks that reference the given task ID via their Dependencies or Parent fields.

(taskID string, tasks []*model.Task)

Source from the content-addressed store, hash-verified

149// findReferencingTasks returns tasks that reference the given task ID
150// via their Dependencies or Parent fields.
151func findReferencingTasks(taskID string, tasks []*model.Task) []*model.Task {
152 var refs []*model.Task
153 for _, t := range tasks {
154 if t.ID == taskID {
155 continue
156 }
157 if t.Parent == taskID {
158 refs = append(refs, t)
159 continue
160 }
161 for _, dep := range t.Dependencies {
162 if dep == taskID {
163 refs = append(refs, t)
164 break
165 }
166 }
167 }
168 return refs
169}
170
171// formatReferencingTasks formats a list of referencing tasks for display.
172func formatReferencingTasks(tasks []*model.Task) string {

Callers 1

checkTaskReferencesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected