fossasia/loklak_webclient

View on GitHub

Showing 915 of 915 total issues

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

    link: function(scope, element, attrs, ctrls) {

      var $select = ctrls[0];
      var ngModel = scope.ngModel = ctrls[1];
      var $selectMultiple = scope.$selectMultiple;
Severity: Major
Found in app/js/components/select.js - About 1 day to fix

    Function onopentag has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

    HTMLMetaHandler.prototype.onopentag = function(name, attributes) {
    
        if (this._end) return;
    
        name = name.toUpperCase();
    Severity: Minor
    Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 1 day 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 _finalMerge has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
    Open

    HTMLMetaHandler.prototype._finalMerge = function() {
    
        this._end = true;
    
        var that = this;
    Severity: Minor
    Found in iframely/lib/plugins/system/meta/HTMLMetaHandler.js - About 1 day 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 exports has 255 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(app) {
    
        app.get('/iframely', function(req, res, next) {
    
            var uri = prepareUri(req.query.uri || req.query.url);
    Severity: Major
    Found in iframely/modules/api/views.js - About 1 day to fix

      File utils.js has 590 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var events = require('events');
      var request = require('request');
      var zlib = require('zlib');
      var iconv = require('iconv-lite');
      var async = require('async');
      Severity: Major
      Found in iframely/lib/utils.js - About 1 day to fix

        File iframely.js has 572 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        ;(function ( $ ) {
        
            /*
        
             Iframely consumer client lib.
        Severity: Major
        Found in iframely/static/js/iframely.js - About 1 day to fix

          Function WallCtrl has 240 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function WallCtrl($scope, $rootScope, $window, $timeout, AppsService, HelloService, SearchService) {
          
              var vm = this;
              var term = '';
              var isEditing = -1;
          Severity: Major
          Found in app/js/controllers/wall.js - About 1 day to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                var thumbnails = $.iframely.filterLinks(iframelyData.links, function(link) {
            
                                    if (hasPromo && link.rel.indexOf('promo') === -1) {
                                        return;
                                    }
            Severity: Major
            Found in iframely/static/js/iframely.js and 1 other location - About 1 day to fix
            iframely/lib/html-utils.js on lines 143..157

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 225.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                var thumbnails = filterLinks(iframelyData.links, function(link) {
            
                                    if (hasPromo && link.rel.indexOf('promo') === -1) {
                                        return;
                                    }
            Severity: Major
            Found in iframely/lib/html-utils.js and 1 other location - About 1 day to fix
            iframely/static/js/iframely.js on lines 345..359

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 225.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function controller has 227 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    controller: function($scope, $element, $attrs) {
            
                        $scope.harvestingFreqList = HarvestingFrequencyService.values;
                        $scope.sourceTypeList = SourceTypeService.sourceTypeList;
                        $scope.sourceTypeListWEndpoint = {};
            Severity: Major
            Found in app/js/directives/add-connection-modal.js - About 1 day to fix

              Function controller has 223 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      controller: function($scope) {
                          var timelineIntervals = [];
                          $rootScope.root.timelineNewTweets = [];
                          $rootScope.root.haveNewerTweets = false;
                          $rootScope.root.doneGettingFeed = false;
              Severity: Major
              Found in app/js/directives/signin-twitter.js - About 1 day to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    e.registerLanguage("ocaml", function(e) {
                        return {
                            aliases: ["ml"],
                            k: {
                                keyword: "and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value",
                Severity: Major
                Found in app/js/components/highlight.js and 1 other location - About 1 day to fix
                app/js/components/highlight.js on lines 6178..6219

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 212.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    e.registerLanguage("sml", function(e) {
                        return {
                            aliases: ["ml"],
                            k: {
                                keyword: "abstype and andalso as case datatype do else end eqtype exception fn fun functor handle if in include infix infixr let local nonfix of op open orelse raise rec sharing sig signature struct structure then type val with withtype where while",
                Severity: Major
                Found in app/js/components/highlight.js and 1 other location - About 1 day to fix
                app/js/components/highlight.js on lines 4911..4952

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 212.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function WallCtrl has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
                Open

                function WallCtrl($scope, $rootScope, $window, $timeout, AppsService, HelloService, SearchService) {
                
                    var vm = this;
                    var term = '';
                    var isEditing = -1;
                Severity: Minor
                Found in app/js/controllers/wall.js - About 1 day 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 token has 213 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Lexer.prototype.token = function(src, top) {
                  var src = src.replace(/^ +$/gm, '')
                    , next
                    , loose
                    , cap
                Severity: Major
                Found in app/js/components/marked.js - About 1 day to fix

                  Function controller has 211 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                           controller: function() {
                               $rootScope.root.tweet= "";
                               $rootScope.root.tweetType = 1;
                               $rootScope.root.tweetLength = 140;
                               $rootScope.root.userLocation = {};
                  Severity: Major
                  Found in app/js/directives/tweet-feature-drt.js - About 1 day to fix

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

                            link: function link(scope, element, attrs, ngModelController) {
                    
                              var directiveConfig = {};
                    
                              if (attrs.datetimepickerConfig) {
                    Severity: Major
                    Found in app/js/components/datetimepicker.js - About 1 day to fix

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          function addListenersOnMap() {
                              window.map.on("zoomend", function(event) {
                                  if (!prevZoomAction) {
                                      prevZoomAction = new Date();
                                      getMoreLocationOnMapAction();
                      Severity: Major
                      Found in app/js/controllers/search.js and 1 other location - About 1 day to fix
                      app/js/controllers/advanced-search.js on lines 325..352

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 200.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          function addListenersOnMap() {
                                  window.map.on("zoomend", function(event) {
                                          if (!prevZoomAction) {
                                                  prevZoomAction = new Date();
                                                  getMoreLocationOnMapAction();
                      Severity: Major
                      Found in app/js/controllers/advanced-search.js and 1 other location - About 1 day to fix
                      app/js/controllers/search.js on lines 257..284

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 200.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Function processPluginTests has 205 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function processPluginTests(pluginTest, plugin, count, cb) {
                      
                          var testUrlsSet, reachTestObjectFound = false;;
                      
                          log('===========================================');
                      Severity: Major
                      Found in iframely/modules/tests-ui/tester.js - About 1 day to fix
                        Severity
                        Category
                        Status
                        Source
                        Language