fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

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

    getLink: function(oembed, options, cb) {


        if (oembed.slide_image_baseurl && oembed.slide_image_baseurl_suffix) {
            var links = [];
Severity: Minor
Found in iframely/plugins/domains/slideshare.net.js - About 1 hr to fix

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

        getLink: function(oembed, options) {
    
            var $container = $('<div>');
            try {
                $container.html(oembed.html);
    Severity: Minor
    Found in iframely/plugins/domains/soundcloud.com.js - About 1 hr to fix

      Function getLinks has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getLinks: function(meta, options) {
      
              if (!/bandcamp/i.test(meta.twitter && meta.twitter.site || meta.generator)) {
                  return;
              }
      Severity: Minor
      Found in iframely/plugins/domains/bandcamp.com.js - About 1 hr to fix

        Function lookupStaticProviders has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function lookupStaticProviders(uri) {
            var providers = require('./providers.json');
        
            var protocolMatch = uri.match(/^(https?:\/\/)/);
            if (!protocolMatch) {
        Severity: Minor
        Found in iframely/lib/plugins/system/oembed/oembedUtils.js - About 1 hr to fix

          Function callback has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                          var callback = function(error, data) {
          
                              if (timeout) {
                                  clearTimeout(timeout);
                                  timeout = null;
          Severity: Minor
          Found in iframely/lib/core.js - About 1 hr to fix

            Function filterLinks has 39 lines of code (exceeds 25 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 1 hr to fix

              Function day has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          day: function day(unixDate) {
              
                            var selectedDate = moment.utc(unixDate);
                            var startOfMonth = moment.utc(selectedDate).startOf('month');
                            var previousViewDate = moment.utc(selectedDate).startOf('year');
              Severity: Minor
              Found in app/js/components/datetimepicker.js - About 1 hr to fix

                Function geometryToLayer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        geometryToLayer: function(t, e, i, n) {
                            var s, a, r, h, l = "Feature" === t.type ? t.geometry : t, u = l.coordinates, c = [];
                            switch (i = i || this.coordsToLatLng,
                            l.type) {
                            case "Point":
                Severity: Minor
                Found in app/js/components/leaflet.js - About 1 hr to fix

                  Function prepareResult has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                      prepareResult: function(error, response, data, cb) {
                  
                                          if (error) {
                                              return cb(error);
                                          }
                  Severity: Minor
                  Found in iframely/plugins/domains/twitter.com/twitter.status.js - About 1 hr to fix

                    Function getMeta has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        getMeta: function(meta, url) {
                    
                            // Player.
                    
                            var has_player = false;
                    Severity: Minor
                    Found in iframely/plugins/meta/media-detector.js - About 1 hr to fix

                      Function link has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              link: function(scope, element) {
                                  /**
                                   * Take the embeded link
                                   *     Pic.twitter.com is already render in images and is not processed again
                                   * Debug the link with injected service
                      Severity: Minor
                      Found in app/js/directives/home-debugged-link.js - About 1 hr to fix

                        Function getPageData has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            $.iframely.getPageData = function(uri, options, cb) {
                        
                                if (typeof options === "function") {
                                    cb = options;
                                    options = {};
                        Severity: Minor
                        Found in iframely/static/js/iframely.js - About 1 hr to fix

                          Function popup has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              hello.utils.popup = function(url, redirectUri, options) {
                          
                                  // Run the standard
                                  var popup = utilPopup.call(this, url, redirectUri, options);
                          
                          
                          Severity: Minor
                          Found in app/js/components/hello.all.js - About 1 hr to fix

                            Function loadPluginTests has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    function loadPluginTests(data, cb) {
                            
                                        if (testOnePlugin) {
                                            PluginTest.find({_id: testOnePlugin}, cb);
                                        } else {
                            Severity: Minor
                            Found in iframely/modules/tests-ui/tester.js - About 1 hr to fix

                              Function getUrls has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      function getUrls(a, cb) {
                              
                                          var tests = plugin.module.tests;
                              
                                          if (!tests) {
                              Severity: Minor
                              Found in iframely/modules/tests-ui/tester.js - About 1 hr to fix

                                Function forEach has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    Array.prototype.forEach = function(fun/*, thisArg*/) {
                                
                                        if (this === void 0 || this === null) {
                                            throw new TypeError();
                                        }
                                Severity: Minor
                                Found in app/js/components/hello.all.js - About 1 hr 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 renderObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                Open

                                $.fn.renderObject = function(o) {
                                
                                    function trimString(v) {
                                        var MAX = 600;
                                        if (typeof v === "string" && v.length > MAX) {
                                Severity: Minor
                                Found in iframely/static/js/debug.js - About 1 hr 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 AppsService has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function AppsService($q, $http, $resource, AppSettings) {
                                
                                    var url = AppSettings.oauthProxyUrl.split('/')[0] + '/' + AppSettings.oauthProxyUrl.split('/')[1] + '/' + AppSettings.oauthProxyUrl.split('/')[2];
                                
                                    return $resource(url + '/:user/:app/:id', {
                                Severity: Minor
                                Found in app/js/services/apps.js - About 1 hr to fix

                                  Function mergeMediaSize has 35 lines of code (exceeds 25 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 1 hr to fix

                                    Function fetchUrlsByPageAndSelector has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    exports.fetchUrlsByPageAndSelector = function(page, selector, options, cb) {
                                    
                                        if (typeof options === "function") {
                                            cb = options;
                                            options = {};
                                    Severity: Minor
                                    Found in iframely/modules/tests-ui/utils.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language