fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Consider simplifying this complex logical expression.
Open

            if (parentStyle && iframeStyle &&
                parentStyle.match('position: relative;') &&
                parentStyle.match('height: 0px;') &&
                iframeStyle.match('height: 100%;') &&
                iframeStyle.match('width: 100%;')) {
Severity: Major
Found in iframely/static/js/iframely.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

            if (player) {
    
                var m = player.media || {};
    
                var width = m.width || m['max-width'] || null;
    Severity: Major
    Found in iframely/lib/html-utils.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if (oembed.type === "video" || oembed.type === "audio"
                  || (oembed.type === "rich" && !whitelistRecord.isDefault && whitelistRecord.isAllowed('oembed.rich') && whitelistRecord.isAllowed('oembed.rich', "player")) ) {
                  return {
                      media: "player"
                  };
      Severity: Major
      Found in iframely/plugins/links/oembed-video.js - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                    if (twitter.image && (twitter.image.url || twitter.image.src || (typeof twitter.image === 'string'))) {
        
                        links.push({
                            href: twitter.image.url || twitter.image.src || twitter.image,
                            type: CONFIG.T.image,
        Severity: Major
        Found in iframely/plugins/links/twitter-image.js - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                  if ((oembed.type === "photo" || oembed.type === "image") && oembed.html && whitelistRecord.isAllowed && whitelistRecord.isAllowed('oembed.photo')) {
          
                      var image = {
                          type: CONFIG.T.text_html,  // Always an iframe, either native, or hosted
                          rel:[CONFIG.R.oembed, CONFIG.R.image, CONFIG.R.html5],
          Severity: Major
          Found in iframely/plugins/links/oembed-photo-html.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    } else if (params) {
            
                        var player = (meta.twitter && meta.twitter.player && meta.twitter.player.value) ||
                                    (meta.og && meta.og.video && meta.og.video.url);
            
            
            Severity: Major
            Found in iframely/plugins/domains/bandcamp.com.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                              if ((hasGetLinkMethod && getLinkMethodUsed)
                                  || (r.method.name === 'getData' && r.data.safe_html)
                                  || (!hasGetLinkMethod && r.method.name === 'getMeta')) {
                                  hasDomainData = true;
                              }
              Severity: Major
              Found in iframely/lib/core.js - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                            if (canonical && link.href && typeof link.href === 'string' && link.rel && link.rel.indexOf(CONFIG.R.file) === -1 && link.rel.indexOf(CONFIG.R.iframely) === -1) {
                
                                // Remove last / from url.
                
                                var link1 = link.href.replace(/\/+$/, '');
                Severity: Major
                Found in iframely/lib/core.js - About 40 mins to fix

                  Function createPhotoUrl has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      function createPhotoUrl(id, farm, server, secret, size) {
                  Severity: Minor
                  Found in app/js/components/hello.all.js - About 35 mins to fix

                    Function link has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        link: function (scope, element, attrs, ctrl, transclude) {
                    Severity: Minor
                    Found in app/js/components/select.js - About 35 mins to fix

                      Function xhr has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          xhr: function(method, url, headers, data, callback) {
                      Severity: Minor
                      Found in app/js/components/hello.all.js - About 35 mins to fix

                        Function GoogleChartController has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                function GoogleChartController($scope, $element, $attrs, $injector, FormatManager){
                        Severity: Minor
                        Found in app/js/components/ng-google-chart.js - About 35 mins to fix

                          Function Routes has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                          function Routes($stateProvider, $locationProvider, $urlRouterProvider, $httpProvider, cfpLoadingBarProvider) {
                          Severity: Minor
                          Found in app/js/routes.js - About 35 mins to fix

                            Function _simplifyDPStep has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    _simplifyDPStep: function(t, e, i, n, o) {
                            Severity: Minor
                            Found in app/js/components/leaflet.js - About 35 mins to fix

                              Function getBBox has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                              function getBBox(lat, lon, zoom, width, height) {
                              Severity: Minor
                              Found in iframely/plugins/domains/openstreetmap.org.js - About 35 mins to fix

                                Function runMethods has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    function runMethods(methods, context, pluginsUrlMatches, options, asyncMethodCb) {
                                Severity: Minor
                                Found in iframely/lib/core.js - About 35 mins to fix

                                  Function diffKey has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      diffKey: function(a, b) {
                                          if (a || !b) {
                                              var r = {};
                                              for (var x in a) {
                                                  // Does the property not exist?
                                  Severity: Minor
                                  Found in app/js/components/hello.all.js - About 35 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 jsonp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      jsonp: function(url, callback, callbackID, timeout) {
                                  
                                          var _this = this;
                                          var error = _this.error;
                                  
                                  
                                  Severity: Minor
                                  Found in app/js/components/hello.all.js - About 35 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 getData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      getData: function(cheerio, __allowBrightcoveInPage) {
                                  
                                          /* we are looking for following video on the page, and check that embed is allowed
                                                      <video
                                                          id="video-js-4306274716001"
                                  Severity: Minor
                                  Found in iframely/plugins/links/promo/brightcove-in-page-promo.js - About 35 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 getMeta has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      getMeta: function(meta) {
                                  
                                          var article = (meta.og && meta.og.article) || meta.article;
                                  
                                          var k = article ? article.tag : null;
                                  Severity: Minor
                                  Found in iframely/plugins/meta/og-article.js - About 35 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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language