eHealthAfrica/LMIS-Chrome

View on GitHub

Showing 150 of 150 total issues

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

module.exports = function(grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

Severity: Major
Found in Gruntfile.js - About 2 days to fix

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

          return {
    
            getAll: function () {
              var deferred = $q.defer(), companies = [];
    
    
    Severity: Major
    Found in app/scripts/services/companyfactory.js and 2 other locations - About 1 day to fix
    app/scripts/services/companycategoryfactory.js on lines 25..49
    app/scripts/services/storageunittypefactory.js on lines 32..56

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

    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

      return {
    
        getAll: function () {
          var deferred = $q.defer(), categories = [];
    
    
    Severity: Major
    Found in app/scripts/services/companycategoryfactory.js and 2 other locations - About 1 day to fix
    app/scripts/services/companyfactory.js on lines 21..45
    app/scripts/services/storageunittypefactory.js on lines 32..56

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

    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

          return {
    
            getAll: function () {
              var deferred = $q.defer(), storageUnitTypes = [];
    
    
    Severity: Major
    Found in app/scripts/services/storageunittypefactory.js and 2 other locations - About 1 day to fix
    app/scripts/services/companycategoryfactory.js on lines 25..49
    app/scripts/services/companyfactory.js on lines 21..45

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

    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

    File bundle.js has 496 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict';
    
    angular.module('lmisChromeApp')
      .config(function($stateProvider) {
        $stateProvider
    Severity: Minor
    Found in app/scripts/controllers/bundle.js - About 7 hrs to fix

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

            var resolver = {
              total: batchList.length,
              getData: function ($defer, params) {
                var filtered, sorted = batchList;
                if (params.filter()) {
      Severity: Major
      Found in app/scripts/controllers/batches.js and 1 other location - About 7 hrs to fix
      app/scripts/controllers/product-type.js on lines 41..57

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

      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 resolver = {
              total: productTypes.length,
              getData: function ($defer, params) {
                var filtered, sorted = productTypes;
                if (params.filter()) {
      Severity: Major
      Found in app/scripts/controllers/product-type.js and 1 other location - About 7 hrs to fix
      app/scripts/controllers/batches.js on lines 47..63

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

      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

      File Gruntfile.js has 460 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Generated on 2014-03-02 using generator-angular 0.7.1
      'use strict';
      
      module.exports = function(grunt) {
      
      
      Severity: Minor
      Found in Gruntfile.js - About 7 hrs to fix

        File app-config.js has 458 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        angular.module('lmisChromeApp')
          .config(function($stateProvider) {
            $stateProvider
        Severity: Minor
        Found in app/scripts/controllers/app-config.js - About 7 hrs to fix

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

              $scope.saveProgram = function() {
                if (Object.keys($scope.program).length > 0) {
                  storageService.save(storageService.PROGRAMS, $scope.program).then(
                    function() {
                      var msg = ($scope.uuid) ? {
          Severity: Major
          Found in app/scripts/controllers/programs.js and 1 other location - About 5 hrs to fix
          app/scripts/controllers/programs.js on lines 107..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 142.

          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.saveProgramProduct = function() {
                if (Object.keys($scope.program_product).length > 0) {
                  storageService.save(storageService.PROGRAM_PRODUCTS, $scope.program_product)
                    .then(function() {
                      var msg = ($scope.uuid) ? {
          Severity: Major
          Found in app/scripts/controllers/programs.js and 1 other location - About 5 hrs to fix
          app/scripts/controllers/programs.js on lines 22..37

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

          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

              set: function (obj) {
                var deferred = $q.defer();
                if (chromeStorage) {
                  chromeStorage.set(obj, function () {
                    if ($window.chrome.runtime.lastError !== undefined) {
          Severity: Major
          Found in app/scripts/services/chrome-storage-api.js and 1 other location - About 4 hrs to fix
          app/scripts/services/chrome-storage-api.js on lines 55..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 132.

          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

              remove: function (items) {
                var deferred = $q.defer();
                if (chromeStorage) {
                  chromeStorage.remove(items, function () {
                    if ($window.chrome.runtime.lastError !== undefined) {
          Severity: Major
          Found in app/scripts/services/chrome-storage-api.js and 1 other location - About 4 hrs to fix
          app/scripts/services/chrome-storage-api.js on lines 14..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 132.

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

            .service('trackingService', function trackingService($q, $log, $window, $rootScope, config, utility, storageService, deviceInfoFactory, appConfigService) {
              var tracker = {
                sendAppView: function() {},
                sendException: function() {},
                sendEvent: function() {},
          Severity: Major
          Found in app/scripts/services/tracking-service.js - About 4 hrs to fix

            Function controller has 115 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        controller: function($q, $log, mostRecentCount, productProfileFactory, $scope, $window, i18n, storageService, dashboardfactory, inventoryRulesFactory, productTypeFactory, appConfig, appConfigService, cacheService, stockOutList, utility, $rootScope, isStockCountReminderDue, stockCountFactory) {
            
                          var keys = [
                            {
                              key: 'stockBelowReorder',
            Severity: Major
            Found in app/scripts/controllers/home.js - About 4 hrs to fix

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

                      var resolver = {
                        total: inventoryItems.length,
                        getData: function ($defer, params) {
                          var orderedData = params.sorting() ? $filter('orderBy')(inventoryItems, params.orderBy()) : inventoryItems;
                          $defer.resolve(orderedData.slice(
              Severity: Major
              Found in app/scripts/controllers/inventory.js and 1 other location - About 4 hrs to fix
              app/scripts/controllers/programs.js on lines 154..164

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

              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 resolver = {
                      total: data.length,
                      getData: function($defer, params) {
                        var orderedData = params.sorting() ? $filter('orderBy')(data,
                          params.orderBy()) : data;
              Severity: Major
              Found in app/scripts/controllers/programs.js and 1 other location - About 4 hrs to fix
              app/scripts/controllers/inventory.js on lines 65..74

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

              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.onLgaSelection = function(lga) {
              
                    appConfigService.getSelectedFacility((JSON.parse(lga).uuid), event);
                    $scope.appConfig.facility.selectedLgas =
                      utility.addObjectToCollection(lga, $scope.appConfig.facility.selectedLgas, '_id');
              Severity: Major
              Found in app/scripts/controllers/app-config.js and 1 other location - About 3 hrs to fix
              app/scripts/controllers/app-config.js on lines 262..268

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

              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.onLgaSelection = function(lga){
              
                    appConfigService.getSelectedFacility((JSON.parse(lga)).uuid, event);
                    $scope.appConfig.facility.selectedLgas =
                      utility.addObjectToCollection(lga, $scope.appConfig.facility.selectedLgas, '_id');
              Severity: Major
              Found in app/scripts/controllers/app-config.js and 1 other location - About 3 hrs to fix
              app/scripts/controllers/app-config.js on lines 417..423

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

              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

              File home.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              'use strict';
              
              angular.module('lmisChromeApp')
                .config(function($urlRouterProvider, $stateProvider) {
                  // Initial state
              Severity: Minor
              Found in app/scripts/controllers/home.js - About 3 hrs to fix
                Severity
                Category
                Status
                Source
                Language