Showing 13 of 315 total issues
Function getMetadata
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getMetadata = (filePath): FileMeta => {
const sourceFile = program.getSourceFile(filePath);
const result: FileMeta = {
filePath,
inputs: [],
Function generateDocsForPackage
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
const generateDocsForPackage = (name: string): void => {
const rootDir = path.resolve(__dirname, '..');
const fullApi = [];
const visitFile = ({ filePath, gitHubUrl }) => {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function generateDocsForPackage
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
const generateDocsForPackage = (name: string): void => {
const rootDir = path.resolve(__dirname, '..');
const fullApi = [];
const visitFile = ({ filePath, gitHubUrl }) => {
Function generateJasmineMemberMatcher
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateJasmineMemberMatcher = (file: FileMeta): void => {
try {
const { jasmineMemberMatcherPath, jsDoc, matcherInputs, matcherInputsWithoutTypes, name } =
file;
const { description, matcherMessage, memberMatcherName, matcherNotMessage, params } = jsDoc;
Function getMetadata
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const getMetadata = (filePath): FileMeta => {
const sourceFile = program.getSourceFile(filePath);
const result: FileMeta = {
filePath,
inputs: [],
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function generateJasmineMatcher
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateJasmineMatcher = (file: FileMeta): void => {
try {
const { jasmineMatcherPath, jsDoc, matcherInputs, matcherInputsWithoutTypes, name } = file;
const { description, matcherMessage, matcherName, matcherNotMessage, params } = jsDoc;
const utilImports = matcherInputs.length > 0 ? 'printExpected, printReceived' : 'printReceived';
Function generateJestMatcher
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateJestMatcher = (file: FileMeta): void => {
try {
const { jestMatcherPath, jsDoc, matcherInputs, matcherInputsWithoutTypes, name } = file;
const { description, matcherMessage, matcherName, matcherNotMessage, params } = jsDoc;
const utilImports = matcherInputs.length > 0 ? 'printExpected, printReceived' : 'printReceived';
Function treeWalker
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function* treeWalker(rootNode: any): Generator<TreeNode, void> {
function* visit(node: TreeNode): Generator<TreeNode, void> {
yield node;
if (isArray(node.value)) {
for (let i = 0, len = node.value.length; i < len; i++) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function visitNode
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const visitNode = (node) => {
if (node.jsDoc) {
const [jsDocComment] = node.jsDoc;
result.jsDoc.description = unwrap(jsDocComment.comment);
jsDocComment.tags.forEach(({ comment, name, tagName }) => {
Function generateJestMatcherTest
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const generateJestMatcherTest = (file: FileMeta): void => {
const { jestMatcherTestPath, jsDoc } = file;
const { matcherName, params } = jsDoc;
let comment = '';
let valueExample = params.find(({ name }) => name === 'value').exampleValue;
Function visitNode
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const visitNode = (node) => {
switch (node.kind) {
case ts.SyntaxKind.InterfaceDeclaration:
const isAsymmetricMatcher = node.name.text === 'Expect';
const isMatcher = node.name.text === 'Matchers';
Function curry3
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function curry3<R>(fn: Fn3<R>): CurriedFn3<R> {
return function curriedFn3(c, b, a) {
const len = arguments.length;
if (len >= 3) return fn(c, b, a);
if (len >= 2) return curry1<R>(fn.bind(null, c, b));
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function permutingTreeWalker
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function* permutingTreeWalker(rootNode: any, visitor: DeepNodeVisitor): Generator<any, void> {
const traverser = annotatedTreeWalker(rootNode);
for (const node of traverser) {
if (isDeepNode(node)) {
let permutation;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"