newscoop/JS-Scoopwriter

View on GitHub

Showing 221 of 221 total issues

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

  $.fn.scrollspy = function (option) {
    return this.each(function () {
      var $this   = $(this)
      var data    = $this.data('bs.scrollspy')
      var options = typeof option == 'object' && option
Severity: Major
Found in app/scripts/bootstrap.min.js and 3 other locations - About 4 hrs to fix
app/scripts/bootstrap.min.js on lines 1440..1449
app/scripts/bootstrap.min.js on lines 1558..1567
app/scripts/bootstrap.min.js on lines 1962..1971

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

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

        function decorate(comment) {
            /**
            * @class comment
            */

Severity: Major
Found in app/scripts/services/comments.js - About 4 hrs to fix

    Function decorate has 113 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function decorate(comment) {
                /**
                * @class comment
                */
    
    
    Severity: Major
    Found in app/scripts/services/editorial-comments.js - About 4 hrs to fix

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

        $.fn.dropdown = function (option) {
          return this.each(function () {
            var $this = $(this)
            var data  = $this.data('dropdown')
      
      
      Severity: Major
      Found in app/scripts/bootstrap.min.js and 1 other location - About 3 hrs to fix
      app/scripts/bootstrap.min.js on lines 138..146

      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

        $.fn.alert = function (option) {
          return this.each(function () {
            var $this = $(this)
            var data  = $this.data('bs.alert')
      
      
      Severity: Major
      Found in app/scripts/bootstrap.min.js and 1 other location - About 3 hrs to fix
      app/scripts/bootstrap.min.js on lines 797..805

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

      'use strict';
      
      /**
      * AngularJS Service for managing article comments.
      *
      Severity: Minor
      Found in app/scripts/services/comments.js - About 3 hrs to fix

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

            self.sendReply = function (comment) {
                comment.sendReply().then(function () {
                    toaster.add({
                        type: 'sf-info',
                        message: TranslationService.trans(
        Severity: Major
        Found in app/scripts/controllers/editorial-comments.js and 3 other locations - About 3 hrs to fix
        app/scripts/controllers/comments.js on lines 185..201
        app/scripts/controllers/comments.js on lines 209..225
        app/scripts/controllers/editorial-comments.js on lines 139..155

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

                $scope.saveComment = function (comment) {
                    comment.save().then(function () {
                        toaster.add({
                            type: 'sf-info',
                            message: TranslationService.trans(
        Severity: Major
        Found in app/scripts/controllers/comments.js and 3 other locations - About 3 hrs to fix
        app/scripts/controllers/comments.js on lines 209..225
        app/scripts/controllers/editorial-comments.js on lines 115..131
        app/scripts/controllers/editorial-comments.js on lines 139..155

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

                $scope.sendReply = function (comment) {
                    comment.sendReply().then(function () {
                        toaster.add({
                            type: 'sf-info',
                            message: TranslationService.trans(
        Severity: Major
        Found in app/scripts/controllers/comments.js and 3 other locations - About 3 hrs to fix
        app/scripts/controllers/comments.js on lines 185..201
        app/scripts/controllers/editorial-comments.js on lines 115..131
        app/scripts/controllers/editorial-comments.js on lines 139..155

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

            self.toggleResolved = function (comment) {
                comment.toggleResolved().then(function () {
                    toaster.add({
                        type: 'sf-info',
                        message: TranslationService.trans(
        Severity: Major
        Found in app/scripts/controllers/editorial-comments.js and 3 other locations - About 3 hrs to fix
        app/scripts/controllers/comments.js on lines 185..201
        app/scripts/controllers/comments.js on lines 209..225
        app/scripts/controllers/editorial-comments.js on lines 115..131

        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

        Function exports has 90 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: Major
        Found in karma.conf.js - About 3 hrs to fix

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

                      $http({
                          url: Routing.generate(
                              'newscoop_gimme_articles_linkarticle',
                              {number: self.articleId, language: self.language},
                              true
          Severity: Major
          Found in app/scripts/services/Article.js and 2 other locations - About 3 hrs to fix
          app/scripts/services/Article.js on lines 511..525
          app/scripts/services/Article.js on lines 552..566

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

          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

                      $http({
                          url: Routing.generate(
                              'newscoop_gimme_articles_unlinkarticle',
                              {number: self.articleId, language: self.language},
                              true
          Severity: Major
          Found in app/scripts/services/Article.js and 2 other locations - About 3 hrs to fix
          app/scripts/services/Article.js on lines 511..525
          app/scripts/services/Article.js on lines 800..814

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

          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

                      $http({
                          url: Routing.generate(
                              'newscoop_gimme_articles_linkarticle',
                              {number: self.articleId, language: self.language},
                              true
          Severity: Major
          Found in app/scripts/services/Article.js and 2 other locations - About 3 hrs to fix
          app/scripts/services/Article.js on lines 552..566
          app/scripts/services/Article.js on lines 800..814

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

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

          'use strict';
          
          /**
          * AngularJS Service for managing article comments.
          *
          Severity: Minor
          Found in app/scripts/services/editorial-comments.js - About 3 hrs to fix

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

                        if (!isCallback) {
                            // regular select2's onType event, input changed
            
                            if (!isPaginationCall) {
                                lastTermChange = now;
            Severity: Major
            Found in app/scripts/services/Author.js and 1 other location - About 3 hrs to fix
            app/scripts/services/Topic.js on lines 144..165

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

            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

                        if (!isCallback) {
                            // regular select2's onType event, input changed
            
                            if (!isPaginationCall) {
                                lastTermChange = now;
            Severity: Major
            Found in app/scripts/services/Topic.js and 1 other location - About 3 hrs to fix
            app/scripts/services/Author.js on lines 152..173

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

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

                        link: function postLink(scope, element, attrs) {
                            var counter,
                                $element = $(element);
            
                            // when dragging over a child element, a dragleave event is
            Severity: Major
            Found in app/scripts/directives/sf-droppable.js - About 3 hrs to fix

              File comments.js has 292 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              'use strict';
              
              /**
              * AngularJS controller for managing article comments (as a group,
              * not individual comments).
              Severity: Minor
              Found in app/scripts/controllers/comments.js - About 3 hrs to fix

                Function setEventHandlers has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function setEventHandlers($element) {
                            $element.attr('draggable', true);
                
                            $element.on('dragstart', function (e) {
                                var dragData;
                Severity: Major
                Found in app/scripts/directives/drag-sort.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language