eHealthAfrica/direct-delivery-dashboard

View on GitHub

Showing 318 of 318 total issues

Function get has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function get () {
      var seen = {}
      var states = $state.get()
      function hasLabel (state) {
        return !state.abstract && state.data && state.data.label
Severity: Minor
Found in src/app/components/navbar/navbar.service.js - About 1 hr to fix

    Function copyFromRoundDialog has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        vm.copyFromRoundDialog = function () {
          var copyRoundDialog = $modal.open({
            animation: true,
            templateUrl: 'app/planning/facilities/dialogs/copy-round/copy-round.html',
            controller: 'CopyRoundTemplateDialogCtrl',
    Severity: Minor
    Found in src/app/planning/facilities/manage-facilities.controller.js - About 1 hr to fix

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

            } else if (vm.selected.zone) {
              vm.selectedLocation = vm.nestedFacilities.zone[vm.selected.zone]
              vm.selected.type = 'Zone'
              buildLocationList()
            } else {
      Severity: Major
      Found in src/app/facility/all/all.controller.js and 1 other location - About 1 hr to fix
      src/app/reports/packing/packing-report.controller.js on lines 94..103

      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 3 locations. Consider refactoring.
      Open

          {
            'id': 'id3',
            'key': ['2015-01-01', 'round2'],
            'value': {
              'status': 'failed',
      Severity: Major
      Found in src/app/components/db/db.service.mock.js and 2 other locations - About 1 hr to fix
      src/app/components/db/db.service.mock.js on lines 254..266
      src/app/components/db/db.service.mock.js on lines 267..279

      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

          it('Should set ScheduleRoundCtrl.exportForRouting to expected array', function () {
            var exportData = scheduleService.prepareExport(deliveryRound._id, dailyDeliveries)
            expect(ScheduleRoundCtrl.exportForRouting).toEqual(exportData.rows)
          })
      Severity: Major
      Found in src/app/planning/schedule/schedule-round.controller.spec.js and 1 other location - About 1 hr to fix
      src/app/planning/schedule/schedule-round.controller.spec.js on lines 127..130

      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

          it('Should match expected array in given order', function () {
            var exportData = scheduleService.prepareExport(deliveryRound._id, dailyDeliveries)
            expect(ScheduleRoundCtrl.exportHeader).toEqual(exportData.headers)
          })
      Severity: Major
      Found in src/app/planning/schedule/schedule-round.controller.spec.js and 1 other location - About 1 hr to fix
      src/app/planning/schedule/schedule-round.controller.spec.js on lines 120..123

      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 3 locations. Consider refactoring.
      Open

          {
            'id': 'id2',
            'key': ['2015-01-01', 'round1'],
            'value': {
              'status': 'success',
      Severity: Major
      Found in src/app/components/db/db.service.mock.js and 2 other locations - About 1 hr to fix
      src/app/components/db/db.service.mock.js on lines 254..266
      src/app/components/db/db.service.mock.js on lines 280..292

      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

        describe('views.productPresentation', function () {
          it('Should be set to expected value', function () {
            var expected = 'Product Presentation'
            expect(DeliveryAllocationCtrl.views.productPresentation).toBe(expected)
          })
      src/app/planning/allocation/delivery-allocation.controller.spec.js on lines 61..66

      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

        describe('views.packedProduct', function () {
          it('Should be set to expected value', function () {
            var expected = 'Packed Product'
            expect(DeliveryAllocationCtrl.views.packedProduct).toBe(expected)
          })
      src/app/planning/allocation/delivery-allocation.controller.spec.js on lines 68..73

      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 3 locations. Consider refactoring.
      Open

          {
            'id': 'id1',
            'key': ['2015-01-01', 'round1'],
            'value': {
              'status': 'upcoming',
      Severity: Major
      Found in src/app/components/db/db.service.mock.js and 2 other locations - About 1 hr to fix
      src/app/components/db/db.service.mock.js on lines 267..279
      src/app/components/db/db.service.mock.js on lines 280..292

      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

            } else if (vm.selected.zone) {
              vm.selectedLocation = vm.reports.zone[vm.selected.zone]
              vm.selected.type = 'Zone'
              buildLocationList()
            } else {
      Severity: Major
      Found in src/app/reports/packing/packing-report.controller.js and 1 other location - About 1 hr to fix
      src/app/facility/all/all.controller.js on lines 50..60

      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

      Function fillInMissingKPI has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          _this.fillInMissingKPI = function (kpiList, roundId, kpiTemplate) {
            var view = 'kpi/deliveries-date-and-driver-by-round'
            var param = {
              key: roundId
            }
      Severity: Minor
      Found in src/app/components/kpi/kpi.service.js - About 1 hr to fix

        Function collate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function collate (locations) {
              var i = locations.length
              var locationLevel = groupByLevel(locations)
              var facilities = []
              var zone = {}
        Severity: Minor
        Found in src/app/facility/facility.service.js - About 1 hr to fix

          Function getChartData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              vm.getChartData = function (zoneData) {
                var graphData = [
                  {
                    'key': 'Success',
                    'color': 'green',
          Severity: Minor
          Found in src/app/reports/delivery/delivery-report.controller.js - About 1 hr to fix

            Function save has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                vm.save = function () {
                  var locations = []
                  var results = vm.csv.result
            
                  for (var i in results) {

              Function getAlertReceiversForRound has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  _this.getAlertReceiversForRound = function (deliveryRound) {
                    var stateCode = deliveryRound.roundCode && deliveryRound.roundCode.split('-')[0] || deliveryRound.id.split('-')[0]
                    var view = 'dashboard-delivery-rounds/alert-receivers'
                    var options = {include_docs: true, keys: ['all', stateCode]}
              
              
              Severity: Minor
              Found in src/app/planning/schedule/schedules.service.js - About 1 hr to fix

                Function csvUpload has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    vm.csvUpload = function (data) {
                      var modalInstance = $modal.open({
                        animation: true,
                        templateUrl: 'app/configurations/allocations/targetpop/upload/upload-csv-form.html',
                        controller: 'TargetPopCSVUploadCtrl',

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

                    it('should expose setStateCode function', function () {
                      nrdCtrl.setStateCode()
                      $rootScope.$digest()
                      expect(nrdCtrl.deliveryRound.stateCode).toBeDefined()
                    })
                  src/app/planning/delivery-round/dialog/round-dialog.controller.spec.js on lines 101..105

                  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 55.

                  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

                      $scope.$on('stateChanged', function (event, data) {
                        var state = data.state
                        vm.selectedStateId = state._id
                        vm.switchState()
                      })
                  src/app/configurations/allocations/targetpop/targetpop.controller.js on lines 156..160

                  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 55.

                  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

                      $scope.$on('stateChanged', function (event, data) {
                        var state = data.state
                        vm.selectedState = state._id
                        vm.switchLocationState()
                      })
                  src/app/configurations/facilities/list/facilities.list.controller.js on lines 87..91

                  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 55.

                  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