RubyLouvre/avalon

View on GitHub

Showing 214 of 347 total issues

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

export function limitBy(input, limit, begin) {
    var type = avalon.type(input)
    if (type !== 'array' && type !== 'object')
        throw 'limitBy只能处理对象或数组'
            //必须是数值
Severity: Minor
Found in src/filters/array.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 showHidden has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function showHidden(node, array) {
    //http://www.cnblogs.com/rubylouvre/archive/2012/10/27/2742529.html
    if (node.offsetWidth <= 0) { //opera.offsetWidth可能小于0
        if (rdisplayswap.test(cssHooks['@:get'](node, 'display'))) {
            var obj = {
Severity: Minor
Found in src/dom/css/share.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 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

Function self has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    'select:get': function self(node, ret, index, singleton) {
        var nodes = node.children, value,
            index = ret ? index : node.selectedIndex
        singleton = ret ? singleton : node.type === 'select-one' || index < 0
        ret = ret || []
Severity: Minor
Found in src/dom/val/modern.js - About 1 hr to fix

    Function update has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        update: function (vdom, change, opts) {
            var dom = vdom.dom
            if (dom && dom.nodeType === 1) {
                //要求配置对象必须指定is属性,action必须是布尔或enter,leave,move
                var option = change || opts
    Severity: Minor
    Found in src/effect/index.js - About 1 hr to fix

      Function bootstrap has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function bootstrap() {
          function doScrollCheck() {
              try { //IE下通过doScrollCheck检测DOM树是否建完
                  root.doScroll('left')
                  fireReady()
      Severity: Minor
      Found in src/dom/ready/compact.js - About 1 hr to fix

        Function compaceQuote has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export var compaceQuote = (function() {
            //https://github.com/bestiejs/json3/blob/master/lib/json3.js
            var Escapes = {
                92: "\\\\",
                34: '\\"',
        Severity: Minor
        Found in src/seed/lang.compact.js - About 1 hr to fix

          Function makeOrphan has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function makeOrphan(node, nodeName, innerHTML) {
              switch (nodeName) {
                  case 'style':
                  case 'script':
                  case 'noscript':
          Severity: Minor
          Found in src/vtree/makeOrphan.js - About 1 hr to fix

            Function validateAll has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                validateAll: function(callback) {
                    var validator = this
                    var vdom = this.vdom
                    var fields = validator.fields = []
                    collectFeild(vdom.children, fields, validator)
            Severity: Minor
            Found in src/directives/validate.js - About 1 hr to fix

              Function FragmentDecorator has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function FragmentDecorator(fragment, instance, index) {
                  var data = {}
                  data[instance.keyName] = instance.isArray ? index : fragment.key
                  data[instance.valName] = fragment.val
                  if (instance.asName) {
              Severity: Minor
              Found in src/directives/for.js - About 1 hr to fix

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

                    touchstart: function(event) {
                        //忽略多点触摸
                        if (event.targetTouches.length !== 1) {
                            return true
                        }
                Severity: Minor
                Found in src/gesture/tap.js - About 1 hr to fix

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

                  function newUpdate() {
                      var oldVal = this.beforeUpdate()
                      var newVal = this.value = this.get()
                      if (this.callback && this.diff(newVal, oldVal)) {
                          this.callback(this.node, this.value)
                  Severity: Minor
                  Found in src/renders/domRender.js - About 1 hr to fix

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

                    avalon.css = function (node, name, value, fn) {
                        //读写删除元素节点的样式
                        if (node instanceof avalon) {
                            node = node[0]
                        }
                    Severity: Minor
                    Found in src/dom/css/share.js - About 1 hr to fix

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

                          ap.slice = function(begin, end) {
                              // IE < 9 gets unhappy with an undefined end argument
                              end = (typeof end !== 'undefined') ? end : this.length
                      
                              // For native Array objects, we use the native slice function
                      Severity: Minor
                      Found in src/seed/lang.fix.js - About 1 hr to fix

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

                        avalon.fn.offset = function () { //取得距离页面左右角的坐标
                            var node = this[0],
                                box = {
                                    left: 0,
                                    top: 0
                        Severity: Minor
                        Found in src/dom/css/compact.js - About 1 hr to fix

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

                          avalon.fn.position = function () {
                              var offsetParent, offset,
                                  elem = this[0],
                                  parentOffset = {
                                      top: 0,
                          Severity: Minor
                          Found in src/dom/css/share.js - About 1 hr to fix

                            Function getCaret has 26 lines of code (exceeds 25 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 1 hr to fix

                              Function getScale has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  getScale: function(x1, y1, x2, y2, x3, y3, x4, y4) {
                              Severity: Major
                              Found in src/gesture/pinch.js - About 1 hr to fix

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

                                function collectHandlers(elem, type, handlers) {
                                    var value = elem.getAttribute('avalon-events')
                                    if (value && (elem.disabled !== true || type !== 'click')) {
                                        var uuids = []
                                        var reg = typeRegExp[type] || (typeRegExp[type] = new RegExp("\\b" + type + '\\:([^,\\s]+)', 'g'))
                                Severity: Minor
                                Found in src/dom/event/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 markProps has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                function markProps(node, attrs) {
                                    var ret = {}
                                    for (var i = 0, n = attrs.length; i < n; i++) {
                                        var attr = attrs[i]
                                        if (attr.specified) {
                                Severity: Minor
                                Found in src/vtree/fromDOM.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

                                Severity
                                Category
                                Status
                                Source
                                Language