fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Function wrapContainer has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function wrapContainer($element, data) {

        var media = data.media;

        if (media && media.height && media.width && !media["aspect-ratio"]) {
Severity: Minor
Found in iframely/static/js/iframely.js - About 1 hr to fix

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

        getData: function(url, options, cb) {
    
            var request;
    
            getUrl(url, _.extend({}, options, {
    Severity: Minor
    Found in iframely/lib/plugins/system/htmlparser/htmlparser.js - About 1 hr to fix

      Function logout has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          logout: function() {
      
              var _this = this;
              var utils = _this.utils;
              var error = utils.error;
      Severity: Minor
      Found in app/js/components/hello.all.js - About 1 hr to fix

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

          Function sortLinks has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              core.sortLinks = function(links) {
          
                  // Sort links in order of REL according to CONFIG.REL_GROUPS.
                  function getRelIndex(rel) {
                      var rels = _.intersection(rel, CONFIG.REL_GROUPS);
          Severity: Minor
          Found in iframely/lib/core.js - About 1 hr to fix

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

                getLink: function(sm4, whitelistRecord) {
            
                    if (!(sm4.video && sm4.video.embed && whitelistRecord.isAllowed && whitelistRecord.isAllowed('sm4.video'))) {
                        return;
                    }
            Severity: Minor
            Found in iframely/plugins/links/sm4.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 prepareLink has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                prepareLink: function(link) {
            
                    if (link.type === CONFIG.T.image) {
            
                        var extRe = link.href.match(/\.(\w{3,4})(\?.*)?$/);
            Severity: Minor
            Found in iframely/lib/plugins/validators/sync/11_image_type_by_ext.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 lookupStaticProviders has a Cognitive Complexity of 14 (exceeds 5 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

            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 isYoutube has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            function isYoutube(meta) {
            
                var video;
                if (meta.og && (video = meta.og.video)) {
                    if (!(video instanceof Array)) {
            Severity: Minor
            Found in iframely/lib/utils.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 link has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    link: function(scope) {
                        var hello = scope.hello;
                        var isOnline = hello('twitter').getAuthResponse();
                        var idleTime = 0;
            
            
            Severity: Minor
            Found in app/js/directives/signin-twitter.js - About 1 hr to fix

              Function sortLinksInner has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function sortLinksInner(l1, l2) {
              
                          var non_responsive_1 = l1.media && l1.media['width'] && l1.media['height'];
                          var non_responsive_2 = l2.media && l2.media['width'] && l2.media['height'];
                          if (non_responsive_1 && !non_responsive_2) {
              Severity: Minor
              Found in iframely/lib/html-utils.js - About 1 hr to fix

                Function xmlStream2oembed has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function xmlStream2oembed(stream, callback) {
                    var oembed;
                    var prop;
                    var value;
                    var firstTag;
                Severity: Minor
                Found in iframely/lib/plugins/system/oembed/oembedUtils.js - About 1 hr to fix

                  Function prepareLink has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      prepareLink: function(url, link, options, cb) {
                  
                          // Check if need link processing.
                  
                          function finish() {
                  Severity: Minor
                  Found in iframely/lib/plugins/validators/async/21_checkFlash.js - About 1 hr to fix

                    Function update2 has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        vm.update2 = function(refreshTime) {
                            return $timeout(function() {
                                SearchService.initData(searchParams).then(function(data) {
                                    if (data.statuses) {
                                        if (data.statuses.length <= 0) {
                    Severity: Minor
                    Found in app/js/controllers/wallDisplay.js - About 1 hr to fix

                      Function _handleMatchSelection has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            function _handleMatchSelection(key){
                              var caretPosition = _getCaretPosition($select.searchInput[0]),
                                  length = $select.selected.length,
                                  // none  = -1,
                                  first = 0,
                      Severity: Minor
                      Found in app/js/components/select.js - About 1 hr to fix

                        Function customHandler has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function customHandler(req, res, next) {
                        
                            // Check that this is a login redirect with an access_token (not a RESTful API call via proxy)
                            if (req.oauthshim &&
                                    req.oauthshim.redirect &&
                        Severity: Minor
                        Found in oauth-proxy/index.js - About 1 hr to fix

                          Function OnRun has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function OnRun($rootScope, AppSettings, HelloService) {
                              var root = {};
                            root.hello = HelloService;
                            
                            /**
                          Severity: Minor
                          Found in app/js/on_run.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    else if (window.Element) {
                                        return data instanceof window.Element && (!type || (data.tagName && data.tagName.toLowerCase() === type));
                                    }
                                    else {
                                        return (!(data instanceof Object || data instanceof Array || data instanceof String || data instanceof Number) && data.tagName && data.tagName.toLowerCase() === type);
                            Severity: Critical
                            Found in app/js/components/hello.all.js - About 1 hr to fix

                              Consider simplifying this complex logical expression.
                              Open

                                          if ((meta.twitter && meta.twitter.card == 'player') || (meta.og && meta.og.type == 'video') || meta.video_src || (href && /video\.html$/.test(href))) {
                              
                                              var aspect = oembed.height ? oembed.width / oembed.height : 0;
                              
                                              // This is to fix incorrect aspect for both iFrame and images :\
                              Severity: Critical
                              Found in iframely/plugins/domains/kickstarter.com.js - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                                if (data.response && data.response.length > 0) {
                                
                                                    var status = data.response[0];
                                                    var m = url.match(/hash=([\w-]+)/i);
                                
                                
                                Severity: Critical
                                Found in iframely/plugins/domains/vk.com/vk.status.js - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language