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.
17 lines • 639 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnreachableNodeState = void 0;
const util_1 = require("./util");
function nodeLocation(node) {
const sourceFile = node.getSourceFile();
const lineAndCol = sourceFile
.getLineAndCharacterOfPosition(node.getStart());
return `${sourceFile.fileName}:${lineAndCol.line}:${lineAndCol.character}`;
}
class UnreachableNodeState extends util_1.Unreachable {
constructor(node, reason) {
super(`${reason}\nAt: ${nodeLocation(node)}`);
}
}
exports.UnreachableNodeState = UnreachableNodeState;
//# sourceMappingURL=node-util.js.map