fossasia/loklak_webclient

View on GitHub

Showing 566 of 915 total issues

Function exports has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(options, callback) {

    options = _.extend({}, options);

    if (typeof options.prepareResult !== 'function') {
Severity: Major
Found in iframely/lib/request.js - About 2 hrs to fix

    Function a has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function a(i, n) {
                if (!i.compiled) {
                    if (i.compiled = !0,
                    i.k = i.k || i.bK,
                    i.k) {
    Severity: Major
    Found in app/js/components/highlight.js - About 2 hrs to fix

      File whitelist.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      (function(whitelist) {
      
          var chokidar = require('chokidar'),
              fs = require('fs'),
              path = require('path'),
      Severity: Minor
      Found in iframely/lib/whitelist.js - About 2 hrs to fix

        Function getLinks has 53 lines of code (exceeds 25 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: Major
        Found in iframely/plugins/domains/instagram.com.js - About 2 hrs to fix

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

              getLink: function(urlMatch, request, cb) {
                  var gistId = urlMatch[2];
                  var filePermalink = urlMatch[4];
          
                  if (!filePermalink) {
          Severity: Minor
          Found in iframely/plugins/domains/github.gist.js - About 2 hrs 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 16 (exceeds 5 allowed). Consider refactoring.
          Open

              getLinks: function (meta, oembed, options, cb) {
          
                  // When there is no project video, Kikstarter's oEmbed has diff output
                  // 'meta' param is there to determine if there's a video
                  // oembed thumbnail is returned as link and not as mixin to avoid empty results and fallback to generic parsers
          Severity: Minor
          Found in iframely/plugins/domains/kickstarter.com.js - About 2 hrs 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 Multipart has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function Multipart() {
          
                  // Internal body
                  var body = [];
                  var boundary = (Math.random() * 1e10).toString(32);
          Severity: Major
          Found in app/js/components/hello.all.js - About 2 hrs to fix

            Function formatEntry has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function formatEntry(a) {
            
                    var group = a.media$group;
                    var photo = group.media$content.length ? group.media$content[0] : {};
                    var mediaContent = group.media$content || [];
            Severity: Major
            Found in app/js/components/hello.all.js - About 2 hrs to fix

              Function evalHistogram has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function evalHistogram(statistics) {
                      if (Object.getOwnPropertyNames(statistics.created_at).length !== 0) {
                          var data = [];
                          var labels = [];
                          var chosen_attr = statistics.created_at;
              Severity: Major
              Found in app/js/controllers/wallDisplay.js - About 2 hrs to fix

                Function getLinks has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    getLinks: function(twitter, meta, whitelistRecord) {
                
                        var links = [];
                
                        if (twitter.card === "gallery") {
                Severity: Major
                Found in iframely/plugins/links/twitter-image.js - About 2 hrs to fix

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

                      prepareLink: function(url, link, options, cb) {
                  
                          if (!link.href) {
                              return cb();
                          }
                  Severity: Major
                  Found in iframely/lib/plugins/validators/async/22_imageSize.js - About 2 hrs to fix

                    Consider simplifying this complex logical expression.
                    Open

                                if (t.touches && 2 === t.touches.length && this._zooming) {
                                    var i = e.mouseEventToLayerPoint(t.touches[0])
                                      , n = e.mouseEventToLayerPoint(t.touches[1]);
                                    this._scale = i.distanceTo(n) / this._startDist,
                                    this._delta = i._add(n)._divideBy(2)._subtract(this._startCenter),
                    Severity: Critical
                    Found in app/js/components/leaflet.js - About 2 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                                  if (this.options.autoPan) {
                                      var t = this._map
                                        , e = this._container.offsetHeight
                                        , i = this._containerWidth
                                        , n = new o.Point(this._containerLeft,-e - this._containerBottom);
                      Severity: Critical
                      Found in app/js/components/leaflet.js - About 2 hrs to fix

                        Function findBestSizedLink has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            $.iframely.findBestSizedLink = function(targetWidth, targetHeight, links) {
                        
                                var sizedLinks = $.iframely.filterLinks(links, function(link) {
                                    var media = link.media;
                                    return media && media.width && media.height;
                        Severity: Minor
                        Found in iframely/static/js/iframely.js - About 2 hrs to fix

                          Function getUrl has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var getUrl = exports.getUrl = function(url, options) {
                          
                              var req = new events.EventEmitter();
                          
                              var options = options || {};
                          Severity: Minor
                          Found in iframely/lib/utils.js - About 2 hrs to fix

                            Function start has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                $scope.start = function() {
                                    //construct term
                                    delete $scope.newWallOptions.link;
                                    var dataParams = encodeURIComponent(angular.toJson($scope.newWallOptions));
                                    $('#wall-modal').modal('toggle');
                            Severity: Minor
                            Found in app/js/controllers/wall.js - About 1 hr to fix

                              Function getFullscreenAPI has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  ui.getFullscreenAPI = function() {
                                      var dE = document.documentElement,
                                          api,
                                          tF = 'fullscreenchange';
                              
                              
                              Severity: Minor
                              Found in app/js/components/photoswipe-ui-default.js - About 1 hr to fix

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

                                  Function link has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                        link: function(scope, elem, attrs) {
                                          var checkWhenEnabled, handler, scrollDistance, scrollEnabled;
                                          $window = angular.element($window);
                                          scrollDistance = 0;
                                          if (attrs.infiniteScrollDistance != null) {
                                  Severity: Minor
                                  Found in app/js/components/ng-infinite-scroll.js - About 1 hr to fix

                                    Function ImportProfileService has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function ImportProfileService($q, $http, $rootScope, AppSettings) {
                                    
                                        var service = {};
                                    
                                        service.search = function(screen_name, source_type, msg_id) {
                                    Severity: Minor
                                    Found in app/js/services/importProfile.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language