govau/performance-dashboard

View on GitHub

Showing 107 of 240 total issues

Function exports has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function() {
  describe('sparkline widget creation', () => {
    let widget;
    let data = [
      [
Severity: Major
Found in client/test_legacy/Widgets/SparklineWidgetSpec.js - About 2 hrs to fix

    Function convertDataForHero has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    function convertDataForHero(_data, _range) {
      let data = _data;
      let range = _range || 13;
      if (data && data.length) {
        data = data.filter(d => d.data && d.data.length);
    Severity: Minor
    Found in client/src/_dashboard-legacy/Helpers/convertDataForHero.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

    Method create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def create(options={}, &block)
          @generate_hero = params[:dashboard].delete :generate_hero
    
          if params.dig(:dashboard, :notes).present?
            begin
    Severity: Minor
    Found in app/admin/dashboard.rb - 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 groupWidgetsToColumns has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    const groupWidgetsToColumns = (widgets, viewport) => {
      let colsNum;
    
      if (viewport === 'sm') {
        colsNum = 1;

    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 has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def create(options={}, &block)
          @generate_hero = params[:dashboard].delete :generate_hero
    
          if params.dig(:dashboard, :notes).present?
            begin
    Severity: Major
    Found in app/admin/dashboard.rb - About 2 hrs to fix

      Function transformDataForCartesian has 51 lines of code (exceeds 25 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: Major
      Found in client/src/_shared/utils/transformForHighcharts.js - About 2 hrs to fix

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

          render() {
            this.date = this.container
              .append('div')
              .attr('class', 'date')
              .attr('style', 'display:none')

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

            def create_full
              data_table = DataTable.create({
                :dashboard_id => @dashboard.id,
                :options => {
                  :period => params[:interval], # year, week, customn
          Severity: Minor
          Found in app/controllers/api/v1/widgets_controller.rb - About 1 hr to fix

            Function formatSeconds has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            const formatSeconds = function(value) {
              let second = 0;
              let minute = '';
              let hour = '';
            
            

            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 init has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              init() {
                super.init();
                let that = this;
                let lastIndex = this.chart.data[0].length - 1;
                this.hover(lastIndex);

            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 mapStateToProps has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const mapStateToProps = (state, ownProps) => {
              const { currentNormalizedSlice } = ownProps;
            
              if (!currentNormalizedSlice) {
                return {

              Function Footer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const Footer = () => {
                return (
                  <footer className="main__footer">
                    <div className="govau-footer">
                      <div className="container">
              Severity: Minor
              Found in client/src/_shared/components/footer/footer.js - About 1 hr to fix

                Function Field has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const Field = props => {
                  const {
                    id,
                    classNames,
                    label,

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

                    render({ formProps, formData }) {
                      if (!formProps) {
                        throw new Error('must provide formProps to base form');
                      }
                  
                  

                    Method call has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def call(env)
                        config = DashboardCool::Application.config.action_controller
                    
                        if config.perform_caching
                          unless env['PATH_INFO'] =~ /^\/assets\//
                    Severity: Minor
                    Found in lib/page_cache_checker.rb - About 1 hr 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 cartesianMultipleCategorySingleSeries has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const cartesianMultipleCategorySingleSeries = (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 1 hr 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 init has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      init() {
                        super.init();
                        this.svg.select('g.chart__wrapper').each(function(_data) {
                          // add rulers
                          d3.select(this)

                      Function init has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        init() {
                          super.init();
                          let that = this;
                          let lastIndex = this.chart.data[0].length - 1;
                          this.hover(lastIndex);

                        Function tryApplyUpdates has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function tryApplyUpdates(onHotUpdateSuccess) {
                          if (!module.hot) {
                            // HotModuleReplacementPlugin is not in Webpack configuration.
                            window.location.reload();
                            return;
                        Severity: Minor
                        Found in client/scripts/webpackHotDevClient.js - About 1 hr 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 getWidgetType has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                        export const getWidgetType = widget => {
                          const { type, options } = widget;
                        
                          if (type === 'fact') {
                            return 'fact';
                        Severity: Minor
                        Found in client/src/_shared/utils/proposedApiChanges.js - About 1 hr 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