jbenden/vscode-c-cpp-flylint

View on GitHub
specs/debug-console/logger.ts

Summary

Maintainability
C
7 hrs
Test Coverage

Function formatTestSummary has a Cognitive Complexity of 28 (exceeds 15 allowed). Consider refactoring.
Open

function formatTestSummary(text: string): string {
    if (!text.includes('\n')) {
        return '';
    }

Severity: Minor
Found in specs/debug-console/logger.ts - About 2 hrs to fix

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 formatSnapshotMessage has a Cognitive Complexity of 18 (exceeds 15 allowed). Consider refactoring.
Open

function formatSnapshotMessage(text: string): string {
    if (text.endsWith('updated.') || text.endsWith('written.') || text.endsWith('removed.')) {
        return bold(green(text));
    }

Severity: Minor
Found in specs/debug-console/logger.ts - About 45 mins to fix

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

Avoid too many return statements within this function.
Open

        return formatSnapshotSummary(text, 'written', green);
Severity: Major
Found in specs/debug-console/logger.ts - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return `${formatSnapshotSummary(text, 'failed', red)} ${darkGray(
                'Inspect your code changes or re-run jest with `JEST_RUNNER_UPDATE_SNAPSHOTS=true` to update them.'
            )}`;
    Severity: Major
    Found in specs/debug-console/logger.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return formatSnapshotSummary(text, 'removed', green);
      Severity: Major
      Found in specs/debug-console/logger.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return `   ↳ ${darkGray(`${testPath}/`)}${bold(testFilename)}`;
        Severity: Major
        Found in specs/debug-console/logger.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return '';
          Severity: Major
          Found in specs/debug-console/logger.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return '';
            Severity: Major
            Found in specs/debug-console/logger.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return formatSnapshotSummary(text, 'updated', green);
              Severity: Major
              Found in specs/debug-console/logger.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return ` ${bold(
                                green(`› ${numSnapshots} snapshot ${Number(numSnapshots) > 1 ? 'files' : 'file'} removed`)
                            )} from ${numTestSuites} ${Number(numTestSuites) > 1 ? 'test suites' : 'test suite'}.`;
                Severity: Major
                Found in specs/debug-console/logger.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return `${formatSnapshotSummary(text, 'obsolete', yellow)} ${darkGray(
                              'To remove them all, re-run jest with `JEST_RUNNER_UPDATE_SNAPSHOTS=true`.'
                          )}`;
                  Severity: Major
                  Found in specs/debug-console/logger.ts - About 30 mins to fix

                    There are no issues that match your filters.

                    Category
                    Status