RubyLouvre/avalon

View on GitHub

Showing 214 of 347 total issues

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

avalon.applyEffect = function (dom, vdom, opts) {
    var cb = opts.cb
    var curEffect = vdom.effect
    if (curEffect && dom && dom.nodeType === 1) {
        var hook = opts.hook
Severity: Minor
Found in src/effect/index.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 filterBy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function filterBy(array, search) {
    var type = avalon.type(array)
    if (type !== 'array' && type !== 'object')
        throw 'filterBy只能处理对象或数组'
    var args = avalon.slice(arguments, 2)
Severity: Minor
Found in src/filters/array.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 canHijack has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function canHijack(key, val, $proxyItemBackdoor) {
    if (key in $$skipArray)
        return false
    if (key.charAt(0) === '$') {
        if ($proxyItemBackdoor) {
Severity: Minor
Found in src/vmodel/share.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 fixEvent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

avEvent.prototype.fixEvent = function () {
    var event = this
    if (event.which == null && event.type.indexOf('key') === 0) {
        event.which = event.charCode != null ? event.charCode : event.keyCode
    }
Severity: Minor
Found in src/dom/event/compact.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 lastIndexOf has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        lastIndexOf: function(item, index) {
            var n = this.length,
                i = index == null ? n - 1 : index
            if (i < 0)
                i = Math.max(0, n + i)
Severity: Minor
Found in src/seed/lang.fix.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 getCaret has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function getCaret(target) {
    var start = 0
    var normalizedValue
    var range
    var textInputRange
Severity: Minor
Found in src/directives/duplex/updateDataEvents.compact.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 updateList has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function updateList(instance) {
    var before = instance.begin.dom
    var parent = before.parentNode
    var list = instance.fragments
    var end = instance.end.dom
Severity: Minor
Found in src/directives/for.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 shimHack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function shimHack() {
    if (msie < 10) {
        avalon.cloneNode = fixClone
    }
    if (!document.contains) {
Severity: Minor
Found in src/dom/shim/compact.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 (!attrName) {
                        throw '必须指定属性名'
                    }
Severity: Major
Found in src/vtree/fromString.js - About 45 mins to fix

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

    function toJson(val) {
        var xtype = avalon.type(val)
        if (xtype === 'array') {
            var array = []
            for (var i = 0; i < val.length; i++) {
    Severity: Minor
    Found in src/vmodel/share.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

                        for (var key in childOb) {
                            if (childOb.hasOwnProperty(key)) {
                                var collectIt = childOb[key]
                            }
                        }
    Severity: Major
    Found in src/vmodel/Mutation.js - About 45 mins to fix

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

      export function afterCreate(vm, core, keys, bindThis) {
          var ac = vm.$accessors
              //隐藏系统属性
          for (var key in $$skipArray) {
              hideProperty(vm, key, vm[key])
      Severity: Minor
      Found in src/vmodel/modern.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 (avalon.msie < 8) {
                                  val = String(val).replace(ramp, '&') //处理IE67自动转义的问题
                              }
      Severity: Major
      Found in src/dom/attr/compact.js - About 45 mins to fix

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

            updateScrollParent: function(targetElement) {
                //如果事件源元素位于某一个有滚动条的祖父元素中,那么保持其scrollParent与scrollTop值
                var scrollParent = targetElement.tapScrollParent
        
                if (!scrollParent || !scrollParent.contains(targetElement)) {
        Severity: Minor
        Found in src/gesture/tap.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 (singleton) {
                                        return value
                                    } else {
                                        ret.push(value)
                                    }
        Severity: Major
        Found in src/dom/val/modern.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if (val.set)
                                  val.setter = val.set
          Severity: Major
          Found in src/vmodel/proxy.js - About 45 mins to fix

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

            function __repeat(array, isArray, cb) {
                if (isArray) {
                    array.forEach(function(val, index) {
                        cb(index)
                    })
            Severity: Minor
            Found in src/filters/array.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 orderBy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            export function orderBy(array, by, decend) {
                var type = avalon.type(array)
                if (type !== 'array' && type !== 'object')
                    throw 'orderBy只能处理对象或数组'
                var criteria = typeof by == 'string' ? function(el) {
            Severity: Minor
            Found in src/filters/array.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 (/\S/.test(child.nodeValue)) {
                                    vnode.children.push(child)
                                }
            Severity: Major
            Found in src/vtree/fromDOM.js - About 45 mins to fix

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

              export function listFactory(array, stop, dd) {
                  if (!stop) {
                      hijackMethods(array)
                      if (modern) {
                          Object.defineProperty(array, '$model', platform.modelAccessor)
              Severity: Minor
              Found in src/vmodel/ProxyArray.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

              Severity
              Category
              Status
              Source
              Language