N3-components/N3-components

View on GitHub
src/tree/model/node.js

Summary

Maintainability
C
1 day
Test Coverage

File node.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { markNodeData, NODE_KEY } from './util'

const objectAssign = Object.assign

const reInitChecked = function (node) {
Severity: Minor
Found in src/tree/model/node.js - About 3 hrs to fix

    Function constructor has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      constructor (options) {
        this.id = nodeIdSeed++
        this.text = null
        this.checked = false
        this.indeterminate = false
    Severity: Minor
    Found in src/tree/model/node.js - About 2 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 constructor has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor (options) {
        this.id = nodeIdSeed++
        this.text = null
        this.checked = false
        this.indeterminate = false
    Severity: Major
    Found in src/tree/model/node.js - About 2 hrs to fix

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

        setChecked (value, deep) {
          this.indeterminate = value === 'half'
          this.checked = value === true
      
          const handleDescendants = () => {
      Severity: Minor
      Found in src/tree/model/node.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 reInitChecked has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      const reInitChecked = function (node) {
        const siblings = node.childNodes
      
        let all = true
        let none = true
      Severity: Minor
      Found in src/tree/model/node.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 expand has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        expand (callback, expandParent) {
          const done = () => {
            if (expandParent) {
              let parent = this.parent
              while (parent.level > 0) {
      Severity: Minor
      Found in src/tree/model/node.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 loadData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        loadData (callback, defaultProps = {}) {
          if (this.store.lazy === true && this.store.load && !this.loaded && !this.loading) {
            this.loading = true
      
            const resolve = (children) => {
      Severity: Minor
      Found in src/tree/model/node.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

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

        setData (data) {
          if (!Array.isArray(data)) {
            markNodeData(this, data)
          }
      
      
      Severity: Minor
      Found in src/tree/model/node.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

      There are no issues that match your filters.

      Category
      Status