hisptz/function-maintenance

View on GitHub

Showing 340 of 789 total issues

Function drawTable has a Cognitive Complexity of 150 (exceeds 5 allowed). Consider refactoring.
Open

export function drawTable(
  analyticsObject,
  tableConfiguration: TableConfiguration,
  legendSets: LegendSet[]
) {

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

File draw-chart.helper.ts has 1153 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as _ from 'lodash';
import { ChartConfiguration } from '../models';

export function drawChart(
  incomingAnalyticsObject: any,

    File map-files.service.ts has 834 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {Injectable} from '@angular/core';
    import * as _ from 'lodash';
    import {saveAs} from 'file-saver';
    import * as shapeWrite from 'shp-write';
    import {Observable} from 'rxjs';

      File function.service.ts has 720 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { Injectable } from '@angular/core';
      import * as _ from 'lodash';
      import { NgxDhis2HttpClientService } from '@hisptz/ngx-dhis2-http-client';
      import { mergeMap, catchError, switchMap, map } from 'rxjs/operators';
      import { forkJoin, of, Observable, throwError } from 'rxjs';

        Function drawTable has 263 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function drawTable(
          analyticsObject,
          tableConfiguration: TableConfiguration,
          legendSets: LegendSet[]
        ) {

          File colorBrewer.ts has 579 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // This product includes color specifications and designs developed by Cynthia Brewer (http://colorbrewer.org/).
          // Please see license at http://colorbrewer.org/export/LICENSE.txt
          export const colorBrewer = {
            YlGn: {
              3: ['#f7fcb9', '#addd8e', '#31a354'],

            Function sortData has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
            Open

              sortData(tableObject, n, isLastItem) {
                if (tableObject.columns.length === 1 && isLastItem) {
                  this.current_sorting = [];
                  this.current_sorting[n] = true;
                  let table,

            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

            MapFilesService has 60 functions (exceeds 20 allowed). Consider refactoring.
            Open

            @Injectable()
            export class MapFilesService {
            
              geometry: any;
            
            

              Function reducer has 209 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function reducer(
                state = initialState,
                action: fromVisualizationLegend.VisualizationLegendAction
              ): VisualizationLegendState {
                switch (action.type) {

                Function reducer has 192 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function reducer(
                  state = initialState,
                  action: fromVisualizationObject.VisualizationObjectAction
                ): VisualizationObjectState {
                  switch (action.type) {

                  Function _getExecutingPeriodFunctions has 179 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    private _getExecutingPeriodFunctions() {
                      const currentDate = new Date();
                      return {
                        _MONTH: (template, counts, tense) => {
                          const currentMonth = currentDate.getMonth();

                    Function getExecutingPeriodFunctions has 179 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function getExecutingPeriodFunctions() {
                      const currentDate = new Date();
                      return {
                        _MONTH: (template, counts, tense) => {
                          const currentMonth = currentDate.getMonth();

                      Function updateDataSelectionBasedOnPreferences has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function updateDataSelectionBasedOnPreferences(
                        dataSelection: VisualizationDataSelection,
                        visualizationType,
                        favoritePreferences: any
                      ) {

                      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

                      File leaflet.pattern.js has 444 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*
                       Leaflet.pattern, Provides tools to set the backgrounds of vector shapes in Leaflet to be patterns.
                       https://github.com/teastman/Leaflet.pattern
                       (c) 2015, Tyler Eastman
                      */

                        File get-iso-format-from-relative-period.helper.ts has 433 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import * as _ from 'lodash';
                        
                        export function getISOFormatFromRelativePeriod(favourite) {
                          const isoFormat = [];
                          let periodDimension: any;

                          Function deduceSelectedPeriodType has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                          Open

                            deduceSelectedPeriodType(selectedPeriods: any[]) {
                              let periodType = 'Monthly';
                              if (selectedPeriods && selectedPeriods[0]) {
                                const periodId = selectedPeriods[0].id;
                          
                          

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

                          export function getSelectedPeriodsType(selectedPeriods: any[]) {
                            let periodType = 'Monthly';
                            if (selectedPeriods && selectedPeriods[0]) {
                              const periodId = selectedPeriods[0].id;
                          
                          

                          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

                          File relative-period.service.ts has 417 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { Injectable } from '@angular/core';
                          import * as _ from 'lodash';
                          
                          @Injectable()
                          export class RelativePeriodService {

                            File draw-table.helper.ts has 408 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { TableConfiguration } from '../models/table-configuration';
                            import { LegendSet } from '../models/legend-set.model';
                            const USE_BY_DATA_ITEM_LEGEND = 'BY_DATA_ITEM';
                            import * as _ from 'lodash';
                            
                            

                              File visualization-object.effects.ts has 364 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { Injectable } from '@angular/core';
                              import { SystemInfoService } from '@hisptz/ngx-dhis2-http-client';
                              import { Actions, Effect, ofType } from '@ngrx/effects';
                              import { Store } from '@ngrx/store';
                              import * as _ from 'lodash';
                                Severity
                                Category
                                Status
                                Source
                                Language