RubyLouvre/avalon

View on GitHub

Showing 214 of 347 total issues

Function lexer has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

function lexer(string, getOne) {
    var tokens = []
    var breakIndex = 9990
    var stack = []
    var origString = string
Severity: Minor
Found in src/vtree/fromString.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 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 getAttrs has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

function getAttrs(string) {
    var state = 'AttrName',
        attrName = '',
        attrValue = '',
        quote,
Severity: Minor
Found in src/vtree/fromString.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 scanTag has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

    scanTag(vdom, scope, parentChildren, isRoot) {
        var dirs = {},
            attrs = vdom.props,
            hasDir, hasFor
        for (var attr in attrs) {
Severity: Minor
Found in src/renders/domRender.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 mix has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

avalon.mix = avalon.fn.mix = function() {
    var options, name, src, copy, copyIsArray, clone,
        target = arguments[0] || {},
        i = 1,
        length = arguments.length,
Severity: Minor
Found in src/seed/lang.modern.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 updateAttrs has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

export function updateAttrs(node, attrs) {
    for (var attrName in attrs) {
        try {
            var val = attrs[attrName]
                // 处理路径属性
Severity: Minor
Found in src/dom/attr/compact.js - About 5 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 init has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    init: function() {
        //cached属性必须定义在组件容器里面,不是template中
        var vdom = this.node
        this.cacheVm = !!vdom.props.cached
        if (vdom.dom && vdom.nodeName === '#comment') {
Severity: Minor
Found in src/component/index.js - About 5 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 innerExtend has a Cognitive Complexity of 34 (exceeds 5 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 5 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 parseAttributes has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

export function parseAttributes(dirs, tuple ) {
    var node = tuple[0], uniq = {}, bindings = []
    var hasIf = false
    for (var name in dirs) {
        var value = dirs[name]
Severity: Minor
Found in src/parser/attributes.js - About 4 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 updateDataEvents has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

export function updateDataEvents(dom, data) {
    var events = {}
        //添加需要监听的事件
    switch (data.dtype) {
        case 'radio':
Severity: Minor
Found in src/directives/duplex/updateDataEvents.compact.js - About 4 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

File fromString.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * ------------------------------------------------------------
 * avalon2.2.6的新式lexer
 * 将字符串变成一个虚拟DOM树,方便以后进一步变成模板函数
 * 此阶段只会生成VElement,VText,VComment
Severity: Minor
Found in src/vtree/fromString.js - About 4 hrs to fix

    Function init has 108 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        init: function() {
            //cached属性必须定义在组件容器里面,不是template中
            var vdom = this.node
            this.cacheVm = !!vdom.props.cached
            if (vdom.dom && vdom.nodeName === '#comment') {
    Severity: Major
    Found in src/component/index.js - About 4 hrs to fix

      Function getOpenTag has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

      function getOpenTag(string) {
          if (string.indexOf("<") === 0) {
              var i = string.indexOf('<!--') //处理注释节点
              if (i === 0) {
                  var l = string.indexOf('-->')
      Severity: Minor
      Found in src/vtree/fromString.js - About 4 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 toDOM has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          toDOM() {
              if (this.dom)
                  return this.dom
              var dom, tagName = this.nodeName
              if (avalon.modern && svgTags[tagName]) {
      Severity: Minor
      Found in src/vdom/VElement.js - About 4 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 update has a Cognitive Complexity of 28 (exceeds 5 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 4 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 modelFactory has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          platform.modelFactory = function modelFactory(definition, dd) {
              var clone = {}
              for (let i in definition) {
                  clone[i] = definition[i]
                  delete definition[i]
      Severity: Minor
      Found in src/vmodel/proxy.js - About 3 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 exports has 96 lines of code (exceeds 25 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: Major
      Found in karma.sauce.js - About 3 hrs to fix

        Function self has a Cognitive Complexity of 26 (exceeds 5 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 3 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 keys has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            Object.keys = function(object) { //ecma262v5 15.2.3.14
                var theKeys = []
                var skipProto = hasProtoEnumBug && typeof object === 'function'
                if (typeof object === 'string' || (object && object.callee)) {
                    for (var i = 0; i < object.length; ++i) {
        Severity: Minor
        Found in src/seed/lang.fix.js - About 3 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 lexer has 93 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function lexer(string, getOne) {
            var tokens = []
            var breakIndex = 9990
            var stack = []
            var origString = string
        Severity: Major
        Found in src/vtree/fromString.js - About 3 hrs to fix
          Severity
          Category
          Status
          Source
          Language