fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Avoid deeply nested control flow statements.
Open

                else if (data[x] instanceof Blob) {
                    f.append(x, data[x], data.name);
                }
                else {
                    f.append(x, data[x]);
Severity: Major
Found in app/js/components/hello.all.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if (input) {
                            // Remove it.
                            if (!(inputs instanceof NodeList)) {
                                inputs = [inputs];
                            }
    Severity: Major
    Found in app/js/components/hello.all.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                if (!loose) loose = next;
      Severity: Major
      Found in app/js/components/marked.js - About 45 mins to fix

        Function _createButton has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                _createButton: function(t, e, i, n, s, a) {
        Severity: Minor
        Found in app/js/components/leaflet.js - About 45 mins to fix

          Function getLinks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              getLinks: function(__promoUri, promo) {
          
                  var hasGoodLinks = false;
                  var links = promo.links.filter(function(link) {
                      var match = _.intersection(link.rel, CONFIG.PROMO_RELS);
          Severity: Minor
          Found in iframely/plugins/links/promo/promo.js - About 45 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 deeply nested control flow statements.
          Open

                                  if (link[attr]) {
                                      hasMedia = true;
                                  }
          Severity: Major
          Found in iframely/plugins/links/utils.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                                if (jsonpCallback) {
            
                                                    // jsonp case.
            
                                                    var body = data.substring(index + 2);
            Severity: Major
            Found in iframely/utils.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if (this.events[name][i]) {
                                          // Emit on the local instance of this
                                          callback.call(this, name, i);
                                      }
              Severity: Major
              Found in app/js/components/hello.all.js - About 45 mins to fix

                Function _animateZoom has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        _animateZoom: function(t, e, i, n, s, a) {
                Severity: Minor
                Found in app/js/components/leaflet.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                                      if (moreDetailedData) {
                                                          tagToAppend = generateArticleParts(moreDetailedData);
                                                      }
                  Severity: Major
                  Found in app/js/directives/home-debugged-link.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        if (el) {
                                            input.value = data[x].value;
                                        }
                                        else if (_this.domInstance(null, data[x])) {
                                            input.value = data[x].innerHTML || data[x].innerText;
                    Severity: Major
                    Found in app/js/components/hello.all.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (!media) {
                                                  media = {};
                                              }
                      Severity: Major
                      Found in iframely/plugins/links/utils.js - About 45 mins to fix

                        Function parseMetaLinks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            parseMetaLinks: function(key, value, whitelistRecord) {
                        
                                if (typeof value !== "object" || typeof value === "string") {
                                    return [];
                                }
                        Severity: Minor
                        Found in iframely/plugins/links/utils.js - About 45 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 deeply nested control flow statements.
                        Open

                                            if ('files' in data[x] && data[x].files.length > 0) {
                                                f.append(x, data[x].files[0]);
                                            }
                        Severity: Major
                        Found in app/js/components/hello.all.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                          if (detailedData.indexOf('playerType=facebook') > -1 && detailedData.indexOf('auto_play=false') === -1) {
                                                              detailedData = detailedData.replace('playerType=facebook', 'playerType=facebook&auto_play=false');
                                                          }
                          Severity: Major
                          Found in app/js/directives/debugged-link.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            else if (el && data[x].name !== x) {
                                                data[x].setAttribute('name', x);
                                                data[x].name = x;
                                            }
                            Severity: Major
                            Found in app/js/components/hello.all.js - About 45 mins to fix

                              Function getData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  getData: function(url, twitter, whitelistRecord) {
                                      
                                      // do not process if there is a whitelist record for this domain as processing will take longer
                                      if (!whitelistRecord.isDefault && whitelistRecord.isAllowed && whitelistRecord.isAllowed('twitter.player')) {return;}
                              
                              
                              Severity: Minor
                              Found in iframely/plugins/links/promo/twitter-youtube.js - About 45 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 deeply nested control flow statements.
                              Open

                                                      if (data[x].length === 1) {
                                                          data[x] = data[x][0];
                                                      }
                              Severity: Major
                              Found in app/js/components/hello.all.js - About 45 mins to fix

                                Function getMeta has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    getMeta: function(meta) {
                                
                                        function getAuthor(value) {
                                            if (typeof value === "string") {
                                                if (/^https?:\/\//i.test(value)) {
                                Severity: Minor
                                Found in iframely/plugins/meta/author.js - About 45 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 deeply nested control flow statements.
                                Open

                                                            if(uiElement.onInit) {
                                                                uiElement.onInit(item);
                                                            }
                                Severity: Major
                                Found in app/js/components/photoswipe-ui-default.js - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language