RubyLouvre/avalon

View on GitHub
src/directives/css.js

Summary

Maintainability
D
1 day
Test Coverage

Function diff has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    diff: function(newVal, oldVal) {
        if (Object(newVal) === newVal) {
            newVal = platform.toJson(newVal) //安全的遍历VBscript
            if (Array.isArray(newVal)) { //转换成对象
                var b = {}
Severity: Minor
Found in src/directives/css.js - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

Function diff has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    diff: function(newVal, oldVal) {
        if (Object(newVal) === newVal) {
            newVal = platform.toJson(newVal) //安全的遍历VBscript
            if (Array.isArray(newVal)) { //转换成对象
                var b = {}
Severity: Minor
Found in src/directives/css.js - About 1 hr to fix

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

    function equalObject(a, b, level) {
        if (a === null || b === null)
            return false;
        if (getEnumerableKeys(a).length !== getEnumerableKeys(b).length)
            return false;
    Severity: Minor
    Found in src/directives/css.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 deeply nested control flow statements.
    Open

                            if (newVal[i] !== oldVal[i]) {
                                hasChange = true
                            }
    Severity: Major
    Found in src/directives/css.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (!deepEquals(newVal[i], oldVal[i], 4)) {
                                  this.value = newVal
                                  return true
                              }
      Severity: Major
      Found in src/directives/css.js - About 45 mins to fix

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

        export function deepEquals(a, b, level) {
            if (level === 0)
                return a === b
            if (a === null && b === null)
                return true
        Severity: Minor
        Found in src/directives/css.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 a === b
        Severity: Major
        Found in src/directives/css.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return false
          Severity: Major
          Found in src/directives/css.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return equalArray(a, b, level)
            Severity: Major
            Found in src/directives/css.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return equalObject(a, b, level)
              Severity: Major
              Found in src/directives/css.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return true
                Severity: Major
                Found in src/directives/css.js - About 30 mins to fix

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

                  function equalArray(a, b, level) {
                      if (a.length !== b.length) {
                          return false
                      }
                      for (let i = a.length - 1; i >= 0; i--) {
                  Severity: Minor
                  Found in src/directives/css.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

                  Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
                  Open

                  import { avalon, platform } from '../seed/core'
                  Severity: Minor
                  Found in src/directives/css.js by eslint

                  For more information visit Source: http://eslint.org/docs/rules/

                  There are no issues that match your filters.

                  Category
                  Status