def judge
bend-lint-pack@0.1.1.0 · complexity/cyclomatic.bend:77
import bend-lint-pack@0.1.1.0/complexity/cyclomatic.bend as Cyclomatic
import Base
import bend-lint-pack@0.1.1.0/vendor/lint.bend as Lint
import bend-lint-pack@0.1.1.0/common.bend as Common
77def judge(+max: U32, seen: List<&2, Common.Seen>, out: List<&2, Lint.Diag>) -> IO(List<&2, Lint.Diag>):
78 match seen:
79 case Nil{}:
80 IO.pure(List<&2, Lint.Diag>, List.reverse(&2, Lint.Diag, out))
81 case Con{Common.Seen{+owner, span}, rest}:
82 do IO<List<&2, Lint.Diag>>:
83 body : Maybe<&2, Lint.Node> <- Lint.body(owner)
84 +score : U32 <- score.of(body)
85 judge(
86 max,
87 rest,
88 Common.onto(
89 Common.when(
90 U32.is_gt(score, max),
91 Common.diag(Lint.Warning{}, message(owner, score, max), span)
92 ),
93 out
94 )
95 )