meteor/meteor

View on GitHub
packages/minimongo/matcher.js

Summary

Maintainability
F
3 days
Test Coverage

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

  _cmp(a, b) {
    if (a === undefined) {
      return b === undefined ? 0 : -1;
    }

Severity: Minor
Found in packages/minimongo/matcher.js - About 1 day to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function _cmp has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _cmp(a, b) {
    if (a === undefined) {
      return b === undefined ? 0 : -1;
    }

Severity: Major
Found in packages/minimongo/matcher.js - About 3 hrs to fix

    Function _type has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _type(v) {
        if (typeof v === 'number') {
          return 1;
        }
    
    
    Severity: Minor
    Found in packages/minimongo/matcher.js - About 1 hr to fix

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

        _type(v) {
          if (typeof v === 'number') {
            return 1;
          }
      
      
      Severity: Minor
      Found in packages/minimongo/matcher.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 _compileSelector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        _compileSelector(selector) {
          // you can pass a literal function instead of a selector
          if (selector instanceof Function) {
            this._isSimple = false;
            this._selector = selector;
      Severity: Minor
      Found in packages/minimongo/matcher.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 7;
      Severity: Major
      Found in packages/minimongo/matcher.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

                    return a.length - b.length;
            Severity: Major
            Found in packages/minimongo/matcher.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        return i === b.length ? 0 : -1;
              Severity: Major
              Found in packages/minimongo/matcher.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

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

                  Avoid too many return statements within this function.
                  Open

                          return b ? 0 : 1;
                  Severity: Major
                  Found in packages/minimongo/matcher.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

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

                      Avoid too many return statements within this function.
                      Open

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

                        Avoid too many return statements within this function.
                        Open

                                return a - b;
                        Severity: Major
                        Found in packages/minimongo/matcher.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

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

                            Avoid too many return statements within this function.
                            Open

                                  return LocalCollection._f._cmp(toArray(a), toArray(b));
                            Severity: Major
                            Found in packages/minimongo/matcher.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

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

                                Avoid too many return statements within this function.
                                Open

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

                                  Avoid too many return statements within this function.
                                  Open

                                        return a < b ? -1 : a === b ? 0 : 1;
                                  Severity: Major
                                  Found in packages/minimongo/matcher.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

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

                                      Avoid too many return statements within this function.
                                      Open

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

                                        Avoid too many return statements within this function.
                                        Open

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

                                          Avoid too many return statements within this function.
                                          Open

                                                return b ? -1 : 0;
                                          Severity: Major
                                          Found in packages/minimongo/matcher.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

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

                                              Avoid too many return statements within this function.
                                              Open

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

                                                There are no issues that match your filters.

                                                Category
                                                Status