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)) {
- Read upRead up
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';
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)) {
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);
- Read upRead up
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);
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]) {
- Read upRead up
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) {
- Read upRead up
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
- Read upRead up
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";
Avoid too many return
statements within this function. Open
return "booleanAttr";
Avoid too many return
statements within this function. Open
return name.indexOf("data-") === 0 || dom[name] === void 666
? "attribute"
: "property";