eHealthAfrica/LMIS-Chrome

View on GitHub

Showing 150 of 150 total issues

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

      var add = function(alert){
        if(typeof alert.id === 'undefined'){
          alert.id = generateId();
        }
        $rootScope.alerts[alert.id] = alert;
Severity: Major
Found in app/scripts/services/alert-factory.js and 1 other location - About 1 hr to fix
app/scripts/services/reminder-factory.js on lines 21..27

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

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

          $scope.removeOrderLine = function (orderLine) {
            $scope.order.order_lines = $scope.order.order_lines.filter(function (line) {
              return line.id !== orderLine.id;
            });
          };
Severity: Major
Found in app/scripts/controllers/orders.js and 2 other locations - About 1 hr to fix
app/scripts/controllers/bundle.js on lines 367..371
app/scripts/controllers/inventory.js on lines 164..168

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

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

      $scope.removeInventoryLine = function (inventoryLine) {
        $scope.inventory.inventory_lines = $scope.inventory.inventory_lines.filter(function (invLine) {
          return invLine.id !== inventoryLine.id;
        });
      };
Severity: Major
Found in app/scripts/controllers/inventory.js and 2 other locations - About 1 hr to fix
app/scripts/controllers/bundle.js on lines 367..371
app/scripts/controllers/orders.js on lines 67..71

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

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

      var add = function(reminder){
        if(typeof reminder.id === 'undefined'){
          reminder.id = generateReminderId();
        }
        $rootScope.reminders[reminder.id] = reminder;
Severity: Major
Found in app/scripts/services/reminder-factory.js and 1 other location - About 1 hr to fix
app/scripts/services/alert-factory.js on lines 16..22

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

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

      $stateProvider
          .state('batchListView', {
            url: '/batch-list-view',
            templateUrl: '/views/batches/index.html',
            controller: 'BatchListCtrl',
Severity: Major
Found in app/scripts/controllers/batches.js and 1 other location - About 1 hr to fix
app/scripts/controllers/inventory.js on lines 3..43

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

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

    $scope.removeLine = function(bundleLine) {
      $scope.bundle.bundleLines = $scope.bundle.bundleLines.filter(function(line) {
        return line.id !== bundleLine.id;
      });
    };
Severity: Major
Found in app/scripts/controllers/bundle.js and 2 other locations - About 1 hr to fix
app/scripts/controllers/inventory.js on lines 164..168
app/scripts/controllers/orders.js on lines 67..71

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

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

    function loadAppConfig() {
      //TODO: figure out a better way of knowing if the app has been configured or not.

      return storageService.all(storageService.APP_CONFIG)
        .then(function(res) {
Severity: Minor
Found in app/scripts/controllers/app-config.js - About 1 hr to fix

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

        $scope.save = function() {
          $scope.isSaving = true;
          var productType = JSON.parse($scope.stockOutForm.productType);
          var confirmationTitle = i18n('confirmStockOutHeader', productType.code);
          var confirmationQuestion = i18n('dialogConfirmationQuestion');
    Severity: Minor
    Found in app/scripts/controllers/stock-out-broadcast.js - About 1 hr to fix

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

            function getByUUID(uuid) {
              var deferred = $q.defer();
              storageService.find(storageService.CURRENCIES, uuid).then(function (data) {
                deferred.resolve(data);
              });
      Severity: Major
      Found in app/scripts/services/currencyfactory.js and 1 other location - About 1 hr to fix
      app/scripts/services/modeofadministrationfactory.js on lines 6..13

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

      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

            var getByUuid = function(uuid) {
              var deferred = $q.defer();
              storageService.find(storageService.MODE_OF_ADMINISTRATION, uuid)
                  .then(function (data) {
                    deferred.resolve(data);
      Severity: Major
      Found in app/scripts/services/modeofadministrationfactory.js and 1 other location - About 1 hr to fix
      app/scripts/services/currencyfactory.js on lines 5..11

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

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

                    controller: function($log, $scope, localDocs, config, pouchdb) {
                      $scope.locals = localDocs.rows.map(function(local) {
                        return local.id;
                      });
      
      
      Severity: Minor
      Found in app/scripts/controllers/stock-count-sync-stat.js - About 1 hr to fix

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

              return {
                DAILY: DAILY,
                WEEKLY: WEEKLY,
                BI_WEEKLY: BI_WEEKLY,
                MONTHLY: MONTHLY,
        Severity: Major
        Found in app/scripts/services/reminder-factory.js and 1 other location - About 1 hr to fix
        app/scripts/services/stock-count-factory.js on lines 205..218

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

        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

            return {
              getStockCountDueDate: getStockCountDueDate,
              isStockCountDue: isStockCountDue,
              getMostRecentStockCount: getMostRecentStockCount,
              getLatestCompleteStockCount: getLatestCompleteStockCount,
        Severity: Major
        Found in app/scripts/services/stock-count-factory.js and 1 other location - About 1 hr to fix
        app/scripts/services/reminder-factory.js on lines 66..79

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

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

                controller: function ($scope, $filter, currentFacility, uomList, productTypes, facilities, loggedInUser, programs, $stateParams, $state, ordersFactory) {
        
                  $scope.storage = {
                    uomList: uomList,
                    productTypes: productTypes,
        Severity: Minor
        Found in app/scripts/controllers/orders.js - About 1 hr to fix

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

                for (var i in bundle.bundleLines) {
                  var ppUuid = bundle.bundleLines[i].productProfile;
                  bundle.bundleLines[i].productProfile = productProfileFactory.get(ppUuid);
                }
          Severity: Major
          Found in app/scripts/controllers/bundle.js and 1 other location - About 1 hr to fix
          app/scripts/controllers/bundle.js on lines 386..389

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

          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

                for (var i in bundle.bundleLines) {
                  var ppUuid = bundle.bundleLines[i].productProfile;
                  bundle.bundleLines[i].productProfile = productProfileFactory.get(ppUuid);
                }
          Severity: Major
          Found in app/scripts/controllers/bundle.js and 1 other location - About 1 hr to fix
          app/scripts/controllers/bundle.js on lines 154..157

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

          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 controller has 11 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  controller: function ($scope, $filter, currentFacility, uomList, productTypes, facilities, loggedInUser, programs, $stateParams, $state, ordersFactory) {
          Severity: Major
          Found in app/scripts/controllers/orders.js - About 1 hr to fix

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

            module.exports = function(config) {
              config.set({
                // base path, that will be used to resolve files and exclude
                basePath: '',
            
            
            Severity: Minor
            Found in karma.conf.js - About 1 hr to fix

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

                  $scope.save = function() {
                    $scope.isSaving = true;
                     $scope.activeCCE.ccuProfile = JSON.parse($scope.selectedProfile);
                    $scope.switchActiveCCE();
              
              
              Severity: Minor
              Found in app/scripts/controllers/cold-chain-units.js - About 1 hr to fix

                Function canConnect has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var canConnect = function() {
                      var deferred = $q.defer();
                      var testDb = 'connection_test';
                      var counter = 0;
                      var reason;
                Severity: Minor
                Found in app/scripts/services/device-info-factory.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language