RubyLouvre/avalon

View on GitHub

Showing 214 of 347 total issues

Function exports has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(config) {

    // Use ENV vars on Travis and sauce.json locally to get credentials
    if (process.env.SAUCE_USERNAME) {
        console.log('使用全局的sauce key')
Severity: Minor
Found in karma.sauce.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 init has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    init: function() {
        var vdom = this.node
        var underline = this.name.replace('ms-on-', 'e').replace('-', '_')
        var uuid = underline + '_' + this.expr.
        replace(/\s/g, '').
Severity: Minor
Found in src/directives/on.js - About 1 hr to fix

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

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

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

        platform.modelFactory = function modelFactory(definition, dd) {
            var $computed = definition.$computed || {}
            delete definition.$computed
            var core = new IProxy(definition, dd)
            var $accessors = core.$accessors
        Severity: Minor
        Found in src/vmodel/share.js - About 1 hr to fix

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

              update: function (vdom, show) {     
                  var dom = vdom.dom
                  if (dom && dom.nodeType === 1) {
                      var display = dom.style.display
                      var value
          Severity: Minor
          Found in src/directives/visible.js - About 1 hr to fix

            Function limitBy has 33 lines of code (exceeds 25 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

              Function updateDataHandle has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function updateDataHandle(event) {
                  var elem = this
                  var field = elem._ms_duplex_
                  if (elem.composing) {
                      //防止onpropertychange引发爆栈
              Severity: Minor
              Found in src/directives/duplex/updateDataHandle.js - About 1 hr to fix

                Function parseInterpolate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function parseInterpolate(dir) {
                    var rlineSp = /\n\r?/g
                    var str = dir.nodeValue.trim().replace(rlineSp, '')
                    var tokens = []
                    do {//aaa{{@bbb}}ccc
                Severity: Minor
                Found in src/parser/interpolate.js - About 1 hr to fix

                  Function touchmove has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      touchmove: function(event) {
                          if (pinchRecognizer.element && event.touches.length > 1) {
                              var position = [],
                                  current = []
                              for (var i = 0; i < event.touches.length; i++) {
                  Severity: Minor
                  Found in src/gesture/pinch.js - About 1 hr to fix

                    Function move has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        move: function(event, callback) {
                            for (var i = 0; i < event.changedTouches.length; i++) {
                                var touch = event.changedTouches[i]
                                var pointer = Recognizer.pointers[touch.identifier]
                                if (!pointer) {
                    Severity: Minor
                    Found in src/gesture/recognizer.js - About 1 hr to fix

                      Function innerExtend has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function innerExtend(isDeep, array) {
                          var target = array[0],
                              copyIsArray, clone, name
                          for (var i = 1, length = array.length; i < length; i++) {
                              //只处理非空参数
                      Severity: Minor
                      Found in src/seed/lang.compact.js - About 1 hr to fix

                        Function add has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            add: function(name, recognizer) {
                                function move(event) {
                                    recognizer.touchmove(event)
                                }
                        
                        
                        Severity: Minor
                        Found in src/gesture/recognizer.js - About 1 hr to fix

                          Function createFragments has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function createFragments(instance, obj) {
                              if (isObject(obj)) {
                                  var array = Array.isArray(obj)
                                  var ids = []
                                  var fragments = [],
                          Severity: Minor
                          Found in src/directives/for.js - About 1 hr to fix

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

                            export function getRange(childNodes, node) {
                                var i = childNodes.indexOf(node) + 1
                                var deep = 1,
                                    nodes = [],
                                    end
                            Severity: Minor
                            Found in src/renders/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 set has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                                set(newValue) {
                                    var oldValue = this.value
                                    if (newValue !== oldValue) {
                                        if (avalon.isObject(newValue)) {
                                            var hash = oldValue && oldValue.$hashcode
                            Severity: Minor
                            Found in src/vmodel/Mutation.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 dateFilter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function dateFilter(date, format) {
                                var locate = dateFilter.locate,
                                    text = "",
                                    parts = [],
                                    fn, match
                            Severity: Minor
                            Found in src/filters/date.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 Directive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function Directive(vm, binding, vdom, render) {
                                var type = binding.type
                                var decorator = avalon.directives[type]
                                if (inBrowser) {
                                    var dom = avalon.vdom(vdom, 'toDOM')
                            Severity: Minor
                            Found in src/renders/Directive.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 isArrayLike has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function isArrayLike(obj) {
                                if (!obj)
                                    return false
                                var n = obj.length
                                if (n === (n >>> 0)) { //检测length属性是否为非负整数
                            Severity: Minor
                            Found in src/seed/lang.compact.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 parseTextDir has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function parseTextDir(string) {
                                var closeTag = config.closeTag
                                var openTag = config.openTag
                                var closeTagFirst = closeTag.charAt(0)
                                var closeTagLength = closeTag.length
                            Severity: Minor
                            Found in src/vtree/fromString.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language