RubyLouvre/anu

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

Summary

Maintainability
D
1 day
Test Coverage

Function diffProps has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

export function diffProps(dom, lastProps, nextProps, fiber) {
    let isSVG = fiber.namespaceURI === NAMESPACE.svg;
    let tag = fiber.type;
    let continueProps = skipProps;
    if (!isSVG && rform.test(fiber.type)) {
Severity: Minor
Found in packages/render/dom/props.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

File props.js has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { NAMESPACE } from "./browser";
import { patchStyle } from "./style";
import { eventAction, rform } from "./event";
import { typeNumber, emptyObject, noop } from "react-core/util";
//import { duplexAction } from './duplex';
Severity: Minor
Found in packages/render/dom/props.js - About 2 hrs to fix

    Function diffProps has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function diffProps(dom, lastProps, nextProps, fiber) {
        let isSVG = fiber.namespaceURI === NAMESPACE.svg;
        let tag = fiber.type;
        let continueProps = skipProps;
        if (!isSVG && rform.test(fiber.type)) {
    Severity: Minor
    Found in packages/render/dom/props.js - About 1 hr to fix

      Function getSVGAttributeName has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      function getSVGAttributeName(name) {
          if (svgCache[name]) {
              return svgCache[name];
          }
          const match = name.match(rhump);
      Severity: Minor
      Found in packages/render/dom/props.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 getSVGAttributeName has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getSVGAttributeName(name) {
          if (svgCache[name]) {
              return svgCache[name];
          }
          const match = name.match(rhump);
      Severity: Minor
      Found in packages/render/dom/props.js - About 1 hr to fix

        Function getPropAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        function getPropAction(dom, name, isSVG) {
            if (isSVG && name === "className") {
                return "svgClass";
            }
            if (isSpecialAttr[name]) {
        Severity: Minor
        Found in packages/render/dom/props.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 property has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            property: function(dom, name, val) {
                // 尝试直接赋值,部分情况下会失败,如给 input 元素的 size 属性赋值 0 或字符串
                // 这时如果用 setAttribute 则会静默失败
                try {
                    if (!val && val !== 0) {
        Severity: Minor
        Found in packages/render/dom/props.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 svgAttr has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            svgAttr: function(dom, name, val) {
                // http://www.w3school.com.cn/xlink/xlink_reference.asp
                // https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html#notable-enh
                // a ncements xlinkActuate, xlinkArcrole, xlinkHref, xlinkRole, xlinkShow,
                // xlinkTitle, xlinkType eslint-disable-next-line
        Severity: Minor
        Found in packages/render/dom/props.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

        Avoid too many return statements within this function.
        Open

                return "attribute";
        Severity: Major
        Found in packages/render/dom/props.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return "booleanAttr";
          Severity: Major
          Found in packages/render/dom/props.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return name.indexOf("data-") === 0 || dom[name] === void 666
                    ? "attribute"
                    : "property";
            Severity: Major
            Found in packages/render/dom/props.js - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status