Noosfero/noosfero

View on GitHub

Showing 1,643 of 1,643 total issues

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

          $.get(this.balloon_url+'/'+supplier_id, function(data) {
            var html = $(data)
            var title = orders_cycle.order.product.balloon_title(html)
            // use container to avoid conflict with row click
            var options = {html: true, content: html, container: 'body', title: title}
Severity: Major
Found in plugins/orders_cycle/public/javascripts/orders_cycle.js and 1 other location - About 4 hrs to fix
plugins/orders_cycle/public/javascripts/orders_cycle.js on lines 140..146

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

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

        $.get(this.balloon_url+'/'+id, function(data) {
          var html = $(data)
          var title = orders_cycle.order.product.balloon_title(html)
          // use container to avoid conflict with row click
          var options = {html: true, content: html, container: 'body', title: title}
Severity: Major
Found in plugins/orders_cycle/public/javascripts/orders_cycle.js and 1 other location - About 4 hrs to fix
plugins/orders_cycle/public/javascripts/orders_cycle.js on lines 127..133

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

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 3 locations. Consider refactoring.
Open

  $('.task-accept-radio').on('click', function() {
    var task = $(this).closest('.task-box')
    task.find('.task-view-details').show('slow')
    task.find('.task-reject-explanation').hide('slow')
    task.find('.task-view-datails-link.show-details').hide()
Severity: Major
Found in public/javascripts/tasks.js and 2 other locations - About 3 hrs to fix
public/javascripts/tasks.js on lines 54..60
public/javascripts/tasks.js on lines 62..68

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

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 3 locations. Consider refactoring.
Open

  $('.task-skip-radio').on('click', function() {
    var task = $(this).closest('.task-box')
    task.find('.task-view-details').hide('slow')
    task.find('.task-reject-explanation').hide('slow')
    task.find('.task-view-datails-link.show-details').show()
Severity: Major
Found in public/javascripts/tasks.js and 2 other locations - About 3 hrs to fix
public/javascripts/tasks.js on lines 46..52
public/javascripts/tasks.js on lines 54..60

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

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 3 locations. Consider refactoring.
Open

  $('.task-reject-radio').on('click', function() {
    var task = $(this).closest('.task-box')
    task.find('.task-view-details').hide('slow')
    task.find('.task-reject-explanation').show('slow')
    task.find('.task-view-datails-link.show-details').show()
Severity: Major
Found in public/javascripts/tasks.js and 2 other locations - About 3 hrs to fix
public/javascripts/tasks.js on lines 46..52
public/javascripts/tasks.js on lines 62..68

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

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

InfoBox.prototype.panBox_ = function (disablePan) {

  var map;
  var bounds;
  var xOffset = 0, yOffset = 0;
Severity: Minor
Found in plugins/sniffer/public/javascripts/infobox.js - About 3 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

Method view_page has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def view_page
    path = get_path(params[:page], params[:format])

    @version = params[:version].to_i
    @npage = params[:npage] || "1"
Severity: Minor
Found in app/controllers/public/content_viewer_controller.rb - About 3 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

Method edit has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def edit
    params[:article] ||= {}
    @success_back_to = params[:success_back_to]
    @article = profile.articles.find(params[:id])
    version = params[:version]
Severity: Minor
Found in app/controllers/my_profile/cms_controller.rb - About 3 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 order.rb has 329 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class OrdersPlugin::Order < ApplicationRecord
  # if abstract_class is true then it will trigger https://github.com/rails/rails/issues/20871
  # self.abstract_class = true

  Statuses = ::OrdersPlugin::Item::Statuses
Severity: Minor
Found in plugins/orders/models/orders_plugin/order.rb - About 3 hrs to fix

    Method products has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def self.products(consumer, csv)
        default_product_category = consumer.environment.product_categories.find_by slug: "software-livre"
    
        detection = CharlockHolmes::EncodingDetector.detect csv
        csv = CharlockHolmes::Converter.convert csv, detection[:encoding], "UTF-8"
    Severity: Major
    Found in plugins/suppliers/lib/suppliers_plugin/import.rb - About 3 hrs to fix

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

                  "shift+right" : function () { 
                      var o = this.data.ui.hovered || this.data.ui.last_selected;
                      if(o && o.length) {
                          if(o.hasClass("jstree-closed")) { this.open_node(o); }
                          else { this.hover_node(this._get_next(o)); }
      plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 1577..1584
      plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 1585..1592

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

      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 3 locations. Consider refactoring.
      Open

                  "right" : function () { 
                      var o = this.data.ui.hovered || this.data.ui.last_selected;
                      if(o && o.length) {
                          if(o.hasClass("jstree-closed")) { this.open_node(o); }
                          else { this.hover_node(this._get_next(o)); }
      plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 1585..1592
      plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 1593..1600

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

      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 3 locations. Consider refactoring.
      Open

                  "ctrl+right" : function () { 
                      var o = this.data.ui.hovered || this.data.ui.last_selected;
                      if(o && o.length) {
                          if(o.hasClass("jstree-closed")) { this.open_node(o); }
                          else { this.hover_node(this._get_next(o)); }
      plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 1577..1584
      plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 1593..1600

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

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

      function defaultPrefilter( elem, props, opts ) {
          var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire,
              anim = this,
              style = elem.style,
              orig = {},

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

                    check_all : function () {
                        var _this = this, 
                            coll = this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li");
                        coll.each(function () {
                            _this.change_state(this, false);
        plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 2916..2923

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

        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

                    uncheck_all : function () {
                        var _this = this,
                            coll = this._get_settings().checkbox.two_state ? this.get_container_ul().find("li") : this.get_container_ul().children("li");
                        coll.each(function () {
                            _this.change_state(this, true);
        plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 2908..2915

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

        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

                        this.data.ui.selected.each(function () { if(this.id) { _this.data.ui.to_select.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); } });
        plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 469..471

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

        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

                        this.get_container_ul().find("li.jstree-open").each(function () { 
                            if(this.id) { _this.data.core.to_open.push("#" + this.id.toString().replace(/^#/,"").replace(/\\\//g,"/").replace(/\//g,"\\\/").replace(/\\\./g,".").replace(/\./g,"\\.").replace(/\:/g,"\\:")); }
                        });
        plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 1091..1091

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

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

            trigger: function( event, data, elem, onlyHandlers ) {
                // Don't do events on text and comment nodes
                if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
                    return;
                }

          File ffmpeg.rb has 321 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require "rmagick"
          require "yaml"
          
          # Works for ffmpeg version 2.8.6-1~bpo8 shiped by Debian Jessie Backports
          # https://packages.debian.org/jessie-backports/ffmpeg
          Severity: Minor
          Found in plugins/html5_video/lib/video_processor/ffmpeg.rb - About 3 hrs to fix
            Severity
            Category
            Status
            Source
            Language