govau/performance-dashboard

View on GitHub

Showing 107 of 240 total issues

Method import! has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
Open

  def import!
    JSON::Validator.validate! data_schema, data
    JSON::Validator.validate! definition_schema, definition

    toggle_auditing false
Severity: Minor
Found in lib/organisation_importer.rb - About 7 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

Method create_full has 178 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_full
    dashboard = Dashboard.new dashboard_params
    dashboard.notes = params[:notes].as_json
    dashboard.published_at = Time.now
    dashboard.save!
Severity: Major
Found in app/controllers/api/v1/dashboards_controller.rb - About 7 hrs to fix

    Method create_kpis has 169 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create_kpis
        data_table = DataTable.create({
          :dashboard_id => @dashboard.id,
          :options => {
            :period => 'month',
    Severity: Major
    Found in app/controllers/api/v1/widgets_controller.rb - About 6 hrs to fix

      Function render has 165 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const pageKey = 'dashboardwidgets';
      
          let {
            ui,

        File transformForHighcharts.js has 365 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import findIndex from 'lodash/findIndex';
        import uniq from 'lodash/uniq';
        import get from 'lodash/get';
        import merge from 'lodash/merge';
        import { getUnitsType } from './../utils/proposedApiChanges';
        Severity: Minor
        Found in client/src/_shared/utils/transformForHighcharts.js - About 4 hrs to fix

          Function WidgetTypeSlice has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const WidgetTypeSlice = props => {
            const { slice, actions, alertProps } = props;
          
            const serviceDashboardUrlAnchor = getServiceDashboardUrlAnchor(
              slice.dashboard.id,

            Method import! has 102 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def import!
                JSON::Validator.validate! data_schema, data
                JSON::Validator.validate! definition_schema, definition
            
                toggle_auditing false
            Severity: Major
            Found in lib/organisation_importer.rb - About 4 hrs to fix

              File CreateChart.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { Component } from 'react';
              import PropTypes from 'prop-types';
              import {
                months,
                charts,
              Severity: Minor
              Found in client/src/editor/scripts/pages/dashboardWidgets/CreateChart.js - About 3 hrs to fix

                File slicesSelectors.js has 325 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                var subMonths = require('date-fns/sub_months');
                var addMonths = require('date-fns/add_months');
                var startOfMonth = require('date-fns/start_of_month');
                var format = require('date-fns/format');
                var differenceInMonths = require('date-fns/difference_in_months');
                Severity: Minor
                Found in client/src/_shared/redux/slices/slicesSelectors.js - About 3 hrs to fix

                  Function cartesianMultipleCategoryMultipleSeries has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const cartesianMultipleCategoryMultipleSeries = (config, slices) => {
                    const position = slices[0].widget.pos;
                    const getColor =
                      config._isKpi === true
                        ? makeGetKpiColorset()
                  Severity: Major
                  Found in client/src/_shared/utils/transformForHighcharts.js - About 3 hrs to fix

                    File pageDashboardWidgets_component.js has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { Component } from 'react';
                    import PropTypes from 'prop-types';
                    import { findDOMNode } from 'react-dom';
                    import { Link } from 'react-router';
                    import { connect } from 'react-redux';

                      Function cartesianMultipleCategoryMultipleSeries has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                      Open

                      const cartesianMultipleCategoryMultipleSeries = (config, slices) => {
                        const position = slices[0].widget.pos;
                        const getColor =
                          config._isKpi === true
                            ? makeGetKpiColorset()
                      Severity: Minor
                      Found in client/src/_shared/utils/transformForHighcharts.js - About 3 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 DashboardWidgetDatagroupTimeSeriesPage has 74 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const DashboardWidgetDatagroupTimeSeriesPage = props => {
                        const { slice } = props;
                        const { widget, dashboard } = slice;
                      
                        let metadata = {

                        Function cartesianMultipleCategorySingleSeries has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const cartesianMultipleCategorySingleSeries = (config, slices) => {
                          const position = slices[0].widget.pos;
                          const getColor =
                            config._isKpi === true
                              ? makeGetKpiColorset()
                        Severity: Major
                        Found in client/src/_shared/utils/transformForHighcharts.js - About 2 hrs to fix

                          File CreateDashboard.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, { Component } from 'react';
                          import { connect } from 'react-redux';
                          import { getServiceDashboardUrl } from './../../utils/formatUrl';
                          import PropTypes from 'prop-types';
                          import Breadcrumbs from 'shared/components/uikit-breadcrumbs';
                          Severity: Minor
                          Found in client/src/editor/scripts/pages/CreateDashboard/CreateDashboard.js - About 2 hrs to fix

                            Function DashboardShowPage has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const DashboardShowPage = props => {
                              const { dashboard, heroWidget, kpiWidgets, btlWidgets, ui } = props;
                            
                              return (
                                <div className="page--dashboard-show">

                              Function withPreview has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const withPreview = ComposedForm => {
                                return class extends PureComponent {
                                  constructor(props) {
                                    super(props);
                              
                              

                                File widgets_controller.rb has 271 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                class Api::V1::WidgetsController < Api::V1::ApiController
                                  before_action :find_dashboard
                                  before_action :find_widget, :only => [:show, :update]
                                
                                  attr_reader :dashboard, :widget
                                Severity: Minor
                                Found in app/controllers/api/v1/widgets_controller.rb - About 2 hrs to fix

                                  Function WidgetTypeFact has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const WidgetTypeFact = props => {
                                    const { fact, actions, alertProps } = props;
                                    const { dashboard, widget } = fact;
                                    const description = widget.description;
                                    const datePublished = widget.last_updated_at;

                                    Function transformDataForCartesian has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    const transformDataForCartesian = (config, slices) => {
                                      // single category  - slices.length === 1
                                      // single section   - slices[0].groups.length === 1
                                    
                                      // single category  - slices.length === 1
                                    Severity: Minor
                                    Found in client/src/_shared/utils/transformForHighcharts.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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language