fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Function findPluginMethods has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function findPluginMethods(pluginId, loadedParams, pluginsUrlMatches, usedMethods, usedParams, methods, scannedPluginsIds, usedDomains, mandatoryParams) {

       /*
        * Params:
        *
Severity: Major
Found in iframely/lib/core.js - About 2 hrs to fix

    Function marked has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function marked(src, opt, callback) {
      if (callback || typeof opt === 'function') {
        if (!callback) {
          callback = opt;
          opt = null;
    Severity: Major
    Found in app/js/components/marked.js - About 2 hrs to fix

      Function findBestFittedLink has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.iframely.findBestFittedLink = function(targetWidth, targetHeight, links) {
      
              var sizedLinks = $.iframely.filterLinks(links, function(link) {
                  var media = link.media;
                  return media && media.width && media.height;
      Severity: Major
      Found in iframely/static/js/iframely.js - About 2 hrs to fix

        Function getPath has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function getPath(url) {
        
                // Format the string if it needs it
                url = url.replace(/\@\{([a-z\_\-]+)(\|.*?)?\}/gi, function(m, key, defaults) {
                    var val = defaults ? defaults.replace(/^\|/, '') : '';
        Severity: Major
        Found in app/js/components/hello.all.js - About 2 hrs to fix

          Function getWhitelistLogData has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getWhitelistLogData(meta, oembed) {
          
              var r = {};
          
              if (meta) {
          Severity: Major
          Found in iframely/lib/utils.js - About 2 hrs to fix

            Function MapPopUpTemplateService has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            function MapPopUpTemplateService($filter, SourceTypeService, JsonFieldAccessorService, RichTextService) {
            
              var service = {};
            
              service.genImportedStatus = function(status, profile) {
            Severity: Minor
            Found in app/js/services/MapPopUpTemplate.js - About 2 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 getData has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

                getData: function(url, urlMatch, options, cb) {
            
                    if (!options.getProviderOptions('google.maps_key')) {
                        return cb (new Error ("No google.maps_key configured"));
                    }
            Severity: Minor
            Found in iframely/plugins/domains/google.com/google.maps.js - About 2 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 getData has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getData: function(urlMatch, request, options, cb) {
            
                    var api_key = options.getProviderOptions('youtube.api_key');
            
                    if (!api_key) {
            Severity: Major
            Found in iframely/plugins/domains/youtube.com/youtube.video.js - About 2 hrs to fix

              File analyze.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              'use strict';
              /* global angular, L, $ */
              /* jshint unused:false */
              
              var controllersModule = require('./_index');
              Severity: Minor
              Found in app/js/controllers/analyze.js - About 2 hrs to fix

                Function Event has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    Event: function() {
                
                        var separator = /[\s\,]+/;
                
                        // If this doesn't support getPrototype then we can't get prototype.events of the parent
                Severity: Major
                Found in app/js/components/hello.all.js - About 2 hrs to fix

                  Function submit has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              $scope.submit = function() {
                                  if (!$scope.inputs.url) {
                                      $scope.messages.error = 'Please provide a valid source url';
                                      return;
                                  }
                  Severity: Major
                  Found in app/js/directives/add-connection-modal.js - About 2 hrs to fix

                    Function asyncMethodCb has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                asyncMethodCb = function(error, result) {
                    
                                    if (aborted) {
                                        return;
                                    }
                    Severity: Major
                    Found in iframely/lib/core.js - About 2 hrs to fix

                      Function self has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          (function self() {
                      
                              var CURRENT_TIME = ((new Date()).getTime() / 1e3);
                              var emit = function(eventName) {
                                  hello.emit('auth.' + eventName, {
                      Severity: Major
                      Found in app/js/components/hello.all.js - About 2 hrs to fix

                        Function parseRepeatAttr has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          ctrl.parseRepeatAttr = function(repeatAttr, groupByExp, groupFilterExp) {
                            function updateGroups(items) {
                              var groupFn = $scope.$eval(groupByExp);
                              ctrl.groups = [];
                              angular.forEach(items, function(item) {
                        Severity: Major
                        Found in app/js/components/select.js - About 2 hrs to fix

                          Function addPointsToMap has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function addPointsToMap(map, tweets, markerType, cbOnMapAction) {
                                  var addLayer;
                                  if (markerType === "simpleCircle") {
                                      addLayer = L.geoJson([tweets], {
                                          style: function (feature) { return feature.properties && feature.properties.style; },
                          Severity: Major
                          Found in app/js/services/mapcreation.js - About 2 hrs to fix

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

                                getLink: function(oembed, whitelistRecord) {
                            
                            
                                    if (!(oembed.type === "rich" && whitelistRecord.isAllowed && whitelistRecord.isAllowed('oembed.rich'))) {
                                        return;
                            Severity: Major
                            Found in iframely/plugins/links/oembed-rich.js - About 2 hrs to fix

                              Function findWhitelistRecordFor has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  whitelist.findWhitelistRecordFor = function(uri, options) {
                              
                                      if (!whitelistObject) {
                                          return null;
                                      }
                              Severity: Major
                              Found in iframely/lib/whitelist.js - About 2 hrs to fix

                                Function getContentType has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                exports.getContentType = function(uriForCache, uriOriginal, options, cb) {
                                
                                    cache.withCache("content-type:" + uriForCache, function(cb) {
                                
                                        var timeout, requestInstance, totalTime;
                                Severity: Minor
                                Found in iframely/lib/utils.js - About 2 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 chart has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                      return function chart (type) {
                                        return {
                                          restrict: 'CA',
                                          scope: {
                                            data: '=',
                                Severity: Major
                                Found in app/js/components/angular-chart.js - About 2 hrs to fix

                                  Function uploadDrive has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      function uploadDrive(p, callback) {
                                  
                                          var data = {};
                                  
                                          // Test for DOM element
                                  Severity: Major
                                  Found in app/js/components/hello.all.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language