discourse/discourse

View on GitHub

Showing 230 of 1,632 total issues

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

class User < ActiveRecord::Base
  include Searchable
  include Roleable
  include HasCustomFields
  include SecondFactorManager
Severity: Major
Found in app/models/user.rb - About 3 days to fix

    File topic.rb has 1136 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_dependency 'slug'
    require_dependency 'avatar_lookup'
    require_dependency 'topic_view'
    require_dependency 'rate_limiter'
    require_dependency 'text_sentinel'
    Severity: Major
    Found in app/models/topic.rb - About 2 days to fix

      File report.rb has 1098 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require_dependency 'topic_subtype'
      
      class Report
        # Change this line each time report format change
        # and you want to ensure cache is reset
      Severity: Major
      Found in app/models/report.rb - About 2 days to fix

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

        require_dependency 'jobs/base'
        require_dependency 'email'
        require_dependency 'email_token'
        require_dependency 'email_validator'
        require_dependency 'trust_level'
        Severity: Major
        Found in app/models/user.rb - About 2 days to fix

          File users_controller.rb has 978 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require_dependency 'discourse_hub'
          require_dependency 'user_name_suggester'
          require_dependency 'rate_limiter'
          require_dependency 'wizard'
          require_dependency 'wizard/builder'
          Severity: Major
          Found in app/controllers/users_controller.rb - About 2 days to fix

            File receiver.rb has 856 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "digest"
            require_dependency "new_post_manager"
            require_dependency "post_action_creator"
            require_dependency "html_to_markdown"
            require_dependency "plain_text_to_markdown"
            Severity: Major
            Found in lib/email/receiver.rb - About 2 days to fix

              Class Topic has 104 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Topic < ActiveRecord::Base
                # TODO remove 01-01-2019
                self.ignored_columns = ["percent_rank", "vote_count"]
              
                class UserExists < StandardError; end
              Severity: Major
              Found in app/models/topic.rb - About 2 days to fix

                File topic_query.rb has 791 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require_dependency 'topic_list'
                require_dependency 'suggested_topics_builder'
                require_dependency 'topic_query_sql'
                require_dependency 'avatar_lookup'
                
                
                Severity: Major
                Found in lib/topic_query.rb - About 1 day to fix

                  File search.rb has 736 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require_dependency 'search/grouped_search_results'
                  
                  class Search
                    INDEX_VERSION = 2.freeze
                    DIACRITICS ||= /([\u0300-\u036f]|[\u1AB0-\u1AFF]|[\u1DC0-\u1DFF]|[\u20D0-\u20FF])/
                  Severity: Major
                  Found in lib/search.rb - About 1 day to fix

                    File new_user_narrative_spec.rb has 729 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'rails_helper'
                    
                    describe DiscourseNarrativeBot::NewUserNarrative do
                      let!(:welcome_topic) { Fabricate(:topic, title: 'Welcome to Discourse') }
                      let(:discobot_user) { User.find(-2) }

                      File topics_controller.rb has 706 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require_dependency 'topic_view'
                      require_dependency 'promotion'
                      require_dependency 'url_helper'
                      require_dependency 'topics_bulk_action'
                      require_dependency 'discourse_event'
                      Severity: Major
                      Found in app/controllers/topics_controller.rb - About 1 day to fix

                        File routes.rb has 693 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require "sidekiq/web"
                        require "mini_scheduler/web"
                        require_dependency "admin_constraint"
                        require_dependency "staff_constraint"
                        require_dependency "homepage_constraint"
                        Severity: Major
                        Found in config/routes.rb - About 1 day to fix

                          File post.rb has 659 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          require_dependency 'pretty_text'
                          require_dependency 'rate_limiter'
                          require_dependency 'post_revisor'
                          require_dependency 'enum'
                          require_dependency 'post_analyzer'
                          Severity: Major
                          Found in app/models/post.rb - About 1 day to fix

                            Class UserSerializer has 76 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class UserSerializer < BasicUserSerializer
                            
                              attr_accessor :omit_stats,
                                            :topic_post_count
                            
                            
                            Severity: Major
                            Found in app/serializers/user_serializer.rb - About 1 day to fix

                              Class Post has 74 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Post < ActiveRecord::Base
                                # TODO: Remove this after 19th Dec 2018
                                self.ignored_columns = %w{vote_count}
                              
                                include RateLimiter::OnCreateRecord
                              Severity: Major
                              Found in app/models/post.rb - About 1 day to fix

                                Class Receiver has 74 methods (exceeds 20 allowed). Consider refactoring.
                                Open

                                  class Receiver
                                    include ActionView::Helpers::NumberHelper
                                
                                    # If you add a new error, you need to
                                    #   * add it to Email::Processor#handle_failure()
                                Severity: Major
                                Found in lib/email/receiver.rb - About 1 day to fix

                                  File group.rb has 581 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  require_dependency 'enum'
                                  
                                  class Group < ActiveRecord::Base
                                    include HasCustomFields
                                    include AnonCacheInvalidator
                                  Severity: Major
                                  Found in app/models/group.rb - About 1 day to fix

                                    File posts_controller.rb has 580 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    require_dependency 'new_post_manager'
                                    require_dependency 'post_creator'
                                    require_dependency 'post_destroyer'
                                    require_dependency 'post_merger'
                                    require_dependency 'distributed_memoizer'
                                    Severity: Major
                                    Found in app/controllers/posts_controller.rb - About 1 day to fix

                                      File application_controller.rb has 578 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      require 'current_user'
                                      require_dependency 'canonical_url'
                                      require_dependency 'discourse'
                                      require_dependency 'custom_renderer'
                                      require_dependency 'archetype'
                                      Severity: Major
                                      Found in app/controllers/application_controller.rb - About 1 day to fix

                                        File track_selector_spec.rb has 570 lines of code (exceeds 250 allowed). Consider refactoring.
                                        Open

                                        require 'rails_helper'
                                        
                                        describe DiscourseNarrativeBot::TrackSelector do
                                          let(:user) { Fabricate(:user) }
                                          let(:discobot_user) { User.find(-2) }
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language