meteor/meteor

View on GitHub
packages/minimongo/local_collection.js

Summary

Maintainability
F
2 wks
Test Coverage

File local_collection.js has 1383 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Cursor from './cursor.js';
import ObserveHandle from './observe_handle.js';
import {
  hasOwn,
  isIndexable,
Severity: Major
Found in packages/minimongo/local_collection.js - About 3 days to fix

    Function _observeFromObserveChanges has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

    LocalCollection._observeFromObserveChanges = (cursor, observeCallbacks) => {
      const transform = cursor.getTransform() || (doc => doc);
      let suppressed = !!observeCallbacks._suppress_initial;
    
      let observeChangesCallbacks;
    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 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 _observeFromObserveChanges has 110 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    LocalCollection._observeFromObserveChanges = (cursor, observeCallbacks) => {
      const transform = cursor.getTransform() || (doc => doc);
      let suppressed = !!observeCallbacks._suppress_initial;
    
      let observeChangesCallbacks;
    Severity: Major
    Found in packages/minimongo/local_collection.js - About 4 hrs to fix

      Function constructor has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        constructor(options = {}) {
          const orderedFromCallbacks = (
            options.callbacks &&
            LocalCollection._observeChangesCallbacksAreOrdered(options.callbacks)
          );
      Severity: Minor
      Found in packages/minimongo/local_collection.js - About 3 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 update has 85 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        update(selector, mod, options, callback) {
          if (! callback && options instanceof Function) {
            callback = options;
            options = null;
          }
      Severity: Major
      Found in packages/minimongo/local_collection.js - About 3 hrs to fix

        Function $push has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          $push(target, field, arg) {
            if (target[field] === undefined) {
              target[field] = [];
            }
        
        
        Severity: Minor
        Found in packages/minimongo/local_collection.js - About 3 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 findModTarget has 75 lines of code (exceeds 25 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: Major
        Found in packages/minimongo/local_collection.js - About 3 hrs to fix

          Function $push has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            $push(target, field, arg) {
              if (target[field] === undefined) {
                target[field] = [];
              }
          
          
          Severity: Major
          Found in packages/minimongo/local_collection.js - About 3 hrs to fix

            Function remove has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              remove(selector, callback) {
                // Easy special case: if we're not calling observeChanges callbacks and
                // we're not saving originals and we got asked to remove everything, then
                // just empty everything directly.
                if (this.paused && !this._savedOriginals && EJSON.equals(selector, {})) {
            Severity: Major
            Found in packages/minimongo/local_collection.js - About 2 hrs to fix

              Function constructor has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor(options = {}) {
                  const orderedFromCallbacks = (
                    options.callbacks &&
                    LocalCollection._observeChangesCallbacksAreOrdered(options.callbacks)
                  );
              Severity: Major
              Found in packages/minimongo/local_collection.js - About 2 hrs to fix

                Function _modify has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                LocalCollection._modify = (doc, modifier, options = {}) => {
                  if (!LocalCollection._isPlainObject(modifier)) {
                    throw MinimongoError('Modifier must be an object');
                  }
                
                
                Severity: Major
                Found in packages/minimongo/local_collection.js - About 2 hrs to fix

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

                    insert(doc, callback) {
                      doc = EJSON.clone(doc);
                  
                      assertHasValidFieldNames(doc);
                  
                  
                  Severity: Minor
                  Found in packages/minimongo/local_collection.js - About 1 hr to fix

                    Function _idsMatchedBySelector has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    LocalCollection._idsMatchedBySelector = selector => {
                      // Is the selector just an ID?
                      if (LocalCollection._selectorIsId(selector)) {
                        return [selector];
                      }
                    Severity: Minor
                    Found in packages/minimongo/local_collection.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 _modifyAndNotify has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      _modifyAndNotify(doc, mod, recomputeQids, arrayIndices) {
                        const matched_before = {};
                    
                        Object.keys(this.queries).forEach(qid => {
                          const query = this.queries[qid];
                    Severity: Minor
                    Found in packages/minimongo/local_collection.js - About 1 hr to fix

                      Function _updateInResults has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      LocalCollection._updateInResults = (query, doc, old_doc) => {
                        if (!EJSON.equals(doc._id, old_doc._id)) {
                          throw new Error('Can\'t change a doc\'s _id while updating');
                        }
                      
                      
                      Severity: Minor
                      Found in packages/minimongo/local_collection.js - About 1 hr to fix

                        Function wrapTransform has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                        LocalCollection.wrapTransform = transform => {
                          if (!transform) {
                            return null;
                          }
                        
                        
                        Severity: Minor
                        Found in packages/minimongo/local_collection.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 _compileProjection has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        LocalCollection._compileProjection = fields => {
                          LocalCollection._checkSupportedProjection(fields);
                        
                          const _idProjection = fields._id === undefined ? true : fields._id;
                          const details = projectionDetails(fields);
                        Severity: Minor
                        Found in packages/minimongo/local_collection.js - About 1 hr to fix

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

                          LocalCollection._updateInResults = (query, doc, old_doc) => {
                            if (!EJSON.equals(doc._id, old_doc._id)) {
                              throw new Error('Can\'t change a doc\'s _id while updating');
                            }
                          
                          
                          Severity: Minor
                          Found in packages/minimongo/local_collection.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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                            update(selector, mod, options, callback) {
                              if (! callback && options instanceof Function) {
                                callback = options;
                                options = null;
                              }
                          Severity: Minor
                          Found in packages/minimongo/local_collection.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 _idsMatchedBySelector has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          LocalCollection._idsMatchedBySelector = selector => {
                            // Is the selector just an ID?
                            if (LocalCollection._selectorIsId(selector)) {
                              return [selector];
                            }
                          Severity: Minor
                          Found in packages/minimongo/local_collection.js - About 1 hr to fix

                            Function $rename has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              $rename(target, field, arg, keypath, doc) {
                                // no idea why mongo has this restriction..
                                if (keypath === arg) {
                                  throw MinimongoError('$rename source must differ from target', {field});
                                }
                            Severity: Minor
                            Found in packages/minimongo/local_collection.js - About 1 hr to fix

                              Function wrapTransform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              LocalCollection.wrapTransform = transform => {
                                if (!transform) {
                                  return null;
                                }
                              
                              
                              Severity: Minor
                              Found in packages/minimongo/local_collection.js - About 1 hr to fix

                                Function _insertInResults has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                LocalCollection._insertInResults = (query, doc) => {
                                  const fields = EJSON.clone(doc);
                                
                                  delete fields._id;
                                
                                
                                Severity: Minor
                                Found in packages/minimongo/local_collection.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 _checkSupportedProjection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                LocalCollection._checkSupportedProjection = fields => {
                                  if (fields !== Object(fields) || Array.isArray(fields)) {
                                    throw MinimongoError('fields option must be an object');
                                  }
                                
                                
                                Severity: Minor
                                Found in packages/minimongo/local_collection.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

                                Avoid deeply nested control flow statements.
                                Open

                                        if (options.noCreate) {
                                          return undefined;
                                        }
                                Severity: Major
                                Found in packages/minimongo/local_collection.js - About 45 mins to fix

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

                                  LocalCollection._modify = (doc, modifier, options = {}) => {
                                    if (!LocalCollection._isPlainObject(modifier)) {
                                      throw MinimongoError('Modifier must be an object');
                                    }
                                  
                                  
                                  Severity: Minor
                                  Found in packages/minimongo/local_collection.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 $rename has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    $rename(target, field, arg, keypath, doc) {
                                  Severity: Minor
                                  Found in packages/minimongo/local_collection.js - About 35 mins to fix

                                    Function $unset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      $unset(target, field, arg) {
                                        if (target !== undefined) {
                                          if (target instanceof Array) {
                                            if (field in target) {
                                              target[field] = null;
                                    Severity: Minor
                                    Found in packages/minimongo/local_collection.js - About 35 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 _compileProjection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    LocalCollection._compileProjection = fields => {
                                      LocalCollection._checkSupportedProjection(fields);
                                    
                                      const _idProjection = fields._id === undefined ? true : fields._id;
                                      const details = projectionDetails(fields);
                                    Severity: Minor
                                    Found in packages/minimongo/local_collection.js - About 35 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 $min has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      $min(target, field, arg) {
                                        if (typeof arg !== 'number') {
                                          throw MinimongoError('Modifier $min allowed for numbers only', {field});
                                        }
                                    
                                    
                                    Severity: Minor
                                    Found in packages/minimongo/local_collection.js - About 35 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 $addToSet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      $addToSet(target, field, arg) {
                                        let isEach = false;
                                    
                                        if (typeof arg === 'object') {
                                          // check if first key is '$each'
                                    Severity: Minor
                                    Found in packages/minimongo/local_collection.js - About 35 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 $max has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      $max(target, field, arg) {
                                        if (typeof arg !== 'number') {
                                          throw MinimongoError('Modifier $max allowed for numbers only', {field});
                                        }
                                    
                                    
                                    Severity: Minor
                                    Found in packages/minimongo/local_collection.js - About 35 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

                                    Avoid too many return statements within this function.
                                    Open

                                              return undefined;
                                    Severity: Major
                                    Found in packages/minimongo/local_collection.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                              return subIds;
                                      Severity: Major
                                      Found in packages/minimongo/local_collection.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                              return doc;
                                        Severity: Major
                                        Found in packages/minimongo/local_collection.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                              return null;
                                          Severity: Major
                                          Found in packages/minimongo/local_collection.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                              return null;
                                            Severity: Major
                                            Found in packages/minimongo/local_collection.js - About 30 mins to fix

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

                                                $rename(target, field, arg, keypath, doc) {
                                                  // no idea why mongo has this restriction..
                                                  if (keypath === arg) {
                                                    throw MinimongoError('$rename source must differ from target', {field});
                                                  }
                                              Severity: Minor
                                              Found in packages/minimongo/local_collection.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 remove has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                remove(selector, callback) {
                                                  // Easy special case: if we're not calling observeChanges callbacks and
                                                  // we're not saving originals and we got asked to remove everything, then
                                                  // just empty everything directly.
                                                  if (this.paused && !this._savedOriginals && EJSON.equals(selector, {})) {
                                              Severity: Minor
                                              Found in packages/minimongo/local_collection.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

                                                $min(target, field, arg) {
                                                  if (typeof arg !== 'number') {
                                                    throw MinimongoError('Modifier $min allowed for numbers only', {field});
                                                  }
                                              
                                              
                                              Severity: Major
                                              Found in packages/minimongo/local_collection.js and 1 other location - About 4 hrs to fix
                                              packages/minimongo/local_collection.js on lines 1517..1536

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

                                              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

                                                $max(target, field, arg) {
                                                  if (typeof arg !== 'number') {
                                                    throw MinimongoError('Modifier $max allowed for numbers only', {field});
                                                  }
                                              
                                              
                                              Severity: Major
                                              Found in packages/minimongo/local_collection.js and 1 other location - About 4 hrs to fix
                                              packages/minimongo/local_collection.js on lines 1497..1516

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

                                              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 (field in target) {
                                                    if (typeof target[field] !== 'number') {
                                                      throw MinimongoError(
                                                        'Cannot apply $inc modifier to non-number',
                                                        {field}
                                              Severity: Minor
                                              Found in packages/minimongo/local_collection.js and 1 other location - About 35 mins to fix
                                              packages/minimongo/local_collection.js on lines 1542..1553

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

                                              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 (field in target) {
                                                    if (typeof target[field] !== 'number') {
                                                      throw MinimongoError(
                                                        'Cannot apply $mul modifier to non-number',
                                                        {field}
                                              Severity: Minor
                                              Found in packages/minimongo/local_collection.js and 1 other location - About 35 mins to fix
                                              packages/minimongo/local_collection.js on lines 1484..1495

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

                                              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