Noosfero/noosfero

View on GitHub

Showing 1,031 of 1,643 total issues

Method _reconstruct has 118 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function _reconstruct() {
        $this->db->query("" . 
            "CREATE TEMPORARY TABLE `temp_tree` (" . 
                "`".$this->fields["id"]."` INTEGER NOT NULL, " . 
                "`".$this->fields["parent_id"]."` INTEGER NOT NULL, " . 

    File entities.rb has 363 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Api
      module Entities
        PERMISSIONS = {
          admin: 0,
          self: 10,
    Severity: Minor
    Found in app/api/entities.rb - About 4 hrs to fix

      Function pjax has 117 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function pjax(options) {
        options = $.extend(true, {}, $.ajaxSettings, pjax.defaults, options)
      
        if ($.isFunction(options.url)) {
          options.url = options.url()
      Severity: Major
      Found in plugins/pjax/public/javascripts/jquery.pjax.js - About 4 hrs to fix

        Class PgSearchPlugin has 36 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class PgSearchPlugin < Noosfero::Plugin
          include SearchHelper
        
          def self.plugin_name
            "Postgres Full-Text Search"
        Severity: Minor
        Found in plugins/pg_search/lib/pg_search_plugin.rb - About 4 hrs to fix

          Function load_node_html has 116 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      load_node_html : function (obj, s_call, e_call) {
                          var d,
                              s = this.get_settings().html_data,
                              error_func = function () {},
                              success_func = function () {};

            Class Order has 35 methods (exceeds 20 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 4 hrs to fix

              Class Comment has 35 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Comment < ApplicationRecord
                include Notifiable
              
                SEARCHABLE_FIELDS = {
                  title: { label: _("Title"), weight: 10 },
              Severity: Minor
              Found in app/models/comment.rb - About 4 hrs to fix

                Class Theme has 35 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Theme
                  class << self
                    def system_themes
                      Dir.glob(File.join(system_themes_dir, "*")).map do |path|
                        config_file = File.join(path, "theme.yml")
                Severity: Minor
                Found in app/models/theme.rb - About 4 hrs to fix

                  Class AccountController has 35 methods (exceeds 20 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 4 hrs to fix

                    Function Tokenfield has 110 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      var Tokenfield = function (element, options) {
                        var _self = this
                    
                        this.$element = $(element)
                        this.textDirection = this.$element.css('direction');
                    Severity: Major
                    Found in plugins/fb_app/public/javascripts/bootstrap-tokenfield.js - About 4 hrs to fix

                      Class Cycle has 34 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class OrdersCyclePlugin::Cycle < ApplicationRecord
                        attr_accessible :profile, :status, :name, :description, :opening_message
                      
                        attr_accessible :start, :finish, :delivery_start, :delivery_finish
                        attr_accessible :start_date, :start_time, :finish_date, :finish_time, :delivery_start_date, :delivery_start_time, :delivery_finish_date, :delivery_finish_time,
                      Severity: Minor
                      Found in plugins/orders_cycle/models/orders_cycle_plugin/cycle.rb - About 4 hrs to fix

                        File sniffer.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        sniffer = {
                        
                          search: {
                        
                            filters: { __categoryIds: [], distance: 0, circle: undefined, homePosition: undefined },
                        Severity: Minor
                        Found in plugins/sniffer/public/javascripts/sniffer.js - About 4 hrs to fix

                          Function load_node_json has 108 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                      load_node_json : function (obj, s_call, e_call) {
                                          var s = this.get_settings().json_data, d,
                                              error_func = function () {},
                                              success_func = function () {};
                                          obj = this._get_node(obj);

                            Function cookie has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                            jQuery.cookie = function(name, value, options) {
                                if (typeof value != 'undefined') { // name and value given, set cookie
                                    options = options || {};
                                    if (value === null) {
                                        value = '';

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

                                def report_orders_by_consumer(orders)
                                  p = Axlsx::Package.new
                                  wb = p.workbook
                            
                                  # create styles
                            Severity: Minor
                            Found in plugins/orders/lib/orders_plugin/report.rb - About 4 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 vote_partial has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def vote_partial(target, like = true, load_voters = false)
                                vote = like ? 1 : -1
                            
                                like_action = like ? "like" : "dislike"
                                type = target.kind_of?(Article) ? "article" : target.kind_of?(Comment) ? "comment" : nil
                            Severity: Minor
                            Found in plugins/vote/lib/vote_plugin_helper.rb - About 4 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 invite has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def self.invite(person, contacts_to_invite, message, profile)
                                contacts_to_invite.each do |contact_to_invite|
                                  next if contact_to_invite == _("Firstname Lastname <friend@email.com>")
                            
                                  contact_to_invite = contact_to_invite.to_s.strip
                            Severity: Minor
                            Found in app/models/invitation.rb - About 4 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 extra_blocks has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def extra_blocks(params = {})
                                return [] if self.class.extra_blocks.nil?
                            
                                blocks = self.class.extra_blocks.map do |block, options|
                                  type = options[:type]
                            Severity: Minor
                            Found in lib/noosfero/plugin.rb - About 4 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 date_field has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def date_field(name, value, datepicker_options = {}, html_options = {})
                                datepicker_options[:disabled] ||= false
                                datepicker_options[:alt_field] ||= ""
                                datepicker_options[:alt_format] ||= ""
                                datepicker_options[:append_text] ||= ""
                            Severity: Major
                            Found in app/helpers/forms_helper.rb - About 4 hrs to fix

                              File shopping_cart_plugin_controller.rb has 334 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require "base64"
                              
                              class ShoppingCartPluginController < OrdersPluginController
                                include ShoppingCartPlugin::CartHelper
                                helper ShoppingCartPlugin::CartHelper
                              Severity: Minor
                              Found in plugins/shopping_cart/controllers/shopping_cart_plugin_controller.rb - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language