React-Sight/React-Sight

View on GitHub

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;

Severity: Minor
Found in extension/backend/react-15-hook.js - About 4 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 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
Severity: Major
Found in extension/frontend/drawChart.js - About 4 hrs to fix

    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;
    Severity: Minor
    Found in extension/backend/installHook.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

    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,
    Severity: Minor
    Found in extension/backend/fiber-hook.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

    Function recur16 has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const recur16 = (node, parentArr) => {
      const newComponent = {
        name: '',
        children: [],
        state: null,
    Severity: Minor
    Found in extension/backend/fiber-hook.js - About 1 hr to fix

      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;
      Severity: Minor
      Found in extension/backend/installHook.js - About 1 hr to fix

        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;
        
        
        Severity: Minor
        Found in extension/backend/react-15-hook.js - About 1 hr to fix

          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
          Severity: Minor
          Found in extension/frontend/state-props-panel.js - About 1 hr to fix

            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: [],
            Severity: Minor
            Found in extension/backend/react-15-hook.js - About 1 hr to fix

              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
              Severity: Major
              Found in extension/backend/react-15-hook.js - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                    return parsedProps;
                Severity: Major
                Found in extension/backend/react-15-hook.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        else if (key === 'routes') return;
                  Severity: Major
                  Found in extension/backend/react-15-hook.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        else if (props.hasOwnProperty('type')) return `${props.type}`;
                    Severity: Major
                    Found in extension/backend/react-15-hook.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          else if (props.type.hasOwnProperty('name') && props.type.name.length) return props.type.name;
                      Severity: Major
                      Found in extension/backend/react-15-hook.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            else if (props.type.hasOwnProperty('displayName') && props.type.displayName.length) return props.type.displayName;
                        Severity: Major
                        Found in extension/backend/react-15-hook.js - About 30 mins to fix

                          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
                          Severity: Minor
                          Found in extension/frontend/state-props-panel.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

                          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
                          Severity: Minor
                          Found in extension/frontend/drawChart.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

                          Severity
                          Category
                          Status
                          Source
                          Language