Showing 17 of 32 total issues
Function parseProps
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
const parseProps = (props, i = 0) => {
if (!props) return null;
if (props.hasOwnProperty(window) || props.hasOwnProperty('prevObject') || props.hasOwnProperty(Window)) return null; // window was causing infinite loops
if (typeof props !== 'object') return props;
- 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 update
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
function update(source) {
treemap = d3.tree()
.nodeSize([hSlider * 5, hSlider * 5]);
// Creates a curved (diagonal) path from parent to the child nodes
Function installHook
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
(function installHook() {
// no instance of React detected
if (!window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
console.log('Error: React DevTools not present. React Sight uses React DevTools to patch React\'s reconciler');
return;
- 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 recur16
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export const recur16 = (node, parentArr) => {
const newComponent = {
name: '',
children: [],
state: 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 recur16
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const recur16 = (node, parentArr) => {
const newComponent = {
name: '',
children: [],
state: null,
Function installHook
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function installHook() {
// no instance of React detected
if (!window.__REACT_DEVTOOLS_GLOBAL_HOOK__) {
console.log('Error: React DevTools not present. React Sight uses React DevTools to patch React\'s reconciler');
return;
Function parseProps
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const parseProps = (props, i = 0) => {
if (!props) return null;
if (props.hasOwnProperty(window) || props.hasOwnProperty('prevObject') || props.hasOwnProperty(Window)) return null; // window was causing infinite loops
if (typeof props !== 'object') return props;
Function updatePanel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updatePanel(state, props) {
const stateNode = document.getElementById('state');
const propsNode = document.getElementById('props');
// state
Function traverseAllChildren
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const traverseAllChildren = (component, parentArr) => {
if (!component._currentElement) return;
const newComponent = {
children: [],
Avoid deeply nested control flow statements. Open
if (i < 3) { // limit this func
const iterator = i + 1;
parsedProps[key] = parseProps(props[key], iterator);
} else parsedProps[key] = 'obj*'; // end recursion so we dont get infinite loops
Avoid too many return
statements within this function. Open
return parsedProps;
Avoid too many return
statements within this function. Open
else if (key === 'routes') return;
Avoid too many return
statements within this function. Open
else if (props.hasOwnProperty('type')) return `${props.type}`;
Avoid too many return
statements within this function. Open
else if (props.type.hasOwnProperty('name') && props.type.name.length) return props.type.name;
Avoid too many return
statements within this function. Open
else if (props.type.hasOwnProperty('displayName') && props.type.displayName.length) return props.type.displayName;
Function updatePanel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function updatePanel(state, props) {
const stateNode = document.getElementById('state');
const propsNode = document.getElementById('props');
// state
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function update(source) {
treemap = d3.tree()
.nodeSize([hSlider * 5, hSlider * 5]);
// Creates a curved (diagonal) path from parent to the child nodes
- 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"