RubyLouvre/anu

View on GitHub
packages/render/dom/duplex.js

Summary

Maintainability
D
2 days
Test Coverage

Function updateOptions has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

export function updateOptions(node, multiple, propValue, setDefaultSelected) {
    var options = node.options;

    if (multiple) {
        var selectedValues = propValue;
Severity: Minor
Found in packages/render/dom/duplex.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

File duplex.js has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { typeNumber, emptyObject } from "react-core/util";

function getSafeValue(value) {
    switch (typeNumber(value)) {
        case 2:
Severity: Minor
Found in packages/render/dom/duplex.js - About 3 hrs to fix

    Function fireDuplex has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    export function fireDuplex() {
        var radioMap = {};
        if (duplexNodes.length) {
            do {
                let dom = duplexNodes.shift();
    Severity: Minor
    Found in packages/render/dom/duplex.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 update has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            update(node, props) {
                if (props.checked != null) {
                    syncValue(node, "checked", !!props.checked);
                }
                const isActive = node === node.ownerDocument.activeElement;
    Severity: Minor
    Found in packages/render/dom/duplex.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 updateOptions has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function updateOptions(node, multiple, propValue, setDefaultSelected) {
        var options = node.options;
    
        if (multiple) {
            var selectedValues = propValue;
    Severity: Minor
    Found in packages/render/dom/duplex.js - About 1 hr to fix

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

              update(node, props) {
                  if (props.checked != null) {
                      syncValue(node, "checked", !!props.checked);
                  }
                  const isActive = node === node.ownerDocument.activeElement;
      Severity: Minor
      Found in packages/render/dom/duplex.js - About 1 hr to fix

        Function fireDuplex has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function fireDuplex() {
            var radioMap = {};
            if (duplexNodes.length) {
                do {
                    let dom = duplexNodes.shift();
        Severity: Minor
        Found in packages/render/dom/duplex.js - About 1 hr to fix

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

                  update(node, props) {
                      // mount后这个属性没用
                      node._wrapperState.initialValue = void 666;
          
                      let wasMultiple = node._wrapperState.wasMultiple;
          Severity: Minor
          Found in packages/render/dom/duplex.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 (value != null) {
                                  updateOptions(dom, !!props.multiple, value, false);
                              }
          Severity: Major
          Found in packages/render/dom/duplex.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if (
                                    props.type === "radio" &&
                                    name != null &&
                                    !radioMap[name]
                                ) {
            Severity: Major
            Found in packages/render/dom/duplex.js - About 45 mins to fix

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

                      mount(node, props, state) {
                          if (
                              props.hasOwnProperty("value") ||
                              props.hasOwnProperty("defaultValue")
                          ) {
              Severity: Minor
              Found in packages/render/dom/duplex.js - About 35 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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                      update(node, props) {
                          let value = props.value;
                          if (value != null) {
                              let newValue = "" + value;
                              if (newValue !== node.value) {
              Severity: Minor
              Found in packages/render/dom/duplex.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