newscoop/JS-Scoopwriter

View on GitHub

Showing 98 of 221 total issues

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

        Slideshow.prototype.removeFromArticle = function(number, language) {
            var slideshow = this,
                deferred = $q.defer(),
                linkHeader;

Severity: Minor
Found in app/scripts/services/Slideshow.js - About 1 hr to fix

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

                link: function postLink(scope, $element, attrs) {
                    var baseOffsetY = 125,  // base offset (without from height)
                        initialOffsetY,    // initial offset at pane load
                        firstAdjustment = true,
                        $formBox,
    Severity: Minor
    Found in app/scripts/directives/auto-list-offset.js - About 1 hr to fix

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

              self.decorate = function (image) {
                  /**
                  * @class image
                  */
      
      
      Severity: Minor
      Found in app/scripts/services/images.js - About 1 hr to fix

        Function activate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Tab.prototype.activate = function (element, container, callback) {
            var $active    = container.find('> .active')
            var transition = callback
              && $.support.transition
              && $active.hasClass('fade')
        Severity: Minor
        Found in app/scripts/bootstrap.min.js - About 1 hr to fix

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

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

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

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

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

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

                Function addAuthorToArticle has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        $scope.addAuthorToArticle = function () {
                            // NOTE: An author can be added multiple times (with different
                            // roles), therefore we need multiple deep copies of the object to
                            // distinguish between them in $scope.authors ng-repeat.
                            var author = angular.copy($scope.newAuthor),
                Severity: Minor
                Found in app/scripts/controllers/pane-authors.js - About 1 hr to fix

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

                          NcImage.prototype.removeFromArticle = function(articleId, language) {
                              var self = this,
                                  deferred = $q.defer(),
                                  linkHeader;
                  
                  
                  Severity: Minor
                  Found in app/scripts/services/NcImage.js - About 1 hr to fix

                    Function updateDescription has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            NcImage.prototype.updateDescription = function (newDesc) {
                                var deferredPatch = $q.defer(),
                                    params,
                                    self = this,
                                    url;
                    Severity: Minor
                    Found in app/scripts/services/NcImage.js - About 1 hr to fix

                      Function searchArticles has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              Article.prototype.searchArticles = function (query, filters) {
                                  var allArticles = [],
                                      deferredGet = $q.defer(),
                                      params = {},
                                      url;
                      Severity: Minor
                      Found in app/scripts/services/Article.js - About 1 hr to fix

                        Function changeCommentingSetting has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                Article.prototype.changeCommentingSetting = function (newValue) {
                                    var deferred = $q.defer(),
                                        postData = {
                                            article: {}
                                        },
                        Severity: Minor
                        Found in app/scripts/services/Article.js - About 1 hr to fix

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

                                  self.query = function (filter) {
                                      self.searchFilter = filter;
                          
                                      // not so pretty, but it's the fastest way to clear an Array
                                      while(self.displayed.length > 0) {
                          Severity: Minor
                          Found in app/scripts/services/images.js - About 1 hr to fix

                            Function create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    Topic.create = function (title, parentId, language) {
                                        var deferredPost = $q.defer(),
                                            requestData = {topic: {}},
                                            url;
                            
                            
                            Severity: Minor
                            Found in app/scripts/services/Topic.js - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                    if (autoPlace) {
                                      var $parent = this.$element.parent()
                              
                                      var orgPlacement = placement
                                      var docScroll    = document.documentElement.scrollTop || document.body.scrollTop
                              Severity: Major
                              Found in app/scripts/bootstrap.min.js - About 40 mins to fix

                                Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                Open

                                module.exports = function(config) {
                                  config.set({
                                    // base path, that will be used to resolve files and exclude
                                    basePath: '',
                                
                                
                                Severity: Minor
                                Found in karma.conf.js - About 35 mins 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

                                Avoid too many return statements within this function.
                                Open

                                    return this
                                Severity: Major
                                Found in app/scripts/bootstrap.min.js - About 30 mins to fix

                                  Function Dragdata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      function Dragdata($log) {
                                          this.converters = {
                                              'test': function ($e) {
                                                  return {};
                                              },
                                  Severity: Minor
                                  Found in app/scripts/services/dragData.js - About 25 mins 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language