fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Function WallService has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function WallService($q, $http, AppSettings) {
    var service = {};

    service.getData = function (term) {
        var deferred = $q.defer();
Severity: Minor
Found in app/js/services/wall.js - About 1 hr to fix

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

        getData: function(url, meta, whitelistRecord) {
    
            if (!whitelistRecord.isDefault && ((meta.og && meta.og.image) || (meta.twitter && meta.twitter.image))) {return;}
    
            if (url.match(/^https?:\/\/link\.brightcove\.(?:com|co\.jp)\/services\/player\/bcpid(\d+)\?/i)) {return;}
    Severity: Minor
    Found in iframely/plugins/links/promo/brightcove-hosted.js - About 1 hr to fix

      Function getVideoLinks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getVideoLinks(video, whitelistRecord) {
      
          var players = [{
              href: video.url || video,
              type: CONFIG.T.maybe_text_html,
      Severity: Minor
      Found in iframely/plugins/links/og-video.js - About 1 hr to fix

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

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

          Function windowMessaging has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var windowMessaging = function(){
          
                  return {
                      postMessage : function(message, target_url, target) {
          
          
          Severity: Minor
          Found in iframely/static/js/iframely.js - About 1 hr to fix

            Function windowMessaging has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var windowMessaging = function(){
            
                    return {
                        postMessage : function(message, target_url, target) {
            
            
            Severity: Minor
            Found in iframely/static/js/iframely-utils.js - About 1 hr to fix

              Function windowMessaging has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var windowMessaging = function(){
              
                      return {
                          postMessage : function(message, target_url, target) {
              
              
              Severity: Minor
              Found in iframely/static/js/iframely-for-iframe.js - About 1 hr to fix

                Function extractDomainPatterns has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function extractDomainPatterns(uri, disableWildcard) {
                
                        var patterns = [];
                
                        var domain = extractDomain(uri);
                Severity: Minor
                Found in iframely/lib/whitelist.js - About 1 hr to fix

                  Function finish has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              finish = function() {
                  
                                  // Abort request.
                                  if (context.htmlparser && context.htmlparser.request) {
                                      context.htmlparser.request.abort();
                  Severity: Minor
                  Found in iframely/lib/core.js - About 1 hr to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if (session && 'access_token' in session && session.access_token && 'expires' in session && session.expires > ((new Date()).getTime() / 1e3)) {
                                    // What is different about the scopes in the session vs the scopes in the new login?
                                    var diff = utils.diff((session.scope || '').split(SCOPE_SPLIT), (p.qs.state.scope || '').split(SCOPE_SPLIT));
                                    if (diff.length === 0) {
                    
                    
                    Severity: Major
                    Found in app/js/components/hello.all.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (obj === null || typeof (obj) !== 'object' || obj instanceof Date || 'nodeName' in obj || this.isBinary(obj) || (typeof FormData === 'function' && obj instanceof FormData)) {
                                  return obj;
                              }
                      Severity: Major
                      Found in app/js/components/hello.all.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if (e = e === i ? this._zoom : this._limitZoom(e),
                                    t = this._limitCenter(o.latLng(t), e, this.options.maxBounds),
                                    n = n || {},
                                    this._panAnim && this._panAnim.stop(),
                                    this._loaded && !n.reset && n !== !0) {
                        Severity: Major
                        Found in app/js/components/leaflet.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                      if (clearTimeout(this._holdTimeout),
                                      o.DomEvent.off(e, "touchmove", this._onMove, this).off(e, "touchend", this._onUp, this),
                                      this._fireClick && t && t.changedTouches) {
                                          var i = t.changedTouches[0]
                                            , n = i.target;
                          Severity: Major
                          Found in app/js/components/leaflet.js - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    if (h && (force || h != height || !height || !w || !width || w > width)) {
                                        height = h;
                                        width = w;
                                        windowMessaging.postMessage({
                                            windowId: windowId,
                            Severity: Major
                            Found in iframely/static/js/iframely-utils.js - About 1 hr to fix

                              Function runPluginsIteration has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  function runPluginsIteration(requiredPlugins, context, pluginsUrlMatches, usedMethods, usedParams, usedDomains, options, asyncMethodCb) {
                              Severity: Major
                              Found in iframely/lib/core.js - About 1 hr to fix

                                Function popup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    popup: function(url, redirectUri, options) {
                                
                                        var documentElement = document.documentElement;
                                
                                        // Multi Screen Popup Positioning (http://stackoverflow.com/a/16861050)
                                Severity: Minor
                                Found in app/js/components/hello.all.js - About 55 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 qs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    qs: function(url, params, formatFunction) {
                                
                                        if (params) {
                                
                                            // Set default formatting function
                                Severity: Minor
                                Found in app/js/components/hello.all.js - About 55 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 z has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                router.put('/:user/:app/:id', isAuthorized, function z(req, res) {
                                    getData(req.params.user, function (error, response, body) {
                                        var responseData = JSON.parse(response.body),
                                            appData = responseData.accounts[0].apps,
                                            authData = {},
                                Severity: Minor
                                Found in oauth-proxy/api.js - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    getData: function(urlMatch, request, cb) {
                                
                                        request({
                                            uri: "http://www.bloomberg.com/api/videos/slug/" + urlMatch[1],
                                            json: true,
                                Severity: Minor
                                Found in iframely/plugins/domains/bloomberg.video.js - About 55 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 getLink has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    getLink: function(oembed, whitelistRecord) {
                                
                                        if ((oembed.type === "photo" || oembed.type === "image") && oembed.html && whitelistRecord.isAllowed && whitelistRecord.isAllowed('oembed.photo')) {
                                
                                            var image = {
                                Severity: Minor
                                Found in iframely/plugins/links/oembed-photo-html.js - About 55 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