meteor/meteor

View on GitHub

Showing 3,395 of 3,395 total issues

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

  function (test, expect) {
    Meteor.call(
      'getLastRateLimitEvent',
      expect((error, result) => {
        test.isTrue(result.reply.allowed);
Severity: Major
Found in packages/ddp-rate-limiter/ddp-rate-limiter-tests.js and 1 other location - About 6 hrs to fix
packages/ddp-rate-limiter/ddp-rate-limiter-tests.js on lines 118..128

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

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

  function (test, expect) {
    Meteor.call('getLastRateLimitEvent', expect((error, result) => {
      test.isFalse(result.reply.allowed);
      test.isTrue(result.reply.timeToReset < RATE_LIMIT_INTERVAL_TIME_MS + 100);
      test.equal(result.reply.numInvocationsLeft, 0);
Severity: Major
Found in packages/ddp-rate-limiter/ddp-rate-limiter-tests.js and 1 other location - About 6 hrs to fix
packages/ddp-rate-limiter/ddp-rate-limiter-tests.js on lines 94..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 164.

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

  _emitResources(sourceBatches, onJsOutputFiles = () => {}) {
    buildmessage.assertInJob();

    const isWeb = archinfo.matches(this.arch, 'web');
    const isOs = archinfo.matches(this.arch, 'os');
Severity: Major
Found in tools/isobuild/bundler.js - About 6 hrs to fix

    Function computeJsOutputFilesMap has 160 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static computeJsOutputFilesMap(sourceBatches) {
        const map = new Map;
    
        sourceBatches.forEach(batch => {
          const name = batch.unibuild.pkg.name || null;
    Severity: Major
    Found in tools/isobuild/compiler-plugin.js - About 6 hrs to fix

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

      if (Meteor.isClient) {
        const loginWithGithub = (options, callback) => {
          // support a callback without options
          if (! callback && typeof options === "function") {
            callback = options;
      Severity: Major
      Found in packages/accounts-github/github.js and 1 other location - About 6 hrs to fix
      packages/accounts-meetup/meetup.js on lines 3..25

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

      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

      if (Meteor.isClient) {
        const loginWithMeetup = (options, callback) => {
          // support a callback without options
          if (! callback && typeof options === "function") {
            callback = options;
      Severity: Major
      Found in packages/accounts-meetup/meetup.js and 1 other location - About 6 hrs to fix
      packages/accounts-github/github.js on lines 3..25

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

      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

          function rotation(λ, φ) {
            var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδφ + x * sinδφ;
            return [ Math.atan2(y * cosδγ - k * sinδγ, x * cosδφ - z * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδγ + y * sinδγ))) ];
          }
      Severity: Major
      Found in packages/deprecated/d3/d3.v3.js and 1 other location - About 6 hrs to fix
      packages/deprecated/d3/d3.v3.js on lines 3007..3010

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

      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.sendResetPasswordEmail = (userId, email, extraTokenData, extraParams) => {
        const {email: realEmail, user, token} =
          Accounts.generateResetToken(userId, email, 'resetPassword', extraTokenData);
        const url = Accounts.urls.resetPassword(token, extraParams);
        const options = Accounts.generateOptionsForEmail(realEmail, user, url, 'resetPassword');
      Severity: Major
      Found in packages/accounts-password/password_server.js and 1 other location - About 6 hrs to fix
      packages/accounts-password/password_server.js on lines 565..575

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

      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

          rotation.invert = function(λ, φ) {
            var cosφ = Math.cos(φ), x = Math.cos(λ) * cosφ, y = Math.sin(λ) * cosφ, z = Math.sin(φ), k = z * cosδγ - y * sinδγ;
            return [ Math.atan2(y * cosδγ + z * sinδγ, x * cosδφ + k * sinδφ), Math.asin(Math.max(-1, Math.min(1, k * cosδφ - x * sinδφ))) ];
          };
      Severity: Major
      Found in packages/deprecated/d3/d3.v3.js and 1 other location - About 6 hrs to fix
      packages/deprecated/d3/d3.v3.js on lines 3003..3006

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

      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.sendEnrollmentEmail = (userId, email, extraTokenData, extraParams) => {
        const {email: realEmail, user, token} =
          Accounts.generateResetToken(userId, email, 'enrollAccount', extraTokenData);
        const url = Accounts.urls.enrollAccount(token, extraParams);
        const options = Accounts.generateOptionsForEmail(realEmail, user, url, 'enrollAccount');
      Severity: Major
      Found in packages/accounts-password/password_server.js and 1 other location - About 6 hrs to fix
      packages/accounts-password/password_server.js on lines 535..545

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

      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 patch_splitMax has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

      diff_match_patch.prototype.patch_splitMax = function(patches) {
        var patch_size = this.Match_MaxBits;
        for (var x = 0; x < patches.length; x++) {
          if (patches[x].length1 <= patch_size) {
            continue;
      Severity: Minor
      Found in packages/test-in-browser/diff_match_patch_uncompressed.js - 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

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

      Tinytest.addAsync(
        'livedata server - verify context in async publish function',
        function(test, onComplete) {
          makeTestConnection(test, function(clientConn, serverConn) {
            var userId = 'someUserId';
      Severity: Major
      Found in packages/ddp-server/livedata_server_async_tests.js and 1 other location - About 6 hrs to fix
      packages/ddp-server/livedata_server_tests.js on lines 239..261

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

      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

      Tinytest.addAsync(
        "livedata server - verify context in publish function",
        function (test, onComplete) {
          makeTestConnection(
            test,
      Severity: Major
      Found in packages/ddp-server/livedata_server_tests.js and 1 other location - About 6 hrs to fix
      packages/ddp-server/livedata_server_async_tests.js on lines 67..94

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

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

      exports.makeCompileStep = function (sourceItem, file, inputSourceArch, options) {
        var resources = options.resources;
        var addAsset = options.addAsset;
      
        var relPath = sourceItem.relPath;
      Severity: Major
      Found in tools/isobuild/compiler-deprecated-compile-step.js - About 6 hrs to fix

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

        Meteor.startup(async () => {
          // If the Links collection is empty, add some data.
          if (await LinksCollection.find().countAsync() === 0) {
            await insertLink({
              title: 'Do the Tutorial',
        Severity: Major
        Found in tools/static-assets/skel-chakra-ui/server/main.js and 3 other locations - About 6 hrs to fix
        tools/static-assets/skel-react/server/main.js on lines 8..37
        tools/static-assets/skel-solid/server/main.js on lines 8..37
        tools/static-assets/skel-tailwind/server/main.js on lines 8..37

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

        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 4 locations. Consider refactoring.
        Open

        Meteor.startup(async () => {
          // If the Links collection is empty, add some data.
          if (await LinksCollection.find().countAsync() === 0) {
            await insertLink({
              title: 'Do the Tutorial',
        Severity: Major
        Found in tools/static-assets/skel-tailwind/server/main.js and 3 other locations - About 6 hrs to fix
        tools/static-assets/skel-chakra-ui/server/main.js on lines 8..37
        tools/static-assets/skel-react/server/main.js on lines 8..37
        tools/static-assets/skel-solid/server/main.js on lines 8..37

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

        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 4 locations. Consider refactoring.
        Open

        Meteor.startup(async () => {
          // If the Links collection is empty, add some data.
          if (await LinksCollection.find().countAsync() === 0) {
            await insertLink({
              title: 'Do the Tutorial',
        Severity: Major
        Found in tools/static-assets/skel-solid/server/main.js and 3 other locations - About 6 hrs to fix
        tools/static-assets/skel-chakra-ui/server/main.js on lines 8..37
        tools/static-assets/skel-react/server/main.js on lines 8..37
        tools/static-assets/skel-tailwind/server/main.js on lines 8..37

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

        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 4 locations. Consider refactoring.
        Open

        Meteor.startup(async () => {
          // If the Links collection is empty, add some data.
          if (await LinksCollection.find().countAsync() === 0) {
            await insertLink({
              title: 'Do the Tutorial',
        Severity: Major
        Found in tools/static-assets/skel-react/server/main.js and 3 other locations - About 6 hrs to fix
        tools/static-assets/skel-chakra-ui/server/main.js on lines 8..37
        tools/static-assets/skel-solid/server/main.js on lines 8..37
        tools/static-assets/skel-tailwind/server/main.js on lines 8..37

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

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

        var loadServerBundles = Profile("Load server bundles", function () {
          var infos = [];
        
          serverJson.load.forEach(function (fileInfo) {
            var code = fs.readFileSync(path.resolve(serverDir, fileInfo.path));
        Severity: Major
        Found in tools/static-assets/server/boot.js - About 6 hrs to fix

          File driver.js has 421 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          ////
          //// Setup
          ////
          import { diff_match_patch } from './diff_match_patch_uncompressed'
          import 'bootstrap/dist/css/bootstrap.min.css';
          Severity: Minor
          Found in packages/test-in-browser/driver.js - About 6 hrs to fix
            Severity
            Category
            Status
            Source
            Language