Skip to content

Commit 40bb123

Browse files
committed
feat: limit dependency depth to 100 to avoid cyclic dependencies
1 parent 1d773ec commit 40bb123

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Diff for: issue.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,21 @@ func (i Issue) GetRelativeIssueURL(target string) string {
284284
}
285285

286286
func (i Issue) BlocksAnEpic() bool {
287+
return i.blocksAnEpic(0)
288+
}
289+
290+
func (i Issue) String() string {
291+
out, _ := json.Marshal(i)
292+
return string(out)
293+
}
294+
295+
func (i Issue) blocksAnEpic(depth int) bool {
296+
if depth > 100 {
297+
log.Printf("very high blocking depth (>100), do not continue. (issue=%s)", i)
298+
return false
299+
}
287300
for _, dep := range i.Blocks {
288-
if dep.IsEpic() || dep.BlocksAnEpic() {
301+
if dep.IsEpic() || dep.blocksAnEpic(depth+1) {
289302
return true
290303
}
291304
}

0 commit comments

Comments
 (0)