govau/performance-dashboard

View on GitHub

Showing 107 of 240 total issues

Function transformForHighcharts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const transformForHighcharts = (slices, isKpi = false) => {
  if (typeof slices === 'undefined' || slices.length === 0) {
    throw new Error('Must provide slices to transformForHighcharts.');
  }

Severity: Minor
Found in client/src/_shared/utils/transformForHighcharts.js - About 35 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 BtlWidget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const BtlWidget = props => {
  const { _type } = props;

  if (
    // whitelist
Severity: Minor
Found in client/src/_shared/components/chartWidget/chartWidget_component.js - About 35 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

Avoid too many return statements within this function.
Open

    return 'sparkline';
Severity: Major
Found in client/src/_shared/utils/proposedApiChanges.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return 'hero';
    Severity: Major
    Found in client/src/_shared/utils/proposedApiChanges.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return 'line';
      Severity: Major
      Found in client/src/_shared/utils/proposedApiChanges.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return prefix + d3.format('.2s')(value) + suffix;

          Avoid too many return statements within this function.
          Open

                return prefix + d3.format('.1f')(value) + suffix;

            Avoid too many return statements within this function.
            Open

              return;
            Severity: Major
            Found in client/src/_shared/utils/proposedApiChanges.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return prefix + d3.format('f')(value) + suffix;

                Avoid too many return statements within this function.
                Open

                    return nextLatestSlice;
                Severity: Major
                Found in client/src/_shared/redux/slices/slicesSelectors.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                    return;
                  Severity: Major
                  Found in client/src/_shared/utils/proposedApiChanges.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return prefix + value + suffix;

                      Avoid too many return statements within this function.
                      Open

                          return '';
                      Severity: Major
                      Found in client/src/editor/scripts/pages/dashboardWidgets/CreateChart.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          return null;
                        Severity: Major
                        Found in client/src/_shared/redux/slices/slicesSelectors.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return;
                          Severity: Major
                          Found in client/src/_shared/utils/proposedApiChanges.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return mostRecentSlice;
                            Severity: Major
                            Found in client/src/_shared/redux/slices/slicesSelectors.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return 'donut';
                              Severity: Major
                              Found in client/src/_shared/utils/proposedApiChanges.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return prefix + d3.format('.2f')(value) + suffix;

                                  Avoid too many return statements within this function.
                                  Open

                                      return 'kpi-count';
                                  Severity: Major
                                  Found in client/src/_shared/utils/proposedApiChanges.js - About 30 mins to fix

                                    Function setLastWidgetImpression has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    export const setLastWidgetImpression = ({
                                      widgetId = null,
                                      type = null,
                                      description = null,
                                    }) => {
                                    Severity: Minor
                                    Found in client/src/editor/scripts/redux/ui/uiActions.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