UNPKG

cognitive-complexity-ts

Version:

This program analyses TypeScript and JavaScript code according to the [Cognitive Complexity metric](https://www.sonarsource.com/docs/CognitiveComplexity.pdf). It produces a JSON summary and a GUI for exploring the complexity of your codebase.

18 lines (17 loc) 1.31 kB
import * as ts from "typescript"; import { ColumnAndLine } from "../../shared/types"; export type ForLikeStatement = ts.ForStatement | ts.ForInOrOfStatement; export type FunctionNode = ts.AccessorDeclaration | ts.ArrowFunction | ts.FunctionDeclaration | ts.FunctionExpression | ts.MethodDeclaration; export declare function getColumnAndLine(node: ts.Node): ColumnAndLine; export declare function getIdentifier(node: ts.Node): string | undefined; export declare function getFirstNonParenthesizedAncestor(node: ts.Node): ts.Node; export declare function getTextWithoutBrackets(node: ts.Node): string; export declare function isBinaryTypeOperator(node: ts.Node): node is ts.UnionOrIntersectionTypeNode; export declare function isBreakOrContinueToLabel(node: ts.Node): boolean; export declare function isContainer(node: ts.Node): boolean; export declare function isForLikeStatement(node: ts.Node): node is ForLikeStatement; export declare function isFunctionNode(node: ts.Node): node is FunctionNode; export declare function isSequenceOfDifferentBooleanOperations(node: ts.Node): boolean; export declare function isSyntaxList(node: ts.Node): node is ts.SyntaxList; export declare function passThroughNameBeingAssigned(node: ts.Node): boolean; export declare function report(node: ts.Node, depth?: number): void;