Пример #1
0
        protected override IEnumerable <SyntaxNode> PublicApiNodes => new SyntaxNode[0]; // not calculated for VB.Net

        public override int GetComplexity(SyntaxNode node)
        {
            var possibleNodes = node
                                .DescendantNodesAndSelf()
                                .Where(n =>
                                       !n.Parent.IsKind(SyntaxKind.InterfaceBlock) &&
                                       ComplexityIncreasingKinds.Contains(n.Kind()));

            return(possibleNodes.Count(n => !IsFunctionLikeLastReturnStatement(n)));
        }
Пример #2
0
 public static int Complexity(SyntaxNode node)
 {
     return(node
            .DescendantNodesAndSelf()
            .Count(
                n =>
                // TODO What about the null coalescing operator?
                ComplexityIncreasingKinds.Contains(n.Kind()) ||
                IsReturnButNotLast(n) ||
                IsFunctionAndHasBlock(n)));
 }
Пример #3
0
 public override int GetComplexity(SyntaxNode node)
 {
     return(node
            .DescendantNodesAndSelf()
            .Count(
                n =>
                // TODO What about the null coalescing operator?
                ComplexityIncreasingKinds.Contains(n.Kind()) ||
                IsReturnButNotLast(n) ||
                IsFunctionWithBody(n)));
 }
Пример #4
0
        protected override IEnumerable <SyntaxNode> PublicApiNodes => Enumerable.Empty <SyntaxNode>(); // Not calculated for VB.Net

        private bool IsComplexityIncreasingKind(SyntaxNode node) =>
        ComplexityIncreasingKinds.Contains(node.Kind());
Пример #5
0
 protected override bool IsComplexityIncreasingKind(SyntaxNode node) =>
 ComplexityIncreasingKinds.Contains(node.Kind());