Noosfero/noosfero

View on GitHub

Showing 1,031 of 1,643 total issues

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

    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

        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,

                Method acts_as_faceted has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def acts_as_faceted(options)
                      extend ClassMethods
                      extend ActsAsSolr::CommonMethods
                
                      cattr_accessor :facets
                Severity: Major
                Found in plugins/solr/lib/acts_as_faceted.rb - About 5 hrs to fix

                  Method extended has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def self.extended(base)
                        if base.respond_to?(:scope)
                          if base.attribute_names.include?("created_at")
                            base.class_eval do
                              scope :younger_than, lambda { |created_at|
                  Severity: Minor
                  Found in app/models/concerns/time_scopes.rb - About 5 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

                  Class CmsController has 40 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class CmsController < MyProfileController
                    protect "edit_profile", :profile, only: [:set_home_page]
                  
                    include ArticleHelper
                    include CategoriesHelper
                  Severity: Minor
                  Found in app/controllers/my_profile/cms_controller.rb - About 5 hrs to fix

                    File user.rb has 387 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require "digest/sha1"
                    require "securerandom"
                    
                    # User models the system users, and is generated by the acts_as_authenticated
                    # Rails generator.
                    Severity: Minor
                    Found in app/models/user.rb - About 5 hrs to fix

                      File infobox.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /**
                       * @name InfoBox
                       * @version 1.1.9 [October 2, 2011]
                       * @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)
                       * @copyright Copyright 2010 Gary Little [gary at luxcentral.com]
                      Severity: Minor
                      Found in plugins/sniffer/public/javascripts/infobox.js - About 5 hrs to fix

                        Method dispatch_publications has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def dispatch_publications
                            print_debug "open_graph: dispatch_publications of #{story}" if debug? self.actor
                        
                            return unless self.match_criteria?
                        
                        
                        Severity: Minor
                        Found in plugins/open_graph/models/open_graph_plugin/activity.rb - About 5 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 Callbacks has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        jQuery.Callbacks = function( options ) {
                        
                            // Convert options from String-formatted to Object-formatted if needed
                            // (we check in cache first)
                            options = typeof options === "string" ?

                          Method _move has 127 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function _move($id, $ref_id, $position = 0, $is_copy = false) {
                                  if((int)$ref_id === 0 || (int)$id === 1) { return false; }
                                  $sql        = array();                        // Queries executed at the end
                                  $node        = $this->_get_node($id);        // Node data
                                  $nchildren    = $this->_get_children($id);    // Node children

                            Consider simplifying this complex logical expression.
                            Open

                                        if ( event.pageX == null && original.clientX != null ) {
                                            eventDoc = event.target.ownerDocument || document;
                                            doc = eventDoc.documentElement;
                                            body = eventDoc.body;
                            
                            

                              Function load_node_xml has 122 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                          load_node_xml : function (obj, s_call, e_call) {
                                              var s = this.get_settings().xml_data,
                                                  error_func = function () {},
                                                  success_func = function () {};
                              
                              

                                Class Product has 37 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                class ProductsPlugin::Product < ApplicationRecord
                                  ##
                                  # Keep compatibility with previous core name
                                  #
                                  def self.sti_name
                                Severity: Minor
                                Found in plugins/products/models/products_plugin/product.rb - About 4 hrs to fix

                                  File profile_editor_helper.rb has 365 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  module ProfileEditorHelper
                                    NATIONALITY = [
                                      N_("Afghan"),
                                      N_("Albanian"),
                                      N_("Algerian"),
                                  Severity: Minor
                                  Found in app/helpers/profile_editor_helper.rb - About 4 hrs to fix

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

                                      def edit
                                        return show_more if params[:page].present?
                                    
                                        if request.xhr? && params[:order].present?
                                          status = params[:order][:status]

                                    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

                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language