meteor/meteor

View on GitHub
packages/ddp-server/livedata_server.js

Summary

Maintainability
F
1 wk
Test Coverage

File livedata_server.js has 1208 lines of code (exceeds 250 allowed). Consider refactoring.
Open

DDPServer = {};

var Fiber = Npm.require('fibers');

// Publication strategies define how we handle data from published cursors at the collection level
Severity: Major
Found in packages/ddp-server/livedata_server.js - About 3 days to fix

    Function method has 103 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        method: function (msg, unblock) {
          var self = this;
    
          // Reject malformed messages.
          // For now, we silently ignore unknown attributes,
    Severity: Major
    Found in packages/ddp-server/livedata_server.js - About 4 hrs to fix

      `` has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

      Object.assign(Session.prototype, {
      
        sendReady: function (subscriptionIds) {
          var self = this;
          if (self._isSending)
      Severity: Minor
      Found in packages/ddp-server/livedata_server.js - About 2 hrs to fix

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

            method: function (msg, unblock) {
              var self = this;
        
              // Reject malformed messages.
              // For now, we silently ignore unknown attributes,
        Severity: Minor
        Found in packages/ddp-server/livedata_server.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 Session has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Session = function (server, version, socket, options) {
          var self = this;
          self.id = Random.id();
        
          self.server = server;
        Severity: Major
        Found in packages/ddp-server/livedata_server.js - About 2 hrs to fix

          Function processMessage has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            processMessage: function (msg_in) {
              var self = this;
              if (!self.inQueue) // we have been destroyed.
                return;
          
          
          Severity: Minor
          Found in packages/ddp-server/livedata_server.js - About 1 hr to fix

            Function promise has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  const promise = new Promise((resolve, reject) => {
                    // XXX It'd be better if we could hook into method handlers better but
                    // for now, we need to check if the ddp-rate-limiter exists since we
                    // have a weak requirement for the ddp-rate-limiter package to be added
                    // to our application.
            Severity: Minor
            Found in packages/ddp-server/livedata_server.js - About 1 hr to fix

              Function applyAsync has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                applyAsync: function (name, args, options) {
                  // Run the handler
                  var handler = this.method_handlers[name];
                  if (! handler) {
                    return Promise.reject(
              Severity: Minor
              Found in packages/ddp-server/livedata_server.js - About 1 hr to fix

                Function _publishHandlerResult has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  _publishHandlerResult: function (res) {
                    // SPECIAL CASE: Instead of writing their own callbacks that invoke
                    // this.added/changed/ready/etc, the user can just return a collection
                    // cursor or array of cursors from the publish function; we call their
                    // _publishCursor method which starts observing the cursor and publishes the
                Severity: Minor
                Found in packages/ddp-server/livedata_server.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 publish has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  publish: function (name, handler, options) {
                    var self = this;
                
                    if (! _.isObject(name)) {
                      options = options || {};
                Severity: Minor
                Found in packages/ddp-server/livedata_server.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 publish has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  publish: function (name, handler, options) {
                    var self = this;
                
                    if (! _.isObject(name)) {
                      options = options || {};
                Severity: Minor
                Found in packages/ddp-server/livedata_server.js - About 1 hr to fix

                  Function _publishHandlerResult has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    _publishHandlerResult: function (res) {
                      // SPECIAL CASE: Instead of writing their own callbacks that invoke
                      // this.added/changed/ready/etc, the user can just return a collection
                      // cursor or array of cursors from the publish function; we call their
                      // _publishCursor method which starts observing the cursor and publishes the
                  Severity: Minor
                  Found in packages/ddp-server/livedata_server.js - About 1 hr to fix

                    Function sub has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        sub: function (msg, unblock) {
                          var self = this;
                    
                          // cacheUnblock temporarly, so we can capture it later
                          // we will use unblock in current eventLoop, so this is safe
                    Severity: Minor
                    Found in packages/ddp-server/livedata_server.js - About 1 hr to fix

                      Function _setUserId has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        _setUserId: function(userId) {
                          var self = this;
                      
                          if (userId !== null && typeof userId !== "string")
                            throw new Error("setUserId must be called on string or null, not " +
                      Severity: Minor
                      Found in packages/ddp-server/livedata_server.js - About 1 hr to fix

                        Function clearField has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                        Open

                          clearField: function (subscriptionHandle, key, changeCollector) {
                            var self = this;
                            // Publish API ignores _id if present in fields
                            if (key === "_id")
                              return;
                        Severity: Minor
                        Found in packages/ddp-server/livedata_server.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 _runHandler has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          _runHandler: function() {
                            // XXX should we unblock() here? Either before running the publish
                            // function, or before running _publishCursor.
                            //
                            // Right now, each publish function blocks all future publishes and
                        Severity: Minor
                        Found in packages/ddp-server/livedata_server.js - About 1 hr to fix

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

                          var wrapInternalException = function (exception, context) {
                            if (!exception) return exception;
                          
                            // To allow packages to throw errors intended for the client but not have to
                            // depend on the Meteor.Error class, `isClientSafe` can be set to true on any
                          Severity: Minor
                          Found in packages/ddp-server/livedata_server.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 processMessage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                          Open

                            processMessage: function (msg_in) {
                              var self = this;
                              if (!self.inQueue) // we have been destroyed.
                                return;
                          
                          
                          Severity: Minor
                          Found in packages/ddp-server/livedata_server.js - About 55 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

                          Function sub has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              sub: function (msg, unblock) {
                                var self = this;
                          
                                // cacheUnblock temporarly, so we can capture it later
                                // we will use unblock in current eventLoop, so this is safe
                          Severity: Minor
                          Found in packages/ddp-server/livedata_server.js - About 45 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

                          Function changeField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                            changeField: function (subscriptionHandle, key, value,
                                                   changeCollector, isAdd) {
                              var self = this;
                              // Publish API ignores _id if present in fields
                              if (key === "_id")
                          Severity: Minor
                          Found in packages/ddp-server/livedata_server.js - About 45 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

                          Consider simplifying this complex logical expression.
                          Open

                                if (typeof (msg.id) !== "string" ||
                                    typeof (msg.method) !== "string" ||
                                    (('params' in msg) && !(msg.params instanceof Array)) ||
                                    (('randomSeed' in msg) && (typeof msg.randomSeed !== "string"))) {
                                  self.sendError("Malformed method invocation", msg);
                          Severity: Major
                          Found in packages/ddp-server/livedata_server.js - About 40 mins to fix

                            Function changeField has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              changeField: function (subscriptionHandle, key, value,
                                                     changeCollector, isAdd) {
                            Severity: Minor
                            Found in packages/ddp-server/livedata_server.js - About 35 mins to fix

                              Function changeField has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                changeField: function (subscriptionHandle, key, value,
                                                       changeCollector, isAdd) {
                              Severity: Minor
                              Found in packages/ddp-server/livedata_server.js - About 35 mins to fix

                                Function Subscription has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    session, handler, subscriptionId, params, name) {
                                Severity: Minor
                                Found in packages/ddp-server/livedata_server.js - About 35 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                            return;
                                  Severity: Major
                                  Found in packages/ddp-server/livedata_server.js - About 30 mins to fix

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

                                      apply: function (name, args, options, callback) {
                                        // We were passed 3 arguments. They may be either (name, args, options)
                                        // or (name, args, callback)
                                        if (! callback && typeof options === 'function') {
                                          callback = options;
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.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

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

                                      _stopSubscription: function (subId, error) {
                                        var self = this;
                                    
                                        var subName = null;
                                        if (subId) {
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.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

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

                                      added(subscriptionHandle, collectionName, id, fields) {
                                        if (this.server.getPublicationStrategy(collectionName).useCollectionView) {
                                          const view = this.getCollectionView(collectionName);
                                          view.added(subscriptionHandle, id, fields);
                                        } else {
                                    Severity: Major
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 2 hrs to fix
                                    packages/ddp-server/livedata_server.js on lines 477..484

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

                                    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

                                      changed(subscriptionHandle, collectionName, id, fields) {
                                        if (this.server.getPublicationStrategy(collectionName).useCollectionView) {
                                          const view = this.getCollectionView(collectionName);
                                          view.changed(subscriptionHandle, id, fields);
                                        } else {
                                    Severity: Major
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 2 hrs to fix
                                    packages/ddp-server/livedata_server.js on lines 456..463

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

                                    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

                                            self.send({
                                              msg: 'result', id: msg.id,
                                              error: new Meteor.Error(404, `Method '${msg.method}' not found`)});
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 55 mins to fix
                                    packages/ddp-server/livedata_server.js on lines 666..668

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

                                    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

                                            self.send({
                                              msg: 'nosub', id: msg.id,
                                              error: new Meteor.Error(404, `Subscription '${msg.name}' not found`)});
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 55 mins to fix
                                    packages/ddp-server/livedata_server.js on lines 755..757

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

                                    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

                                            var rateLimiterInput = {
                                              userId: self.userId,
                                              clientAddress: self.connectionHandle.clientAddress,
                                              type: "subscription",
                                              name: msg.name,
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 55 mins to fix
                                    packages/ddp-server/livedata_server.js on lines 782..788

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

                                    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

                                              var rateLimiterInput = {
                                                userId: self.userId,
                                                clientAddress: self.connectionHandle.clientAddress,
                                                type: "method",
                                                name: msg.method,
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 55 mins to fix
                                    packages/ddp-server/livedata_server.js on lines 685..691

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

                                    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

                                    var DummyDocumentView = function () {
                                      var self = this;
                                      self.existsIn = new Set(); // set of subscriptionHandle
                                      self.dataByKey = new Map(); // key-> [ {subscriptionHandle, value} by precedence]
                                    };
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 50 mins to fix
                                    packages/ddp-server/livedata_server.js on lines 77..81

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

                                    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

                                    var SessionDocumentView = function () {
                                      var self = this;
                                      self.existsIn = new Set(); // set of subscriptionHandle
                                      self.dataByKey = new Map(); // key-> [ {subscriptionHandle, value} by precedence]
                                    };
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 50 mins to fix
                                    packages/ddp-server/livedata_server.js on lines 55..59

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

                                    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 (typeof (msg.id) !== "string" ||
                                              typeof (msg.name) !== "string" ||
                                              (('params' in msg) && !(msg.params instanceof Array))) {
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 35 mins to fix
                                    packages/ddp-server/livedata_server.js on lines 727..729

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

                                    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 (typeof (msg.id) !== "string" ||
                                              typeof (msg.method) !== "string" ||
                                              (('params' in msg) && !(msg.params instanceof Array)) ||
                                    Severity: Minor
                                    Found in packages/ddp-server/livedata_server.js and 1 other location - About 35 mins to fix
                                    packages/ddp-server/livedata_server.js on lines 658..660

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status