React-Sight/React-Sight

View on GitHub

Showing 32 of 32 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export function zoomIn() {
  const currentTransform = d3.select('.svg-content-responsive > g').attr('transform');
  const { translateX, translateY, scaleX } = parseSvg(currentTransform);
  let newZoom = scaleX * 1.5;
  newZoom = Math.max(minZoom, Math.min(maxZoom, newZoom));
Severity: Major
Found in extension/frontend/drawChart.js and 1 other location - About 6 hrs to fix
extension/frontend/drawChart.js on lines 267..277

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 162.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export function zoomOut() {
  const currentTransform = d3.select('.svg-content-responsive > g').attr('transform');
  const { translateX, translateY, scaleX } = parseSvg(currentTransform);
  let newZoom = scaleX / 1.5;
  newZoom = Math.max(minZoom, Math.min(maxZoom, newZoom));
Severity: Major
Found in extension/frontend/drawChart.js and 1 other location - About 6 hrs to fix
extension/frontend/drawChart.js on lines 254..264

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 162.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

      const newObj = {
        name: node.name,
        children: [],
        id: node.id,
        props: node.props,
    Severity: Major
    Found in extension/frontend/filters.js and 2 other locations - About 1 hr to fix
    extension/frontend/filters.js on lines 14..22
    extension/frontend/filters.js on lines 64..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 68.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

      const newObj = {
        name: node.name,
        children: [],
        id: node.id,
        props: node.props,
    Severity: Major
    Found in extension/frontend/filters.js and 2 other locations - About 1 hr to fix
    extension/frontend/filters.js on lines 39..47
    extension/frontend/filters.js on lines 64..72

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 68.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

      const newObj = {
        name: node.name,
        children: [],
        id: node.id,
        props: node.props,
    Severity: Major
    Found in extension/frontend/filters.js and 2 other locations - About 1 hr to fix
    extension/frontend/filters.js on lines 14..22
    extension/frontend/filters.js on lines 39..47

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 68.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        if (state == null || state === undefined) {
          stateNode.appendChild(document.createTextNode('None'));
        } else {
          stateNode.appendChild(stateFormatter.render());
        }
      Severity: Major
      Found in extension/frontend/state-props-panel.js and 1 other location - About 1 hr to fix
      extension/frontend/state-props-panel.js on lines 44..48

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        if (props == null || props === undefined) {
          propsNode.appendChild(document.createTextNode('None'));
        } else {
          propsNode.appendChild(propsFomatter.render());
        }
      Severity: Major
      Found in extension/frontend/state-props-panel.js and 1 other location - About 1 hr to fix
      extension/frontend/state-props-panel.js on lines 38..42

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              d3.select('#vSlider').on('input', () => {
                let val = document.querySelector('#vSlider').value;
                vSlider = val;
                update();
              });
              Severity: Major
              Found in extension/frontend/drawChart.js and 1 other location - About 1 hr to fix
              extension/frontend/drawChart.js on lines 64..68

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 56.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              d3.select('#hSlider').on('input', () => {
                let val = document.querySelector('#hSlider').value;
                hSlider = val;
                update();
              });
              Severity: Major
              Found in extension/frontend/drawChart.js and 1 other location - About 1 hr to fix
              extension/frontend/drawChart.js on lines 58..62

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 56.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              export const getRef = (component) => {
                if (component._currentElement && component._currentElement.ref) return component._currentElement.ref;
                return null;
              };
              Severity: Minor
              Found in extension/backend/react-15-hook.js and 1 other location - About 55 mins to fix
              extension/backend/react-15-hook.js on lines 165..168

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 54.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              export const getKey = (component) => {
                if (component._currentElement && component._currentElement.key) return component._currentElement.key;
                return null;
              };
              Severity: Minor
              Found in extension/backend/react-15-hook.js and 1 other location - About 55 mins to fix
              extension/backend/react-15-hook.js on lines 174..177

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 54.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language