manshar/manshar

View on GitHub

Showing 82 of 82 total issues

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

'use strict';

// TODO(mkhatib): Seperate these into config/routes.js and
// config/interceptors/httpInterceptors.js and add tests for them.
// TODO(mkhatib): Move the autogenerated appConfig.js to config/constants.js.
Severity: Major
Found in web-client/app/scripts/app.js - About 1 day to fix

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

    gulp.task('constants:development', function () {
      var constants = {
        ENV: config.ENV,
        API_HOST: argv['api-host'] || process.env.API_HOST || config.API_HOST,
        GA_TRACKING_ID: config.GA_TRACKING_ID
    Severity: Major
    Found in web-client/gulp/tasks/development/constants.js and 1 other location - About 5 hrs to fix
    web-client/gulp/tasks/production/constants.js on lines 13..26

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

    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

    gulp.task('constants:production', function () {
      var constants = {
        ENV: config.ENV,
        API_HOST: argv['api-host'] || process.env.API_HOST || config.API_HOST,
        GA_TRACKING_ID: config.GA_TRACKING_ID
    Severity: Major
    Found in web-client/gulp/tasks/production/constants.js and 1 other location - About 5 hrs to fix
    web-client/gulp/tasks/development/constants.js on lines 10..23

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

    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

            update: function (params, data, optSuccess, optError) {
    
              var delayedObj = {};
    
              $http.put(baseUrl + 'images/' + params.imageId,
    Severity: Major
    Found in web-client/app/scripts/services/imageService.js and 1 other location - About 4 hrs to fix
    web-client/app/scripts/services/categoryService.js on lines 68..92

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

    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

            update: function (params, data, optSuccess, optError) {
    
              var delayedObj = {};
    
              $http.put(baseUrl + 'categories/' + params.categoryId,
    Severity: Major
    Found in web-client/app/scripts/services/categoryService.js and 1 other location - About 4 hrs to fix
    web-client/app/scripts/services/imageService.js on lines 87..111

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

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

          link: function (scope, element, attrs, ngModel) {
            ngModel.$render = function() {
              if (ngModel.$viewValue) {
                editor.loadJSON(JSON.parse(ngModel.$viewValue));
                editor.render();
    Severity: Major
    Found in web-client/app/scripts/directives/carbonEditor.js - About 4 hrs to fix

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

              save: function (data, optSuccess, optError) {
      
                var delayedObj = {};
      
                $http.post(baseUrl + 'articles',
      Severity: Major
      Found in web-client/app/scripts/services/articleService.js and 1 other location - About 4 hrs to fix
      web-client/app/scripts/services/categoryService.js on lines 42..66

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 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

              save: function (data, optSuccess, optError) {
      
                var delayedObj = {};
      
                $http.post(baseUrl + 'categories',
      Severity: Major
      Found in web-client/app/scripts/services/categoryService.js and 1 other location - About 4 hrs to fix
      web-client/app/scripts/services/articleService.js on lines 44..68

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

          $stateProvider
            .state('app', {
              abstract: true,
              url: '/'
            })
      Severity: Major
      Found in web-client/app/scripts/app.js and 2 other locations - About 4 hrs to fix
      web-client/app/scripts/app.js on lines 53..377
      web-client/app/scripts/app.js on lines 53..397

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

      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

            var createFormData = function (data) {
              var fd = new FormData();
              for (var key in data.category) {
                // Remove special keys for angular resources.
                if (key.trim() === '' || key.indexOf('$') === 0 || key === 'toJSON') {
      Severity: Major
      Found in web-client/app/scripts/services/categoryService.js and 3 other locations - About 4 hrs to fix
      web-client/app/scripts/services/articleService.js on lines 25..35
      web-client/app/scripts/services/imageService.js on lines 23..33
      web-client/app/scripts/services/userService.js on lines 33..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 116.

      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

            var createFormData = function (data) {
              var fd = new FormData();
              for (var key in data.image) {
                // Remove special keys for angular resources.
                if (key.trim() === '' || key.indexOf('$') === 0 || key === 'toJSON') {
      Severity: Major
      Found in web-client/app/scripts/services/imageService.js and 3 other locations - About 4 hrs to fix
      web-client/app/scripts/services/articleService.js on lines 25..35
      web-client/app/scripts/services/categoryService.js on lines 23..33
      web-client/app/scripts/services/userService.js on lines 33..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 116.

      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

            var createFormData = function (data) {
              var fd = new FormData();
              for (var key in data.user) {
                // Remove special keys for angular resources.
                if (key.trim() === '' || key.indexOf('$') === 0 || key === 'toJSON') {
      Severity: Major
      Found in web-client/app/scripts/services/userService.js and 3 other locations - About 4 hrs to fix
      web-client/app/scripts/services/articleService.js on lines 25..35
      web-client/app/scripts/services/categoryService.js on lines 23..33
      web-client/app/scripts/services/imageService.js on lines 23..33

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

      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

            var createFormData = function (data) {
              var fd = new FormData();
              for (var key in data.article) {
                // Remove special keys for angular resources.
                if (key.trim() === '' || key.indexOf('$') === 0 || key === 'toJSON') {
      Severity: Major
      Found in web-client/app/scripts/services/articleService.js and 3 other locations - About 4 hrs to fix
      web-client/app/scripts/services/categoryService.js on lines 23..33
      web-client/app/scripts/services/imageService.js on lines 23..33
      web-client/app/scripts/services/userService.js on lines 33..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 116.

      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 config.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var src               = 'app';
      var development       = 'build/development';
      var production        = 'build/production';
      var dist              = 'dist';
      
      
      Severity: Minor
      Found in web-client/gulp/config.js - About 4 hrs to fix

        Function link has 99 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              link: function (scope, element) {
                var mainCommentBox = element.find('div')[0];
                var textarea = element.find('textarea')[0];
        
                $rootScope.$watch('user', function() {
        Severity: Major
        Found in web-client/app/scripts/directives/anchoredComments.js - About 3 hrs to fix

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

            return gulp.src(config.src)
              .pipe(htmlmin(config.options))
              .pipe(ngTemplates({
                standalone: false,
                filename: config.filename,
          Severity: Major
          Found in web-client/gulp/tasks/development/templates.js and 1 other location - About 3 hrs to fix
          web-client/gulp/tasks/production/templates.js on lines 14..24

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

          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

            return gulp.src(config.src)
              .pipe(htmlmin(config.options))
              .pipe(ngTemplates({
                standalone: false,
                filename: config.filename,
          Severity: Major
          Found in web-client/gulp/tasks/production/templates.js and 1 other location - About 3 hrs to fix
          web-client/gulp/tasks/development/templates.js on lines 17..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 110.

          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

          angular.module('webClientApp')
            .service('Article', ['$resource', '$http', '$q', '$cacheFactory', 'API_HOST',
                function ($resource, $http, $q, $cacheFactory, API_HOST) {
          
                var articlesCache = (
          Severity: Major
          Found in web-client/app/scripts/services/articleService.js and 1 other location - About 3 hrs to fix
          web-client/app/scripts/services/articleService.js on lines 3..148

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

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

                link: function(scope, element) {
                  var page = 1;
                  scope.hasNext = true;
                  scope.inProgress = false;
          
          
          Severity: Major
          Found in web-client/app/scripts/directives/loadMoreData.js - About 3 hrs to fix

            Function link has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  link: function(scope, element) {
                    $rootScope.pushAside = false;
                    scope.menuStatus = 'closed';
                    scope.logout = function () {
                      $analytics.eventTrack('Logout', {
            Severity: Major
            Found in web-client/app/scripts/directives/sideMenu.js - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language