RubyLouvre/avalon

View on GitHub
src/directives/for.js

Summary

Maintainability
C
1 day
Test Coverage

File for.js has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { avalon, createFragment, platform, isObject, ap } from '../seed/core'

import { VFragment } from '../vdom/VFragment'
import { $$skipArray } from '../vmodel/reserved'

Severity: Minor
Found in src/directives/for.js - About 2 hrs to fix

    Function diffList has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function diffList(instance) {
        var cache = instance.cache
        var newCache = {}
        var fuzzy = []
        var list = instance.preFragments
    Severity: Minor
    Found in src/directives/for.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 updateList has 28 lines of code (exceeds 25 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 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 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 isInCache has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            function isInCache(cache, id) {
                var c = cache[id]
                if (c) {
                    var arr = c.arr
                        /* istanbul ignore if*/
            Severity: Minor
            Found in src/directives/for.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, createFragment, platform, isObject, ap } from '../seed/core'
            Severity: Minor
            Found in src/directives/for.js by eslint

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

            There are no issues that match your filters.

            Category
            Status