fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Function getLink has a Cognitive Complexity of 9 (exceeds 5 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 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 getLinks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    getLinks: function(urlMatch, meta, oembed, options) {
        var src = 'http://instagram.com/p/' + urlMatch[1] + '/media/?size=';

        var aspect = oembed.thumbnail_width && oembed.thumbnail_height ? oembed.thumbnail_width / oembed.thumbnail_height : 1/1

Severity: Minor
Found in iframely/plugins/domains/instagram.com.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 _onreset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

CollectingHandlerForMutliTarget.prototype._onreset = function(cbs) {

    if (cbs) {

        if (cbs.onreset) {

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

exports.unifyDate = function(date) {

    if (typeof date === "string" && date.match(/^\d+$/)) {
        date = parseInt(date);
    }
Severity: Minor
Found in iframely/lib/utils.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 WallCtrl has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

function WallCtrl($scope, $rootScope, $window, $timeout, AppsService, HelloService, SearchService) {
Severity: Major
Found in app/js/controllers/wall.js - About 50 mins to fix

    Function $get has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          function($interval, $log, $rootScope, $document, Keepalive, LocalStorage, $window) {
    Severity: Major
    Found in app/js/components/angular-idle.js - About 50 mins to fix

      Function useResult has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          function useResult(usedMethods, context, pluginsContexts, allResults, result, options, asyncMethodCb) {
      Severity: Major
      Found in iframely/lib/core.js - About 50 mins to fix

        Function domInstance has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            domInstance: function(type, data) {
                var test = 'HTML' + (type || '').replace(
                    /^[a-z]/,
                    function(m) {
                        return m.toUpperCase();
        Severity: Minor
        Found in app/js/components/hello.all.js - About 45 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

        Avoid deeply nested control flow statements.
        Open

                      if ( ctrl.search.length > 0 ) {
                        tagged = true;
                      }
        Severity: Major
        Found in app/js/components/select.js - About 45 mins to fix

          Function post has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              post: function(url, data, options, callback, callbackID, timeout) {
          Severity: Minor
          Found in app/js/components/hello.all.js - About 45 mins to fix

            Function isEmpty has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                isEmpty: function(obj) {
            
                    // Scalar
                    if (!obj)
                        return true;
            Severity: Minor
            Found in app/js/components/hello.all.js - About 45 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

            Avoid deeply nested control flow statements.
            Open

                                            if (vm.wallOptions.cycle) {
                                                if (!contains(vm.statuses, data.statuses[i])) {
                                                    console.log("triggered");
                                                    removeLeastRecentTweet();
                                                    $interval.cancel(cycleInterval);
            Severity: Major
            Found in app/js/controllers/wallDisplay.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if ( ctrl.activeIndex === 0 ) {
                            // ctrl.tagging pushes items to ctrl.items, so we only have empty val
                            // for `item` if it is a detected duplicate
                            if ( item === undefined ) return;
              
              
              Severity: Major
              Found in app/js/components/select.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if ( ctrl.activeIndex < 0 ) {
                              item = ctrl.tagging.fct !== undefined ? ctrl.tagging.fct(ctrl.search) : ctrl.search;
                              if (!item || angular.equals( ctrl.items[0], item ) ) {
                                return;
                              }
                Severity: Major
                Found in app/js/components/select.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if (this.events[name][i]) {
                                              // Emit on the local instance of this
                                              callback.call(this, name, i);
                                          }
                  Severity: Major
                  Found in app/js/components/hello.all.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                                if(uiElement.onInit) {
                                                    uiElement.onInit(item);
                                                }
                    Severity: Major
                    Found in app/js/components/photoswipe-ui-default.js - About 45 mins to fix

                      Function parseMetaLinks has a Cognitive Complexity of 8 (exceeds 5 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 45 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 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          getLink: function(url, meta, options, cb) {
                      
                              var canonical = (meta.canonical && meta.canonical.href) || meta.canonical || (meta.og && meta.og.url);
                      
                              // Redirect to canonical from mobile url.
                      Severity: Minor
                      Found in iframely/plugins/links/mobile-canonical.js - About 45 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 getLinks has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          getLinks: function(__promoUri, promo) {
                      
                              var hasGoodLinks = false;
                              var links = promo.links.filter(function(link) {
                                  var match = _.intersection(link.rel, CONFIG.PROMO_RELS);
                      Severity: Minor
                      Found in iframely/plugins/links/promo/promo.js - About 45 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

                      Avoid deeply nested control flow statements.
                      Open

                                          if ('files' in data[x] && data[x].files.length > 0) {
                                              f.append(x, data[x].files[0]);
                                          }
                      Severity: Major
                      Found in app/js/components/hello.all.js - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language