newscoop/JS-Scoopwriter

View on GitHub

Showing 221 of 221 total issues

Function addNewSnippetToArticle has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        $scope.addNewSnippetToArticle = function (snippetData) {
            var fields = {},
                newSnippet;

            $scope.addingNewSnippet = true;
Severity: Minor
Found in app/scripts/controllers/pane-snippets.js - About 1 hr to fix

    Function liveSearchQuery has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            Topic.liveSearchQuery = function (options, isCallback) {
                var isPaginationCall = (options.page > 1),
                    now = dateFactory.makeInstance(),
                    url;
    
    
    Severity: Minor
    Found in app/scripts/services/Topic.js - About 1 hr to fix

      Function liveSearchQuery has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              Author.liveSearchQuery = function (options, isCallback) {
                  var isPaginationCall = (options.page > 1),
                      now = dateFactory.makeInstance(),
                      url;
      
      
      Severity: Minor
      Found in app/scripts/services/Author.js - About 1 hr to fix

        Function setSize has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        scope.setSize = function (size, initPhase) {
                            var width;
        
                            $parent = findParent();
                            if (size.match(/^\d+px$/)) {
        Severity: Minor
        Found in app/scripts/directives/dropped-image.js - About 1 hr to fix

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

            $(window).on('load', function () {
              $('[data-ride="carousel"]').each(function () {
                var $carousel = $(this)
                $carousel.carousel($carousel.data())
              })
          Severity: Major
          Found in app/scripts/bootstrap.min.js and 1 other location - About 1 hr to fix
          app/scripts/bootstrap.min.js on lines 1732..1737

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

          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

            $(window).on('load', function () {
              $('[data-spy="scroll"]').each(function () {
                var $spy = $(this)
                $spy.scrollspy($spy.data())
              })
          Severity: Major
          Found in app/scripts/bootstrap.min.js and 1 other location - About 1 hr to fix
          app/scripts/bootstrap.min.js on lines 486..491

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

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

                  function imageCommentsToDivs(text) {
                      // the extra backslash (\) is because of Javascript being picky
                      var imageReg  = '<!';         // exact match
                      imageReg     += '\\*\\*';    // exact match on **
                      imageReg     += '[\\s]*';    // optional whitespace
          Severity: Minor
          Found in app/scripts/services/Article.js - About 1 hr to fix

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

                                    $http(configToRepeat)
                                    .then(function (newResponse) {
                                        delete newResponse.config.IS_RETRY;
                                        retryDeferred.resolve(newResponse);
                                    })
            Severity: Major
            Found in app/scripts/services/auth-interceptor.js and 1 other location - About 1 hr to fix
            app/scripts/services/auth-interceptor.js on lines 100..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 68.

            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

                                        $http(configToRepeat)
                                        .then(function (newResponse) {
                                            delete newResponse.config.IS_RETRY;
                                            retryDeferred.resolve(newResponse);
                                        })
            Severity: Major
            Found in app/scripts/services/auth-interceptor.js and 1 other location - About 1 hr to fix
            app/scripts/services/auth-interceptor.js on lines 87..94

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

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

              Tooltip.prototype.show = function () {
                var e = $.Event('show.bs.'+ this.type)
            
                if (this.hasContent() && this.enabled) {
                  this.$element.trigger(e)
            Severity: Minor
            Found in app/scripts/bootstrap.min.js - About 1 hr to fix

              Function serializeAlohaBlocks has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function serializeAlohaBlocks(text) {
                          var content,
                              allMatches,
                              sep;
              
              
              Severity: Minor
              Found in app/scripts/services/Article.js - About 1 hr to fix

                Function addToArticle has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        Author.prototype.addToArticle = function (number, language, roleId) {
                            var author = this,
                                deferred = $q.defer(),
                                linkHeader,
                                url;
                Severity: Minor
                Found in app/scripts/services/Author.js - About 1 hr to fix

                  Function setAlignment has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                  scope.setAlignment = function (position) {
                                      var cssFloat,
                                          cssMargin;
                  
                                      switch (position) {
                  Severity: Minor
                  Found in app/scripts/directives/dropped-image.js - About 1 hr to fix

                    Function removeFromArticle has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            Author.prototype.removeFromArticle = function (
                                number, language, roleId
                            ) {
                                var author = this,
                                    deferred = $q.defer(),
                    Severity: Minor
                    Found in app/scripts/services/Author.js - About 1 hr to fix

                      Function updateRole has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              Author.prototype.updateRole = function (params) {
                                  var headersParam,
                                      linkHeader,
                                      promise,
                                      url;
                      Severity: Minor
                      Found in app/scripts/services/Author.js - About 1 hr to fix

                        Function circularBufferFactory has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function circularBufferFactory() {
                                /**
                                    * Creates a new circular buffer instance.
                                    *
                                    * @method create
                        Severity: Minor
                        Found in app/scripts/services/circular-buffer-factory.js - About 1 hr 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 create has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                Snippet.create = function (name, templateId, fields) {
                                    var deferredPost = $q.defer(),
                                        requestData;
                        
                                    requestData = {
                        Severity: Minor
                        Found in app/scripts/services/Snippet.js - About 1 hr to fix

                          Function circularBufferFactory has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function circularBufferFactory() {
                                  /**
                                      * Creates a new circular buffer instance.
                                      *
                                      * @method create
                          Severity: Minor
                          Found in app/scripts/services/circular-buffer-factory.js - About 1 hr to fix

                            Function getAllByPage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    self.getAllByPage = function (page) {
                                        var deferredGet = $q.defer(),
                                            url;
                            
                                        var totalPerPage = itemsPerPage * latestPage;
                            Severity: Minor
                            Found in app/scripts/services/editorial-comments.js - About 1 hr to fix

                              Function query has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      NcImage.query = function (page, itemsPerPage, searchFilter) {
                                          var deferredGet = $q.defer(),
                                              requestOptions,
                                              results = [],
                                              url;
                              Severity: Minor
                              Found in app/scripts/services/NcImage.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language