riot/dom-bindings

View on GitHub

Showing 7 of 7 total issues

Function createPatch has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function createPatch(items, scope, parentScope, binding) {
  const {
    condition,
    template,
    childrenMap,
Severity: Major
Found in src/bindings/each.js - About 2 hrs to fix

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

    export default function attributeExpression(
      node,
      { name, isBoolean },
      value,
      oldValue,
    Severity: Minor
    Found in src/expressions/attribute.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

    Avoid deeply nested control flow statements.
    Open

          if (!map) {
            map = new Map()
            let i = bStart
            while (i < bEnd) map.set(b[i], i++)
          }
    Severity: Major
    Found in src/util/udomdiff.js - About 45 mins to fix

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

        mount(el, scope, parentScope, meta = {}) {
          if (!el) panic('Please provide DOM node to mount properly your template')
      
          if (this.el) this.unmount(scope)
      
      
      Severity: Minor
      Found in src/template.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 (!map || !map.has(a[aStart])) removeChild(get(a[aStart], -1))
      Severity: Major
      Found in src/util/udomdiff.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

              if (map.has(a[aStart])) {
                // grab the index of such node, 'cause it might have been processed
                const index = map.get(a[aStart])
                // if it's not already processed, look on demand for the next LCS
                if (bStart < index && index < bEnd) {
        Severity: Major
        Found in src/util/udomdiff.js - About 45 mins to fix

          Function create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function create(root, binding, templateTagOffset) {
            const { selector, type, redundantAttribute, expressions } = binding
            // find the node to apply the bindings
            const node = selector ? root.querySelector(selector) : root
          
          
          Severity: Minor
          Found in src/binding.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

          Severity
          Category
          Status
          Source
          Language