fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

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

    function setResponseToCache(code, content_type, req, res, body, ttl) {
Severity: Minor
Found in iframely/utils.js - About 45 mins to fix

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

        getMeta: function(meta, url) {
    
            var date = meta.date || meta.pubdate || meta.lastmod || (meta.article && meta.article.published_time) || meta['last-modified'] || meta.timestamp;
    
            // Can be multiple dates.
    Severity: Minor
    Found in iframely/plugins/meta/date.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

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

        getLink: function(urlMatch, options) {
    
            var content = {
                'album': 'album',
                'app': 'software',
    Severity: Minor
    Found in iframely/plugins/domains/itunes.apple.com.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

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

        getLink: function(htmlparser, cb) {
    
            var end = false;
    
            var parser =  {
    Severity: Minor
    Found in iframely/plugins/domains/v.pptv.com.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 (items instanceof Array) {
                            if (items.length > 0) {
                                return items[0];
                            }
                        }
    Severity: Major
    Found in iframely/static/js/iframely.js - About 45 mins to fix

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

          getData: function(urlMatch, request, options, cb) {
      
              var consumer_key = options.getProviderOptions('tumblr.consumer_key');
      
              if (!consumer_key) {
      Severity: Minor
      Found in iframely/plugins/domains/tumblr.com/tumblr.api.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

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

          getLinks: function(urlMatch, oembed, twitter, options) {
      
              var links = [];
      
              if (twitter.image && twitter.image.indexOf && twitter.image.indexOf(urlMatch[1]) > -1) {
      Severity: Minor
      Found in iframely/plugins/domains/imgur.com.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 (cb(item)) {
                                      result.push(item);
                                  }
      Severity: Major
      Found in iframely/lib/html-utils.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                    if (cb(item)) {
                                        result.push(item);
                                    }
        Severity: Major
        Found in iframely/static/js/iframely.js - About 45 mins to fix

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

          function showEmbeds($embeds, data, filterByRel) {
          
              $embeds.html('');
          
              var plugins = [];
          Severity: Minor
          Found in iframely/static/js/debug.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

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

              getLink: function(oembed, meta) {
          
                  var site = (meta.og && meta.og.site_name) || (meta.twitter && meta.twitter.site) || oembed.provider_name;
          
                  if (!site || !/behance/i.test(site)) {
          Severity: Minor
          Found in iframely/plugins/domains/behance.net.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

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

              function runPostPlugins(link, dataRecord, usedMethods, context, pluginsContexts, asyncMethodCb) {
          Severity: Minor
          Found in iframely/lib/core.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                            if (sizes) {
                                property.sizes = sizes;
                            }
            Severity: Major
            Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 45 mins to fix

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

              function moveMediaAttrs(link) {
              
                  if (!link.media) {
                      var m = {};
                      // TODO: make for()
              Severity: Minor
              Found in iframely/lib/plugins/validators/media.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 (oembedLink.href.indexOf(SHOPIFY_OEMBED_URLS[i]) > -1) {
                                      isShopify = true;
                                  }
              Severity: Major
              Found in iframely/lib/utils.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if (rel !== options.exclusiveRel) {
                                            // Remove all rels except exclusiveRel.
                                            delete record[rel];
                                        }
                Severity: Major
                Found in iframely/lib/whitelist.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (match) {
                                              registerDomainPlugin(plugin, null);
                                          }
                  Severity: Major
                  Found in iframely/lib/core.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if (!recordProtocol) {
                                                recordProtocol = record[protocolId] = {};
                                            } else {
                                                recordProtocol = _.extend({}, recordProtocol);
                                            }
                    Severity: Major
                    Found in iframely/lib/whitelist.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (match) {
                                                  // Store match for plugin.
                                                  registerDomainPlugin(plugin, match);
                                                  pluginsUrlMatches[plugin.id] = match;
                                                  continue;
                      Severity: Major
                      Found in iframely/lib/core.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                        if (title) {
                                            property.title = title;
                                        }
                        Severity: Major
                        Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language