fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

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

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 $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 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 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

        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

            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

              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 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

                  Avoid deeply nested control flow statements.
                  Open

                                      else if (_this.domInstance('input', data[x]) && data[x].type === 'file') {
                                          continue;
                                      }
                                      else if (_this.domInstance('input', data[x]) ||
                                          _this.domInstance('select', data[x]) ||
                  Severity: Major
                  Found in app/js/components/hello.all.js - About 45 mins to fix

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

                    function JsonFieldAccessorService() {
                    
                        var service = {};
                        // support "deep" field accessing : field is location.lat => result = json[location][lat]
                        service.accessField = function(json, field) {
                    Severity: Minor
                    Found in app/js/services/jsonFieldAccessor.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 (moreDetailedData) {
                                                        tagToAppend = generateArticleParts(moreDetailedData);
                                                    }
                    Severity: Major
                    Found in app/js/directives/debugged-link.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if (typeof (attr[x]) === 'object') {
                                              for (var y in attr[x]) {if (attr[x].hasOwnProperty(y)) {
                                                  n[x][y] = attr[x][y];
                                              }}
                                          }
                      Severity: Major
                      Found in app/js/components/hello.all.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                  if (bull !== b && !(bull.length > 1 && b.length > 1)) {
                                    src = cap.slice(i + 1).join('\n') + src;
                                    i = l - 1;
                                  }
                        Severity: Major
                        Found in app/js/components/marked.js - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language