newscoop/JS-Scoopwriter

View on GitHub

Showing 221 of 221 total issues

Function directiveConstructor has 175 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function directiveConstructor($rootScope, $modal, $window, toaster) {
        var template = [
            '<div>',
            '  <button class="btn btn-default btn-sm" title="Add Link">',
            '      <i class="fa fa-link"></i>',
Severity: Major
Found in app/scripts/directives/sf-aloha-format-link.js - About 7 hrs to fix

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

                    if (scope.buttonCommand === 'redo') {
                        checkAvailable = function () {
                            if (typeof Aloha.canRedo === 'function') {
                                return Aloha.canRedo();
                            } else {
    Severity: Major
    Found in app/scripts/directives/sf-aloha-command-button.js and 1 other location - About 6 hrs to fix
    app/scripts/directives/sf-aloha-command-button.js on lines 28..52

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

    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 (scope.buttonCommand === 'undo') {
                        checkAvailable = function () {
                            if (typeof Aloha.canUndo === 'function') {
                                return Aloha.canUndo();
                            } else {
    Severity: Major
    Found in app/scripts/directives/sf-aloha-command-button.js and 1 other location - About 6 hrs to fix
    app/scripts/directives/sf-aloha-command-button.js on lines 54..78

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

    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.add = function (par) {
                $scope.isSending = true;
                comments.add(par).then(function () {
                    $scope.adding = false;
                    // collapse the form
    Severity: Major
    Found in app/scripts/controllers/comments.js and 1 other location - About 6 hrs to fix
    app/scripts/controllers/editorial-comments.js on lines 83..107

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

    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

        self.add = function (parameters) {
            self.isSending = true;
            editorialComments.add(parameters).then(function () {
                self.adding = false;
                // collapse the form
    Severity: Major
    Found in app/scripts/controllers/editorial-comments.js and 1 other location - About 6 hrs to fix
    app/scripts/controllers/comments.js on lines 131..156

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

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

        function initStubbedBackend() {
            ng.module('authoringEnvironmentApp')
                .config(['$provide', function($provide) {
                    $provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
                }])
    Severity: Major
    Found in app/scripts/httpBackendStub.js - About 6 hrs to fix

      Function postLink has 156 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function postLink(scope, element, attrs) {
                  var children,
                      cmdLinkEnabled,
                      cmdLinkSupported,
                      cmdUnlinkEnabled,
      Severity: Major
      Found in app/scripts/directives/sf-aloha-format-link.js - About 6 hrs to fix

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

            {
                name: 'scrollTop',
                handler: function (n) {
                    if (!$(n).data('prev-scrollTop')) {
                        $(n).data('prev-scrollTop', $(n)[0].scrollTop());
        Severity: Major
        Found in app/scripts/mutate.events.js and 1 other location - About 6 hrs to fix
        app/scripts/mutate.events.js on lines 149..162

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

        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

            {
                name: 'scrollLeft',
                handler: function (n) {
                    if(!$(n).data('prev-scrollLeft')) {
                        $(n).data('prev-scrollLeft', $(n)[0].scrollLeft());
        Severity: Major
        Found in app/scripts/mutate.events.js and 1 other location - About 6 hrs to fix
        app/scripts/mutate.events.js on lines 135..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 158.

        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

            {
                name: 'scrollWidth',
                handler: function (n) {
                    if (!$(n).data('prev-scrollWidth')) {
                        $(n).data('prev-scrollWidth', $(n)[0].scrollWidth);
        Severity: Major
        Found in app/scripts/mutate.events.js and 1 other location - About 5 hrs to fix
        app/scripts/mutate.events.js on lines 107..120

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

        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

            {
                name: 'bottom',
                handler: function (n) {
                    if (!$(n).data('mutate-bottom')) {
                        $(n).data('mutate-bottom', $(n).css('bottom'));
        Severity: Major
        Found in app/scripts/mutate.events.js and 3 other locations - About 5 hrs to fix
        app/scripts/mutate.events.js on lines 35..48
        app/scripts/mutate.events.js on lines 63..76
        app/scripts/mutate.events.js on lines 77..90

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

        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

            {
                name: 'scrollHeight',
                handler: function (n) {
                    if (!$(n).data('prev-scrollHeight')) {
                        $(n).data('prev-scrollHeight', $(n)[0].scrollHeight);
        Severity: Major
        Found in app/scripts/mutate.events.js and 1 other location - About 5 hrs to fix
        app/scripts/mutate.events.js on lines 121..134

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

        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

            {
                name: 'right',
                handler: function (n) {
                    if (!$(n).data('mutate-right')) {
                        $(n).data('mutate-right', $(n).css('right'));
        Severity: Major
        Found in app/scripts/mutate.events.js and 3 other locations - About 5 hrs to fix
        app/scripts/mutate.events.js on lines 35..48
        app/scripts/mutate.events.js on lines 49..62
        app/scripts/mutate.events.js on lines 77..90

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

        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

            {
                name: 'top',
                handler: function (n) {
                    if (!$(n).data('mutate-top')) {
                        $(n).data('mutate-top', $(n).css('top'));
        Severity: Major
        Found in app/scripts/mutate.events.js and 3 other locations - About 5 hrs to fix
        app/scripts/mutate.events.js on lines 49..62
        app/scripts/mutate.events.js on lines 63..76
        app/scripts/mutate.events.js on lines 77..90

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

        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

            {
                name: 'left',
                handler: function (n) {
                    if(!$(n).data('mutate-left')) {
                        $(n).data('mutate-left', $(n).css('left'));
        Severity: Major
        Found in app/scripts/mutate.events.js and 3 other locations - About 5 hrs to fix
        app/scripts/mutate.events.js on lines 35..48
        app/scripts/mutate.events.js on lines 49..62
        app/scripts/mutate.events.js on lines 63..76

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

        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 images has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            function images(
                pageTracker, $log, articleService,
                getFileReader, formDataFactory, imageFactory, NcImage,
                $rootScope, $q
            ) {
        Severity: Minor
        Found in app/scripts/services/images.js - About 5 hrs to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function linkFunction has 121 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function linkFunction(scope, element, attrs) {
                var newIdx = -1,  // dragged element's (potential) new position
                    $emptySlot = null,  // DOM marker for the new position
                    $rootElement,  // root DOM element the directive is applied to
                    draggedElementIdx = -1;  // index of the element being dragged
        Severity: Major
        Found in app/scripts/directives/drag-sort.js - About 4 hrs to fix

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

            $.fn.tooltip = function (option) {
              return this.each(function () {
                var $this   = $(this)
                var data    = $this.data('bs.tooltip')
                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 1558..1567
          app/scripts/bootstrap.min.js on lines 1706..1715
          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

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

            $.fn.popover = function (option) {
              return this.each(function () {
                var $this   = $(this)
                var data    = $this.data('bs.popover')
                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 1706..1715
          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

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

            $.fn.affix = function (option) {
              return this.each(function () {
                var $this   = $(this)
                var data    = $this.data('bs.affix')
                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 1706..1715

          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

          Severity
          Category
          Status
          Source
          Language