fossasia/loklak_webclient

View on GitHub

Showing 915 of 915 total issues

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

    var generateArticleParts = function(data) {
            var site = (data.site) ? '<a href="' + data.canonical + '" class="article-site">' + data.site + '</a>' : '';
            var title = (data.title) ? '<a href="' + data.canonical + '" class="article-title">' + data.title  + '</a href="' + data.canonical + '">' : '';
            var thumbnail = '<a href="' + data.canonical + '" class="article-img-container"><img src="' + data.thumbnail_url + '"></a href="' + data.canonical + '">';
            var container = '<div class="article-container" href="' + data.canonical + '">';
Severity: Major
Found in app/js/directives/home-debugged-link.js and 1 other location - About 7 hrs to fix
app/js/directives/debugged-link.js on lines 15..22

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

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 generateArticleParts = function(data) {
            var site = (data.site) ? '<a href="' + data.canonical + '" class="article-site">' + data.site + '</a>' : '';
            var title = (data.title) ? '<a href="' + data.canonical + '" class="article-title">' + data.title  + '</a href="' + data.canonical + '">' : '';
            var thumbnail = '<a href="' + data.canonical + '" class="article-img-container"><img src="' + data.thumbnail_url + '"></a href="' + data.canonical + '">';
            var container = '<div class="article-container" href="' + data.canonical + '">';
Severity: Major
Found in app/js/directives/debugged-link.js and 1 other location - About 7 hrs to fix
app/js/directives/home-debugged-link.js on lines 15..22

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

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 compile has 193 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    compile: function(tElement, tAttrs) {

      //Multiple or Single depending if multiple attribute presence
      if (angular.isDefined(tAttrs.multiple))
        tElement.append("<ui-select-multiple/>").removeAttr('multiple');
Severity: Major
Found in app/js/components/select.js - About 7 hrs to fix

    Function login has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

        login: function() {
    
            // Create an object which inherits its parent as the prototype and constructs a new event chain.
            var _this = this;
            var utils = _this.utils;
    Severity: Minor
    Found in app/js/components/hello.all.js - About 7 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 ChartJsFactory has 186 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function ChartJsFactory (ChartJs) {
          function sum (carry, val) {
            return carry + val;
          }
    
    
    Severity: Major
    Found in app/js/components/angular-chart.js - About 7 hrs to fix

      Function AdvancedSearchCtrl has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

      function AdvancedSearchCtrl($http, $scope, $filter, $location, $stateParams, AppSettings, SearchService, MapPopUpTemplateService, MapCreationService) {
      
          var vm = this;
          var map = false;
          var prevZoomAction, prevPanAction, newZoomAction, newPanAction;
      Severity: Minor
      Found in app/js/controllers/advanced-search.js - About 7 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

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

              _onKeyDown: function(t) {
                  var e = t.keyCode
                    , i = this._map;
                  if (e in this._panKeys) {
                      if (i._panAnim && i._panAnim._inProgress)
      Severity: Major
      Found in app/js/components/leaflet.js and 1 other location - About 7 hrs to fix
      iframely/plugins/domains/ebaumsworld.com.js on lines 10..19

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

      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

          vm.openSwipe = function(status_id) {
              var items = [];
              var images  = angular.element('#' + status_id + ' .images-wrapper img');
              var options = { index: 0, history: false};
              var swipeEle = document.querySelectorAll('.pswp')[0];
      Severity: Major
      Found in app/js/controllers/search.js and 1 other location - About 7 hrs to fix
      app/js/controllers/topology.js on lines 99..113

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

      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

          vm.openSwipe = function(status_id) {
              var items = [];
              var images  = angular.element('#' + status_id + ' .images-wrapper img');
              var options = { index: 0, history: false};
              var swipeEle = document.querySelectorAll('.pswp')[0];
      Severity: Major
      Found in app/js/controllers/topology.js and 1 other location - About 7 hrs to fix
      app/js/controllers/search.js on lines 348..362

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

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

          Promise: (function(){
              /*  promise states [Promises/A+ 2.1]  */
              var STATE_PENDING   = 0;                                         /*  [Promises/A+ 2.1.1]  */
              var STATE_FULFILLED = 1;                                         /*  [Promises/A+ 2.1.2]  */
              var STATE_REJECTED  = 2;                                         /*  [Promises/A+ 2.1.3]  */
      Severity: Minor
      Found in app/js/components/hello.all.js - About 6 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

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

                  $aScope.find('[itemprop]').each(function() {
                      var $el = cheerio(this);
      
                      var scope = $el.attr('itemscope');
                      if (typeof scope !== 'undefined') {
      Severity: Major
      Found in iframely/plugins/links/embedURL/embedURL.js and 1 other location - About 6 hrs to fix
      iframely/plugins/domains/cbsnews.com.js on lines 19..37

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

      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

                  $aScope.find('[itemprop]').each(function() {
                      var $el = cheerio(this);
      
                      var scope = $el.attr('itemscope');
                      if (typeof scope !== 'undefined') {
      Severity: Major
      Found in iframely/plugins/domains/cbsnews.com.js and 1 other location - About 6 hrs to fix
      iframely/plugins/links/embedURL/embedURL.js on lines 17..35

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

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

          getLink: function(url, options) {
              url = URL.parse(url,true);
      
              var query = url.query;
      
      
      Severity: Minor
      Found in iframely/plugins/domains/google.com/maps.google.com.js - About 6 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

      File tester.js has 444 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      GLOBAL.CONFIG = require('../../config');
      
      if (!CONFIG.tests) {
          console.error('Tests not started: CONFIG.tests not configured.');
          process.abort();
      Severity: Minor
      Found in iframely/modules/tests-ui/tester.js - About 6 hrs to fix

        Function getstatfollower has 164 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

             $scope.getstatfollower = function () {
                viewloading();
        
                $http.jsonp(AppSettings.apiUrl+"user.json?callback=JSON_CALLBACK", {params : { screen_name :$scope.username, followers : 10000, following : 10000, minified: true } })
                    .success(function(data, status, headers, config) {
        Severity: Major
        Found in app/js/controllers/analyze.js - About 6 hrs to fix

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

                for (i = 0; i < item.align.length; i++) {
                  if (/^ *-+: *$/.test(item.align[i])) {
                    item.align[i] = 'right';
                  } else if (/^ *:-+: *$/.test(item.align[i])) {
                    item.align[i] = 'center';
          Severity: Major
          Found in app/js/components/marked.js and 1 other location - About 6 hrs to fix
          app/js/components/marked.js on lines 213..223

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

          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

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

                for (i = 0; i < item.align.length; i++) {
                  if (/^ *-+: *$/.test(item.align[i])) {
                    item.align[i] = 'right';
                  } else if (/^ *:-+: *$/.test(item.align[i])) {
                    item.align[i] = 'center';
          Severity: Major
          Found in app/js/components/marked.js and 1 other location - About 6 hrs to fix
          app/js/components/marked.js on lines 384..394

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

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

              responseHandler: function(window, parent) {
          
                  var _this = this;
                  var p;
                  var location = window.location;
          Severity: Minor
          Found in app/js/components/hello.all.js - About 6 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

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

              $.iframely.registerIframe = function($iframe, id) {
                  if (!$iframe || $iframe.attr('iframely-registered')) {
                      return;
                  }
          
          
          Severity: Major
          Found in iframely/static/js/iframely-for-iframe.js and 1 other location - About 6 hrs to fix
          iframely/static/js/iframely.js on lines 119..137

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

          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

              $.iframely.registerIframe = function($iframe, id) {
                  if (!$iframe || $iframe.attr('iframely-registered')) {
                      return;
                  }
          
          
          Severity: Major
          Found in iframely/static/js/iframely.js and 1 other location - About 6 hrs to fix
          iframely/static/js/iframely-for-iframe.js on lines 90..108

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

          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

          Severity
          Category
          Status
          Source
          Language