fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Function testAll has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function testAll(cb) {

    // Get all plugins with tests.
    var pluginsList = _.values(plugins).filter(function(plugin) {

Severity: Major
Found in iframely/modules/tests-ui/tester.js - About 5 hrs to fix

    Function cacheMiddleware has 132 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        exports.cacheMiddleware = function(req, res, next) {
    
            async.waterfall([
    
                function(cb) {
    Severity: Major
    Found in iframely/utils.js - About 5 hrs to fix

      Function mergeMediaSize has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          mergeMediaSize: function(links) {
      
              if (links && links instanceof Array) {
      
                  // Search first link with media.
      Severity: Minor
      Found in iframely/plugins/links/utils.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 d has 130 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function d(e, r, i, n) {
              function o(e, t) {
                  for (var r = 0; r < t.c.length; r++)
                      if (a(t.c[r].bR, e))
                          return t.c[r]
      Severity: Major
      Found in app/js/components/highlight.js - About 5 hrs to fix

        Function parse has 129 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          GeoJSON.parse = function(objects, params, callback) {
        
            var  geomAttrs = [];
        
            // Adds default settings to user-specified params
        Severity: Major
        Found in app/js/components/geojson.js - About 5 hrs to fix

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

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

          File pluginLoader.js has 364 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          (function(pluginLoader) {
          
              var fs = require('fs'),
                  path = require('path'),
                  _ = require('underscore'),
          Severity: Minor
          Found in iframely/lib/loader/pluginLoader.js - About 4 hrs to fix

            Function args has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            Open

                args: function(o, args) {
            
                    var p = {};
                    var i = 0;
                    var t = null;
            Severity: Minor
            Found in app/js/components/hello.all.js - About 4 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 getWhitelistLogData has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
            Open

            function getWhitelistLogData(meta, oembed) {
            
                var r = {};
            
                if (meta) {
            Severity: Minor
            Found in iframely/lib/utils.js - About 4 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 showEmbeds has 113 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function showEmbeds($embeds, data, filterByRel) {
            
                $embeds.html('');
            
                var plugins = [];
            Severity: Major
            Found in iframely/static/js/debug.js - About 4 hrs to fix

              Function loadPluginFile has 113 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function loadPluginFile(pluginPath) {
              
                      var bits = pluginPath.split(path.sep);
              
                      if (pluginPath.match(/\.js$/i)) {
              Severity: Major
              Found in iframely/lib/loader/pluginLoader.js - About 4 hrs to fix

                Function output has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                InlineLexer.prototype.output = function(src) {
                  var out = ''
                    , link
                    , text
                    , href
                Severity: Major
                Found in app/js/components/marked.js - About 4 hrs to fix

                  Function getPluginsSet has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function getPluginsSet(uri, options, usedParams) {
                  
                          var initialPlugins = [],
                              usedDomains,
                              isDomainPluginsMode = false,
                  Severity: Major
                  Found in iframely/lib/core.js - About 4 hrs to fix

                    Function getData has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        getData: function(urlMatch, request, options, cb) {
                            var id = urlMatch[1];
                    
                            var c = options.getProviderOptions("twitter") || options.getProviderOptions("twitter.status");
                    
                    
                    Severity: Major
                    Found in iframely/plugins/domains/twitter.com/twitter.status.js - About 4 hrs to fix

                      Function processUrl has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function processUrl() {
                          var uri = $.trim($('.s-uri').focus().val());
                      
                          if (!uri) {
                              return;
                      Severity: Major
                      Found in iframely/static/js/debug.js - About 4 hrs to fix

                        Function filterLinks has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                        Open

                        exports.filterLinks = function(data, options) {
                        
                            var links = data.links;
                        
                            for(var i = 0; i < links.length;) {
                        Severity: Minor
                        Found in iframely/lib/utils.js - About 4 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

                        File angular-idle.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*** Directives and services for responding to idle users in AngularJS
                        * @author Mike Grabski <me@mikegrabski.com>
                        * @version v1.1.0
                        * @link https://github.com/HackedByChinese/ng-idle.git
                        * @license MIT
                        Severity: Minor
                        Found in app/js/components/angular-idle.js - About 4 hrs to fix

                          File debug.js has 339 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          function linkify(text) {
                              if (typeof text === "string") {
                                  return text.replace(/((https?:)?\/\/[^"\s]+)/gi, '<a target="_blank" href="$1">$1</a>');
                              } else {
                                  return text;
                          Severity: Minor
                          Found in iframely/static/js/debug.js - About 4 hrs to fix

                            Function getLink has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                getLink: function(url) {
                                    // Currently the notes and data layers aren't used in embeds and static maps,
                                    // but who knows, maybe that'll change?
                                    var layers, layer, zoom, lat, lon, bbox, marker, notes = false, data = false;
                            
                            
                            Severity: Major
                            Found in iframely/plugins/domains/openstreetmap.org.js - About 4 hrs to fix

                              Function request has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  request: function(p, callback) {
                              
                                      var _this = this;
                                      var error = _this.error;
                              
                              
                              Severity: Minor
                              Found in app/js/components/hello.all.js - About 4 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

                              Severity
                              Category
                              Status
                              Source
                              Language