meteor/meteor

View on GitHub

Showing 3,395 of 3,395 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

currentBuildResults.forEach(({ name }) => {
  const times = [];

  // Check each build result to see if the test was run
  allBuildResults.forEach(buildResults => {
scripts/test-balancer/index.js on lines 54..71

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 207.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function _retrySubscription has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
Open

Autoupdate._retrySubscription = () => {
  Meteor.subscribe("meteor_autoupdate_clientVersions", {
    onError(error) {
      Meteor._debug("autoupdate subscription failed", error);
      failures++;
Severity: Minor
Found in packages/autoupdate/autoupdate_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

Function brush has 213 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  d3.svg.brush = function() {
    var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"), x = null, y = null, resizes = d3_svg_brushResizes[0], extent = [ [ 0, 0 ], [ 0, 0 ] ], extentDomain;
    function brush(g) {
      g.each(function() {
        var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
Severity: Major
Found in packages/deprecated/d3/d3.v3.js - About 1 day to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          if (u == rect.dx) {
            if (flush || v > rect.dy) v = rect.dy;
            while (++i < n) {
              o = row[i];
              o.x = x;
    Severity: Major
    Found in packages/deprecated/d3/d3.v3.js and 1 other location - About 1 day to fix
    packages/deprecated/d3/d3.v3.js on lines 6234..6247

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 205.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          } else {
            if (flush || v > rect.dx) v = rect.dx;
            while (++i < n) {
              o = row[i];
              o.x = x;
    Severity: Major
    Found in packages/deprecated/d3/d3.v3.js and 1 other location - About 1 day to fix
    packages/deprecated/d3/d3.v3.js on lines 6221..6234

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 205.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      Accounts.connection.call(
        "getInterceptedEmails", email, expect((error, result) => {
          test.equal(error, undefined);
          test.notEqual(result, undefined);
          test.equal(result.length, 1);
    Severity: Major
    Found in packages/accounts-password/email_tests.js and 1 other location - About 1 day to fix
    packages/accounts-password/email_tests.js on lines 135..150

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 204.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      Accounts.connection.call(
        "getInterceptedEmails", email, expect((error, result) => {
          test.equal(error, undefined);
          test.notEqual(result, undefined);
          test.equal(result.length, 1);
    Severity: Major
    Found in packages/accounts-password/email_tests.js and 1 other location - About 1 day to fix
    packages/accounts-password/email_tests.js on lines 264..280

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 204.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
      // Cache the text lengths to prevent multiple calls.
      var text1_length = text1.length;
      var text2_length = text2.length;
      var max_d = Math.ceil((text1_length + text2_length) / 2);
    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 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

                  Similar blocks of code found in 3 locations. Consider refactoring.
                  Open

                    testScanVersions(["1.0.0", "1.0.1", "1.0.2", "1.0.3",
                                      "1.1.0", "1.1.1",
                                      "1.2.0-pre.0", "1.2.0", "1.2.1", "1.2.2-pre.0", "1.2.2",
                                      "2.0.0", "2.0.1", "2.0.2",
                                      "2.1.0",
                  Severity: Major
                  Found in packages/constraint-solver/version-pricer-tests.js and 2 other locations - About 7 hrs to fix
                  packages/constraint-solver/version-pricer-tests.js on lines 107..137
                  packages/constraint-solver/version-pricer-tests.js on lines 139..169

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 187.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language