Function resolve
has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring. Open
function resolve(child, context) {
while (isValidElement(child)) {
// Safe because we just checked it's an element.
let element = child;
let Component = element.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 Renderer.js
has 464 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
Function render
has 141 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(child, context, parentNamespace) {
var t = typeNumber(child)
if (t === 3 || t === 4) {
const text = '' + child;
if (text === '') {
Function resolve
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
function resolve(child, context) {
while (isValidElement(child)) {
// Safe because we just checked it's an element.
let element = child;
let Component = element.type;
Function render
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
render(child, context, parentNamespace) {
var t = typeNumber(child)
if (t === 3 || t === 4) {
const text = '' + child;
if (text === '') {
- 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 processChild
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
function processChild(element, Component) {
let publicContext = processContext(Component, context);
let queue = [];
let replace = false;
Function renderDOM
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
renderDOM(element, context, parentNamespace) {
const tag = element.type.toLowerCase();
let namespace = parentNamespace;
if (parentNamespace === Namespaces.html) {
Function read
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
read(bytes) {
if (this.exhausted) {
return null;
}
- 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 read
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
read(bytes) {
if (this.exhausted) {
return null;
}
Function renderDOM
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
renderDOM(element, context, parentNamespace) {
const tag = element.type.toLowerCase();
let namespace = parentNamespace;
if (parentNamespace === Namespaces.html) {
- 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 deeply nested control flow statements. Open
if (partialState != null) {
if (dontMutate) {
dontMutate = false;
nextState = Object.assign({}, nextState, partialState);
} else {
Function getNonChildrenInnerMarkup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getNonChildrenInnerMarkup(props) {
const innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
return innerHTML.__html;
- 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 '';
Avoid too many return
statements within this function. Open
return '';
Avoid too many return
statements within this function. Open
return '';
Avoid too many return
statements within this function. Open
return '';
Avoid too many return
statements within this function. Open
return '';
Avoid too many return
statements within this function. Open
return this.renderDOM(nextElement, context, parentNamespace);
Avoid too many return
statements within this function. Open
return '';