meteor/meteor

View on GitHub

Showing 2,031 of 3,395 total issues

Function patch_apply has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

diff_match_patch.prototype.patch_apply = function(patches, text) {
  if (patches.length == 0) {
    return [text, []];
  }

Severity: Minor
Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 1 day 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 testSubtree has 210 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const testSubtree = (value, pattern, collectErrors = false, errors = [], path = '') => {
  // Match anything!
  if (pattern === Match.Any) {
    return false;
  }
Severity: Major
Found in packages/check/match.js - About 1 day to fix

    File showdown.js has 513 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    //
    // showdown.js -- A javascript port of Markdown.
    //
    // Copyright (c) 2007 John Fraser.
    //
    Severity: Major
    Found in packages/deprecated/markdown/showdown.js - About 1 day to fix

      Function _populateWarehouseForRelease has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

        _populateWarehouseForRelease: function (releaseVersion, showInstalling) {
          var releasesDir = files.pathJoin(warehouse.getWarehouseDir(), 'releases');
          files.mkdir_p(releasesDir, 0o755);
          var releaseManifestPath = files.pathJoin(releasesDir,
                                                   releaseVersion + '.release.json');
      Severity: Minor
      Found in tools/packaging/warehouse.js - About 1 day 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 force has 203 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        d3.layout.force = function() {
          var force = {}, event = d3.dispatch("start", "tick", "end"), size = [ 1, 1 ], drag, alpha, friction = .9, linkDistance = d3_layout_forceLinkDistance, linkStrength = d3_layout_forceLinkStrength, charge = -30, gravity = .1, theta = .8, nodes = [], links = [], distances, strengths, charges;
          function repulse(node) {
            return function(quad, x1, _, x2) {
              if (quad.point !== node) {
      Severity: Major
      Found in packages/deprecated/d3/d3.v3.js - About 1 day to fix

        Function callLoginMethod has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
        Open

          callLoginMethod(options) {
            options = {
              methodName: 'login',
              methodArguments: [{}],
              _suppressLoggingIn: false,
        Severity: Minor
        Found in packages/accounts-base/accounts_client.js - About 1 day 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

        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

          AccountsServer has 55 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export class AccountsServer extends AccountsCommon {
            // Note that this constructor is less likely to be instantiated multiple
            // times than the `AccountsClient` constructor, because a single server
            // can provide only one set of methods.
            constructor(server, options) {
          Severity: Major
          Found in packages/accounts-base/accounts_server.js - About 7 hrs to fix

            Function request has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
            Open

              request: function (urlOrOptions, callback) {
                var options;
                if (!_.isObject(urlOrOptions)) {
                  options = { url: urlOrOptions };
                } else {
            Severity: Minor
            Found in tools/utils/http-helpers.js - About 7 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

            File login_buttons_dropdown.js has 486 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {passwordlessSignupFields, passwordSignupFields} from './accounts_ui.js';
            import {
              displayName,
              getLoginServices,
              hasPasswordService,
            Severity: Minor
            Found in packages/accounts-ui-unstyled/login_buttons_dropdown.js - About 7 hrs to fix

              Function buildCommand has 191 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var buildCommand = function (options) {
                Console.setVerbose(!!options.verbose);
                if (options.headless) {
                  // There's no point in spinning the spinner when we're running
                  // automated builds.
              Severity: Major
              Found in tools/cli/commands.js - About 7 hrs to fix

                Function _inferHelper has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                Open

                BCp._inferHelper = function (inputFile, cacheEntry) {
                  if (! cacheEntry.controlFileData) {
                    return false;
                  }
                
                
                Severity: Minor
                Found in packages/babel-compiler/babel-compiler.js - About 7 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 diff_cleanupMerge has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                Open

                diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
                  // Add a dummy entry at the end.
                  diffs.push(new diff_match_patch.Diff(DIFF_EQUAL, ''));
                  var pointer = 0;
                  var count_delete = 0;
                Severity: Minor
                Found in packages/test-in-browser/diff_match_patch_uncompressed.js - About 7 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

                Console has 52 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class Console extends ConsoleBase {
                  constructor(options) {
                    super();
                
                    options = options || Object.create(null);
                Severity: Major
                Found in tools/console/console.js - About 7 hrs to fix

                  File utils.js has 472 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  var _ = require('underscore');
                  var semver = require('semver');
                  var os = require('os');
                  var url = require('url');
                  
                  
                  Severity: Minor
                  Found in tools/utils/utils.js - About 7 hrs to fix

                    File minimongo_tests_server.js has 462 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    Tinytest.add('minimongo - modifier affects selector', test => {
                      function testSelectorPaths(sel, paths, desc) {
                        const matcher = new Minimongo.Matcher(sel);
                        test.equal(matcher._getPaths(), paths, desc);
                      }
                    Severity: Minor
                    Found in packages/minimongo/minimongo_tests_server.js - About 7 hrs to fix

                      Function bundleAndDeploy has 173 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export async function bundleAndDeploy(options) {
                        if (options.recordPackageUsage === undefined) {
                          options.recordPackageUsage = true;
                        }
                      
                      
                      Severity: Major
                      Found in tools/meteor-services/deploy.js - About 6 hrs to fix

                        Function startNewWatcher has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function startNewWatcher(absPath: string): Entry {
                          let stat: Stats | BigIntStats | null | undefined = null;
                        
                          if (DEDUPLICATE_BY_INO) {
                            stat = statOrNull(absPath);
                        Severity: Minor
                        Found in tools/fs/safe-watcher.ts - About 6 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 doTestCommand has 171 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function doTestCommand(options) {
                          // This "metadata" is accessed in a few places. Using a global
                          // variable here was more expedient than navigating the many layers
                          // of abstraction across the build process.
                          //
                        Severity: Major
                        Found in tools/cli/commands.js - About 6 hrs to fix

                          Connection has 49 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          export class Connection {
                            constructor(url, options) {
                              const self = this;
                          
                              this.options = options = {
                          Severity: Minor
                          Found in packages/ddp-client/common/livedata_connection.js - About 6 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language