eHealthAfrica/direct-delivery-dashboard

View on GitHub

Showing 318 of 318 total issues

Function collateReport has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _this.collateReport = function (res, deliveryRounds, zones) {
      // TODO: move this collation to reduce view if possible
      var rows = res.rows

      var index = rows.length
Severity: Minor
Found in src/app/reports/reports.service.js - About 1 hr to fix

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

        _this.getAll = function () {
          var view = 'measurements/categories'
          var opts = {
            include_docs: true
          }
    src/app/configurations/allocations/assumptions/assumptions.service.js on lines 12..19
    src/app/configurations/allocations/assumptions/assumptions.service.js on lines 21..28
    src/app/configurations/measurements/units/measurements.units.service.js on lines 11..19
    src/app/configurations/products/presentations/product-presentation.service.js on lines 11..18

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

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

        _this.getAll = function () {
          var view = 'products/presentations'
          var opts = {
            include_docs: true
          }
    src/app/configurations/allocations/assumptions/assumptions.service.js on lines 12..19
    src/app/configurations/allocations/assumptions/assumptions.service.js on lines 21..28
    src/app/configurations/measurements/categories/measurements.categories.service.js on lines 11..18
    src/app/configurations/measurements/units/measurements.units.service.js on lines 11..19

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

    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

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

        function setStatus (facilities) {
          var i = facilities.length
          while (i--) {
            vm.facilityStatus[facilities[i]._id] = facilities[i].status
          }
    Severity: Major
    Found in src/app/facility/all/all.controller.js and 1 other location - About 1 hr to fix
    src/app/facility/reports/reports.controller.js on lines 45..50

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

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

      it('should expose saveAll function', function () {
        expect(ctrl.saveAll).toEqual(jasmine.any(Function))
        ctrl.saveAll()
        $rootScope.$digest()
      })
    Severity: Major
    Found in src/app/planning/kpi/kpi.controller.spec.js and 3 other locations - About 1 hr to fix
    src/app/planning/kpi/kpi.controller.spec.js on lines 59..63
    src/app/planning/kpi/kpi.controller.spec.js on lines 65..69
    src/app/planning/kpi/kpi.controller.spec.js on lines 71..75

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

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

        service.getAssumptions = function () {
          var view = 'allocations/assumptions'
          var params = {
            include_docs: true
          }
    src/app/configurations/allocations/assumptions/assumptions.service.js on lines 12..19
    src/app/configurations/measurements/categories/measurements.categories.service.js on lines 11..18
    src/app/configurations/measurements/units/measurements.units.service.js on lines 11..19
    src/app/configurations/products/presentations/product-presentation.service.js on lines 11..18

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

    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

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

        function setStatus (facilities) {
          var i = facilities.length
          while (i--) {
            vm.facilityStatus[facilities[i]._id] = facilities[i].status
          }
    Severity: Major
    Found in src/app/facility/reports/reports.controller.js and 1 other location - About 1 hr to fix
    src/app/facility/all/all.controller.js on lines 111..116

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

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

        _this.getAll = function () {
          var view = 'measurements/units'
          var opts = {
            include_docs: true
          }
    src/app/configurations/allocations/assumptions/assumptions.service.js on lines 12..19
    src/app/configurations/allocations/assumptions/assumptions.service.js on lines 21..28
    src/app/configurations/measurements/categories/measurements.categories.service.js on lines 11..18
    src/app/configurations/products/presentations/product-presentation.service.js on lines 11..18

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

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

        service.getAll = function () {
          var view = 'allocations/all'
          var params = {
            include_docs: true
          }
    src/app/configurations/allocations/assumptions/assumptions.service.js on lines 21..28
    src/app/configurations/measurements/categories/measurements.categories.service.js on lines 11..18
    src/app/configurations/measurements/units/measurements.units.service.js on lines 11..19
    src/app/configurations/products/presentations/product-presentation.service.js on lines 11..18

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

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

      it('should expose isEmpty function', function () {
        expect(ctrl.isEmptyTable).toEqual(jasmine.any(Function))
        ctrl.isEmptyTable()
        $rootScope.$digest()
      })
    Severity: Major
    Found in src/app/planning/kpi/kpi.controller.spec.js and 3 other locations - About 1 hr to fix
    src/app/planning/kpi/kpi.controller.spec.js on lines 47..51
    src/app/planning/kpi/kpi.controller.spec.js on lines 65..69
    src/app/planning/kpi/kpi.controller.spec.js on lines 71..75

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

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

      it('should expose hideKPITable function', function () {
        expect(ctrl.showLoading).toEqual(jasmine.any(Function))
        ctrl.hideKPITable()
        $rootScope.$digest()
      })
    Severity: Major
    Found in src/app/planning/kpi/kpi.controller.spec.js and 3 other locations - About 1 hr to fix
    src/app/planning/kpi/kpi.controller.spec.js on lines 47..51
    src/app/planning/kpi/kpi.controller.spec.js on lines 59..63
    src/app/planning/kpi/kpi.controller.spec.js on lines 65..69

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

    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

        this.getProductStorageType = function () {
          var params = {
            include_docs: true
          }
          var view = 'product-storages/product-storages'
    Severity: Major
    Found in src/app/components/products/products.service.js and 1 other location - About 1 hr to fix
    src/app/components/products/products.service.js on lines 13..20

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

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

      it('should expose showLoading function', function () {
        expect(ctrl.showLoading).toEqual(jasmine.any(Function))
        ctrl.showLoading()
        $rootScope.$digest()
      })
    Severity: Major
    Found in src/app/planning/kpi/kpi.controller.spec.js and 3 other locations - About 1 hr to fix
    src/app/planning/kpi/kpi.controller.spec.js on lines 47..51
    src/app/planning/kpi/kpi.controller.spec.js on lines 59..63
    src/app/planning/kpi/kpi.controller.spec.js on lines 71..75

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

    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

        this.getAll = function () {
          var conf = {
            include_docs: true
          }
          var view = 'products/products'
    Severity: Major
    Found in src/app/components/products/products.service.js and 1 other location - About 1 hr to fix
    src/app/components/products/products.service.js on lines 22..29

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

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

        function zoneReportToArray (roundReport) {
          var collatedZones = []
          var statusByZone = []
          var statusReport
          for (var status in roundReport.status) {
    Severity: Minor
    Found in src/app/planning/delivery-round/delivery-round.service.js - About 1 hr to fix

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

          vm.save = function () {
            var locations = []
            var results = vm.csv.result || vm.result
            for (var i = 0; i < results.length; i++) {
              if (results[i].name) {

        Function getBiWeekly has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            service.getBiWeekly = function (facilities) {
              function setBWMax (MMax) {
                var r = {}
                for (var i in MMax) {
                  if (MMax[i] === 'NA') {

          Function compile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              compile: function (tElem, tAttrs) {
                var position = tAttrs.floatNav || 'right'
                if (position === 'left') {
                  tElem.removeClass('navbar-right').addClass('navbar-left')
                } else {
          Severity: Minor
          Found in src/app/components/navbar/navbar.directive.js - About 1 hr to fix

            Function getMonthlyRequirement has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                service.getMonthlyRequirement = function (facilities) {
                  return service.getAllocations(facilities, service.template.products)
                    .then(service.getTargetPop)
                    .then(function (r) {
                      for (var i in facilities) {

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

              module.exports = function (config) {
                var configuration = {
                  files: listFiles(),
              
                  singleRun: true,
              Severity: Minor
              Found in karma.conf.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language