Slide 45
Slide 45 text
Cyclomatic Complexityを計算する
var cyclomaticComplecity = 1
override func visit(_ node: TokenSyntax) -> SyntaxVisitorContinueKind {
switch node.tokenKind {
case .ifKeyword, .switchKeyword, .forKeyword, .whileKeyword, .guardKeyword, .caseKeyword:
cyclomaticComplecity += 1
case .identifier(let identifier):
if identifier == "forEach" {
cyclomaticComplecity += 1
}
…
45