IIC2173-2015-2-Grupo2/GUI

View on GitHub
source/services/searchService.js

Summary

Maintainability
F
3 days
Test Coverage

Function searchService has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function searchService($http, $window, $sessionStorage, $localStorage, $rootScope) {
    var vm = this;
    vm.newsPath = 'http://arqui8.ing.puc.cl/api/v1/private/news';
    vm.searchPath = 'http://arqui8.ing.puc.cl/api/v1/private/search';
    vm.tagsPath = 'http://arqui8.ing.puc.cl/api/v1/private/tags';
Severity: Major
Found in source/services/searchService.js - About 4 hrs to fix

    Function searchService has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function searchService($http, $window, $sessionStorage, $localStorage, $rootScope) {
    Severity: Minor
    Found in source/services/searchService.js - About 35 mins to fix

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

          vm.getPeople = function() {
            return getRequest(vm.peoplePath)
                  .success(function(data) { $localStorage.peopleList = _.uniq(data.people.map(vm.tagBuilder), JSON.stringify); })
                  .then(function() { return vm.getLSPeople(); });
          };
      Severity: Major
      Found in source/services/searchService.js and 5 other locations - About 3 hrs to fix
      source/services/searchService.js on lines 78..82
      source/services/searchService.js on lines 84..88
      source/services/searchService.js on lines 90..94
      source/services/searchService.js on lines 102..106
      source/services/searchService.js on lines 108..112

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

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

          vm.getCompanies = function() {
            return getRequest(vm.companiesPath)
                  .success(function(data) { $localStorage.companyList = _.uniq(data.companies.map(vm.tagBuilder), JSON.stringify); })
                  .then(function() { return vm.getLSCompanies(); });
          };
      Severity: Major
      Found in source/services/searchService.js and 5 other locations - About 3 hrs to fix
      source/services/searchService.js on lines 78..82
      source/services/searchService.js on lines 84..88
      source/services/searchService.js on lines 90..94
      source/services/searchService.js on lines 96..100
      source/services/searchService.js on lines 102..106

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

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

          vm.getLocations = function() {
            return getRequest(vm.locationsPath)
                  .success(function(data) { $localStorage.locationList = _.uniq(data.locations.map(vm.tagBuilder), JSON.stringify); })
                  .then(function() { return vm.getLSLocations(); });
          };
      Severity: Major
      Found in source/services/searchService.js and 5 other locations - About 3 hrs to fix
      source/services/searchService.js on lines 78..82
      source/services/searchService.js on lines 84..88
      source/services/searchService.js on lines 90..94
      source/services/searchService.js on lines 96..100
      source/services/searchService.js on lines 108..112

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

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

          vm.getCategories = function() {
            return getRequest(vm.categoriesPath)
                  .success(function(data) { $localStorage.categoryList = _.uniq(data.categories.map(vm.tagBuilder), JSON.stringify); })
                  .then(function() { return vm.getLSCategories(); });
          };
      Severity: Major
      Found in source/services/searchService.js and 5 other locations - About 3 hrs to fix
      source/services/searchService.js on lines 78..82
      source/services/searchService.js on lines 84..88
      source/services/searchService.js on lines 96..100
      source/services/searchService.js on lines 102..106
      source/services/searchService.js on lines 108..112

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

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

          vm.getProviders = function() {
            return getRequest(vm.providersPath)
                  .success(function(data) { $localStorage.providerList = _.uniq(data.news_providers.map(vm.tagBuilder), JSON.stringify); })
                  .then(function() { return vm.getLSProviders(); });
          };
      Severity: Major
      Found in source/services/searchService.js and 5 other locations - About 3 hrs to fix
      source/services/searchService.js on lines 78..82
      source/services/searchService.js on lines 90..94
      source/services/searchService.js on lines 96..100
      source/services/searchService.js on lines 102..106
      source/services/searchService.js on lines 108..112

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

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

          vm.getTags = function() {
            return getRequest(vm.tagsPath)
                  .success(function(data) { $localStorage.tagList = _.uniq(data.tags.map(vm.tagBuilder), JSON.stringify); })
                  .then(function() { return vm.getLSTags(); });
          };
      Severity: Major
      Found in source/services/searchService.js and 5 other locations - About 3 hrs to fix
      source/services/searchService.js on lines 84..88
      source/services/searchService.js on lines 90..94
      source/services/searchService.js on lines 96..100
      source/services/searchService.js on lines 102..106
      source/services/searchService.js on lines 108..112

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

      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

      There are no issues that match your filters.

      Category
      Status