meteor/meteor

View on GitHub
tools/tool-testing/selftest.js

Summary

Maintainability
D
2 days
Test Coverage

File selftest.js has 494 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { inspect } from 'util';
import * as files from '../fs/files';
import { createHash } from 'crypto';
import {
  markBottom as parseStackMarkBottom,
Severity: Minor
Found in tools/tool-testing/selftest.js - About 7 hrs to fix

    Function saveJUnitOutput has 78 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      saveJUnitOutput(path) {
        const grouped = groupTestsByFile(this.filteredTests);
    
        // We'll form an collection of "testsuites"
        const testSuites = [];
    Severity: Major
    Found in tools/tool-testing/selftest.js - About 3 hrs to fix

      Function getFilteredTests has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getFilteredTests(options) {
        options = options || {};
        let allTests = getAllTests();
        let testState;
      
      
      Severity: Major
      Found in tools/tool-testing/selftest.js - About 2 hrs to fix

        Function runTests has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function runTests(options) {
          const testList = getFilteredTests(options);
        
          if (! testList.allTests.length) {
            Console.error("No tests defined.");
        Severity: Major
        Found in tools/tool-testing/selftest.js - About 2 hrs to fix

          Function getFilteredTests has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function getFilteredTests(options) {
            options = options || {};
            let allTests = getAllTests();
            let testState;
          
          
          Severity: Minor
          Found in tools/tool-testing/selftest.js - 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 constructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(allTests, tagsToSkip, tagsToMatch, testState) {
              tagsToSkip = (tagsToSkip || []);
              testState = (testState || null); // optional
              this.allTests = allTests;
              this.failedTests = [];
          Severity: Minor
          Found in tools/tool-testing/selftest.js - About 1 hr to fix

            Function runTests has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

            export function runTests(options) {
              const testList = getFilteredTests(options);
            
              if (! testList.allTests.length) {
                Console.error("No tests defined.");
            Severity: Minor
            Found in tools/tool-testing/selftest.js - About 1 hr 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 constructor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              constructor(allTests, tagsToSkip, tagsToMatch, testState) {
                tagsToSkip = (tagsToSkip || []);
                testState = (testState || null); // optional
                this.allTests = allTests;
                this.failedTests = [];
            Severity: Minor
            Found in tools/tool-testing/selftest.js - About 35 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 false;
            Severity: Major
            Found in tools/tool-testing/selftest.js - About 30 mins to fix

              Function shouldSkipCurrentTest has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              const shouldSkipCurrentTest = ({currentTestIndex, options: {skip, limit} = {}}) => {
                if (!skip && !limit) {
                  return false;
                }
                if (limit && skip) {
              Severity: Minor
              Found in tools/tool-testing/selftest.js - About 25 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

              There are no issues that match your filters.

              Category
              Status