meteor/meteor

View on GitHub

Showing 3,395 of 3,395 total issues

File tracker_tests.js has 592 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Tinytest.add('tracker - run', function (test) {
  var d = new Tracker.Dependency;
  var x = 0;
  var handle = Tracker.autorun(function (handle) {
    d.depend();
Severity: Major
Found in packages/tracker/tracker_tests.js - About 1 day to fix

    File watch.ts has 590 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { Stats, BigIntStats, FSWatcher, Dirent } from "fs";
    import * as files from "./files";
    import * as safeWatcher from "./safe-watcher";
    import { createHash } from "crypto";
    import { coalesce } from "../utils/func-utils";
    Severity: Major
    Found in tools/fs/watch.ts - About 1 day to fix

      Function converter has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
      Open

      Showdown.converter = function(converter_options) {
      
      //
      // Globals:
      //
      Severity: Minor
      Found in packages/deprecated/markdown/showdown.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 package-client.js has 582 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var _ = require('underscore');
      
      var config = require('../meteor-services/config.js');
      var httpHelpers = require('../utils/http-helpers.js');
      var release = require('./release.js');
      Severity: Major
      Found in tools/packaging/package-client.js - About 1 day to fix

        Function _cmp has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
        Open

          _cmp(a, b) {
            if (a === undefined) {
              return b === undefined ? 0 : -1;
            }
        
        
        Severity: Minor
        Found in packages/minimongo/matcher.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 collection.js has 579 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // options.connection, if given, is a LivedataClient or LivedataServer
        // XXX presently there is no way to destroy/clean up a Collection
        import {
          ASYNC_COLLECTION_METHODS,
          getAsyncMethodName,
        Severity: Major
        Found in packages/mongo/collection.js - About 1 day to fix

          File builder.js has 574 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import assert from "assert";
          import {WatchSet, readAndWatchFile, sha1} from '../fs/watch';
          import files, {
            symlinkWithOverwrite, realpath,
          } from '../fs/files';
          Severity: Major
          Found in tools/isobuild/builder.js - About 1 day to fix

            Function findModTarget has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
            Open

            function findModTarget(doc, keyparts, options = {}) {
              let usedArrayIndex = false;
            
              for (let i = 0; i < keyparts.length; i++) {
                const last = i === keyparts.length - 1;
            Severity: Minor
            Found in packages/minimongo/local_collection.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 _maybeSetUpReplication has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
            Open

              _maybeSetUpReplication(name, { _suppressSameNameError = false }) {
                const self = this;
                if (!(self._connection && self._connection.registerStore)) {
                  return;
                }
            Severity: Minor
            Found in packages/mongo/collection.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

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

              function (test, expect) {
                Accounts.connection.call(
                  "getInterceptedEmails", this.email, expect((error, result) => {
                    test.equal(error, undefined);
                    test.notEqual(result, undefined);
            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 90..107

            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 222.

            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

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

              function (test, expect) {
                Accounts.connection.call(
                  "getInterceptedEmails", this.email, expect((error, result) => {
                    test.equal(error, undefined);
                    test.notEqual(result, undefined);
            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 28..45

            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 222.

            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 initHtml4 has 232 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                History.initHtml4 = function(){
                    // Initialise
                    if ( typeof History.initHtml4.initialized !== 'undefined' ) {
                        // Already Loaded
                        return false;
            Severity: Major
            Found in packages/deprecated/jquery-history/history.html4.js - About 1 day to fix

              File tinytest.js has 542 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import isEqual from "lodash.isequal";
              
              /******************************************************************************/
              /* TestCaseResults                                                            */
              /******************************************************************************/
              Severity: Major
              Found in packages/tinytest/tinytest.js - About 1 day to fix

                File builder.js has 537 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import _ from 'underscore';
                import url from 'url';
                import { Console } from '../console/console.js';
                import buildmessage from '../utils/buildmessage.js';
                import files from '../fs/files';
                Severity: Major
                Found in tools/cordova/builder.js - About 1 day to fix

                  Function _getAnswer has 220 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  CS.Solver.prototype._getAnswer = function (options) {
                    var self = this;
                    var input = self.input;
                    var analysis = self.analysis;
                    var cache = input.catalogCache;
                  Severity: Major
                  Found in packages/constraint-solver/solver.js - About 1 day to fix

                    Function publishPackage has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
                    Open

                    exports.publishPackage = function (options) {
                      buildmessage.assertInJob();
                      var packageSource = options.packageSource;
                      var conn = options.connection;
                      var projectContext = options.projectContext;
                    Severity: Minor
                    Found in tools/packaging/package-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

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

                    for (let i = 0; i < numGroups; i++) {
                      try {
                        const data = fs.readFileSync(`../../tmp/results/junit/${i}.xml`);
                        parser.parseString(data, (err, { testsuites: { testsuite } }) => {
                          (testsuite || [])
                    Severity: Major
                    Found in scripts/test-balancer/index.js and 1 other location - About 1 day to fix
                    npm-packages/eslint-plugin-meteor/scripts/test-balancer/index.js on lines 13..29

                    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 210.

                    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

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

                    for (let i = 0; i < numGroups; i++) {
                      try {
                        const data = fs.readFileSync(`../../tmp/results/junit/${i}.xml`);
                        parser.parseString(data, (err, { testsuites: { testsuite } }) => {
                          (testsuite || [])
                    scripts/test-balancer/index.js on lines 13..29

                    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 210.

                    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 publishPackage has 216 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.publishPackage = function (options) {
                      buildmessage.assertInJob();
                      var packageSource = options.packageSource;
                      var conn = options.connection;
                      var projectContext = options.projectContext;
                    Severity: Major
                    Found in tools/packaging/package-client.js - About 1 day to fix

                      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 => {
                      Severity: Major
                      Found in scripts/test-balancer/index.js and 1 other location - About 1 day to fix
                      npm-packages/eslint-plugin-meteor/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

                      Severity
                      Category
                      Status
                      Source
                      Language