From 40bb123d396c6ca842b3ed6a3b827663d85099a0 Mon Sep 17 00:00:00 2001 From: Manfred Touron Date: Thu, 4 Oct 2018 17:32:48 +0200 Subject: [PATCH] feat: limit dependency depth to 100 to avoid cyclic dependencies --- issue.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/issue.go b/issue.go index cb63e597b..9fb04342f 100644 --- a/issue.go +++ b/issue.go @@ -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 } }