Skip to content

Commit

Permalink
feat: limit dependency depth to 100 to avoid cyclic dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Oct 4, 2018
1 parent 1d773ec commit 40bb123
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,21 @@ func (i Issue) GetRelativeIssueURL(target string) string {
}

func (i Issue) BlocksAnEpic() bool {
return i.blocksAnEpic(0)
}

func (i Issue) String() string {
out, _ := json.Marshal(i)
return string(out)
}

func (i Issue) blocksAnEpic(depth int) bool {
if depth > 100 {
log.Printf("very high blocking depth (>100), do not continue. (issue=%s)", i)
return false
}
for _, dep := range i.Blocks {
if dep.IsEpic() || dep.BlocksAnEpic() {
if dep.IsEpic() || dep.blocksAnEpic(depth+1) {
return true
}
}
Expand Down

0 comments on commit 40bb123

Please sign in to comment.