Noosfero/noosfero

View on GitHub

Showing 1,643 of 1,643 total issues

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

                if($(window).height() - (e.pageY - t) < 20) {
                    if(sti && dir1 === "up") { clearInterval(sti); sti = false; }
                    if(!sti) { dir1 = "down"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() + $.vakata.dnd.scroll_spd); }, 150); }
                }
                else { 
plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 2249..2255

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

Class User has 48 methods (exceeds 20 allowed). Consider refactoring.
Open

class User < ApplicationRecord
  include Noosfero::Plugin::HotSpot
  include MetadataScopes
  include Notifiable

Severity: Minor
Found in app/models/user.rb - About 6 hrs to fix

    Method quantity_price_data has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

      def quantity_price_data(actor_name)
        data = { flags: {} }
        statuses = ::OrdersPlugin::Order::Statuses
        statuses_data = data[:statuses] = {}
    
    
    Severity: Minor
    Found in plugins/orders/models/orders_plugin/item.rb - 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

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

            renderCalendar: function (calendar, selected, minDate, maxDate, side) {
    
                var html = '<div class="calendar-date">';
                html += '<table class="table-condensed">';
                html += '<thead>';
    Severity: Major
    Found in plugins/orders/public/javascripts/daterangepicker.js - About 6 hrs to fix

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

          var overlay = jQuery('<div>', {
            class: 'loading-overlay',
            css: {
              width: element.outerWidth(),
              height: element.outerHeight(),
      Severity: Major
      Found in plugins/pjax/public/javascripts/loading-overlay.js and 1 other location - About 6 hrs to fix
      public/javascripts/loading-overlay.js on lines 9..21

      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

            var overlay = jQuery('<div>', {
              class: 'loading-overlay',
              css: {
                width: element.outerWidth(),
                height: element.outerHeight(),
      Severity: Major
      Found in public/javascripts/loading-overlay.js and 1 other location - About 6 hrs to fix
      plugins/pjax/public/javascripts/loading-overlay.js on lines 8..20

      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

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

              setEndDate: function(endDate) {
                  if (typeof endDate === 'string')
                      this.endDate = moment(endDate, this.format).utcOffset(this.timeZone);
      
                  if (typeof endDate === 'object')
      Severity: Major
      Found in plugins/orders/public/javascripts/daterangepicker.js and 1 other location - About 6 hrs to fix
      plugins/orders/public/javascripts/daterangepicker.js on lines 457..472

      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

              setStartDate: function(startDate) {
                  if (typeof startDate === 'string')
                      this.startDate = moment(startDate, this.format).utcOffset(this.timeZone);
      
                  if (typeof startDate === 'object')
      Severity: Major
      Found in plugins/orders/public/javascripts/daterangepicker.js and 1 other location - About 6 hrs to fix
      plugins/orders/public/javascripts/daterangepicker.js on lines 474..489

      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

      Class Task has 46 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Task < ApplicationRecord
        extend ActsAsHavingSettings::ClassMethods
        acts_as_having_settings field: :data
      
        store_accessor :metadata
      Severity: Minor
      Found in app/models/task.rb - About 6 hrs to fix

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

                                else {
                                    if($this.children("ul").children("li.jstree-unchecked, li.jstree-undetermined").length) {
                                        $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
                                        if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").prop("checked", false); }
                                        return false;
        plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 2867..2877

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

        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

                                if(state) {
                                    if($this.children("ul").children("li.jstree-checked, li.jstree-undetermined").length) {
                                        $this.parentsUntil(".jstree", "li").andSelf().removeClass("jstree-checked jstree-unchecked").addClass("jstree-undetermined");
                                        if(rc) { $this.parentsUntil(".jstree", "li").andSelf().children(":checkbox").prop("checked", false); }
                                        return false;
        plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 2878..2888

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

        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

        File account_controller.rb has 426 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class AccountController < ApplicationController
          no_design_blocks
        
          before_action :login_required, :require_login_for_environment, only: [:activation_question, :accept_terms, :activate_enterprise, :change_password]
          before_action :redirect_if_logged_in, only: [:login, :signup, :activate]
        Severity: Minor
        Found in app/controllers/public/account_controller.rb - About 6 hrs to fix

          File jquery.pjax.js has 423 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // jquery.pjax.js
          // copyright chris wanstrath
          // https://github.com/defunkt/jquery-pjax
          
          (function($){
          Severity: Minor
          Found in plugins/pjax/public/javascripts/jquery.pjax.js - About 6 hrs to fix

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

                            if(e.pageX - l < 20) {
                                if(sli && dir2 === "right") { clearInterval(sli); sli = false; }
                                if(!sli) { dir2 = "left"; sli = setInterval(function () { $(document).scrollLeft($(document).scrollLeft() - $.vakata.dnd.scroll_spd); }, 150); }
                            }
                            else { 
            plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 2227..2233

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

            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

                            if(e.pageY - t < 20) { 
                                if(sti && dir1 === "down") { clearInterval(sti); sti = false; }
                                if(!sti) { dir1 = "up"; sti = setInterval(function () { $(document).scrollTop($(document).scrollTop() - $.vakata.dnd.scroll_spd); }, 150); }
                            }
                            else { 
            plugins/display_content/public/javascripts/jstree-v.pre1.0/jquery.jstree.js on lines 2242..2248

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

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

                var eCalendar = function (options, object) {
                    // Initializing global variables
                    var adDay = new Date().getDate();
                    var adMonth = new Date().getMonth();
                    var adYear = new Date().getFullYear();
            Severity: Major
            Found in plugins/event/public/jquery.e-calendar.js - About 6 hrs to fix

              File plugin.rb has 418 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require_relative "plugin/macro"
              require_relative "plugin/hot_spot"
              require_relative "plugin/manager"
              require_relative "plugin/parent_methods"
              require_relative "plugin/settings"
              Severity: Minor
              Found in lib/noosfero/plugin.rb - About 6 hrs to fix

                Class Block has 44 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Block < ApplicationRecord
                  attr_accessible :title, :subtitle, :display, :limit, :box_id, :posts_per_page,
                                  :visualization_format, :language, :display_user, :position,
                                  :box, :edit_modes, :move_modes, :mirror, :visualization, :images_builder, :api_content,
                                  :css
                Severity: Minor
                Found in app/models/block.rb - About 6 hrs to fix

                  Function support has 143 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  jQuery.support = (function() {
                  
                      var support,
                          all,
                          a,

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

                      Cart.prototype.show = function(register) {
                        if(register) {
                          this.ajax({
                            url: '/plugin/shopping_cart/show',
                            dataType: 'json',
                    Severity: Major
                    Found in plugins/shopping_cart/public/cart.js and 1 other location - About 5 hrs to fix
                    plugins/shopping_cart/public/cart.js on lines 256..271

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

                    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