scazz010/ember-changeset-history

View on GitHub

Showing 16 of 18 total issues

Function default has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

export default function(x, y) {
  var leftChain, rightChain;

  function compare2Objects (x, y) {
    var p;
Severity: Minor
Found in addon/utils/deep-equals.js - About 7 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 default has 72 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function(x, y) {
  var leftChain, rightChain;

  function compare2Objects (x, y) {
    var p;
Severity: Major
Found in addon/utils/deep-equals.js - About 2 hrs to fix

    Function compare2Objects has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function compare2Objects (x, y) {
        var p;
    
        // remember that NaN === NaN returns false
        // and isNaN(undefined) returns true
    Severity: Major
    Found in addon/utils/deep-equals.js - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

          if ((typeof x === 'function' && typeof y === 'function') ||
            (x instanceof Date && y instanceof Date) ||
            (x instanceof RegExp && y instanceof RegExp) ||
            (x instanceof String && y instanceof String) ||
            (x instanceof Number && y instanceof Number)) {
      Severity: Critical
      Found in addon/utils/deep-equals.js - About 2 hrs to fix

        Function changesetHistory has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        export function changesetHistory(obj, validateFn = () => true, validationMap = {}, {maxHistoryLength=0} = {}) {
          let changesetClass = changeset(...arguments);
        
          return changesetClass.extend({
            init() {
        Severity: Minor
        Found in addon/index.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

        Avoid too many return statements within this function.
        Open

              return false;
        Severity: Major
        Found in addon/utils/deep-equals.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return false;
          Severity: Major
          Found in addon/utils/deep-equals.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return false;
            Severity: Major
            Found in addon/utils/deep-equals.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return false;
              Severity: Major
              Found in addon/utils/deep-equals.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return false;
                Severity: Major
                Found in addon/utils/deep-equals.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return false;
                  Severity: Major
                  Found in addon/utils/deep-equals.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return false;
                    Severity: Major
                    Found in addon/utils/deep-equals.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return false;
                      Severity: Major
                      Found in addon/utils/deep-equals.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return false;
                        Severity: Major
                        Found in addon/utils/deep-equals.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return false;
                          Severity: Major
                          Found in addon/utils/deep-equals.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return true;
                            Severity: Major
                            Found in addon/utils/deep-equals.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language