discourse/discourse

View on GitHub

Showing 2,996 of 3,817 total issues

Function footerLinks has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  footerLinks(prioritizeFaq, faqUrl) {
    const links = [];
    if (this.settings.showAbout) {
      links.push({
        route: "about",
Severity: Minor
Found in app/assets/javascripts/discourse/app/widgets/hamburger-menu.js - About 1 hr to fix

    Function toggleSearchMenu has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      toggleSearchMenu() {
        if (this.site.mobileView) {
          const searchService = this.register.lookup("search-service:main");
          const context = searchService.get("searchContext");
          var params = "";
    Severity: Minor
    Found in app/assets/javascripts/discourse/app/widgets/header.js - About 1 hr to fix

      Method select has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def select
            data = Store.get(@user.id)
      
            if @post && @post.post_type == Post.types[:regular] && !is_topic_action?
              is_reply = @input == :reply

        Method recalculate_score has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def recalculate_score
            # pending/agreed scores count
            sql = <<~SQL
              UPDATE reviewables
              SET score = COALESCE((
        Severity: Minor
        Found in app/models/reviewable.rb - About 1 hr to fix

          Method ensure_baked! has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def ensure_baked!
              needs_baking = !self.value_baked || compiler_version != Theme.compiler_version
              return unless needs_baking
          
              if basic_html_field? || translation_field?
          Severity: Minor
          Found in app/models/theme_field.rb - About 1 hr to fix

            Method diff has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def diff
                @history = UserHistory.find(params[:id])
                prev = @history.previous_value
                cur = @history.new_value
            
            
            Severity: Minor
            Found in app/controllers/admin/staff_action_logs_controller.rb - About 1 hr to fix

              Method comments has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def comments
                  embed_url = params[:embed_url]
                  embed_username = params[:discourse_username]
              
                  topic_id = nil
              Severity: Minor
              Found in app/controllers/embed_controller.rb - About 1 hr to fix

                Method index has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def index
                    @description_meta = I18n.t("tags.title")
                    @title = @description_meta
                
                    show_all_tags = guardian.can_admin_tags? && guardian.is_admin?
                Severity: Minor
                Found in app/controllers/tags_controller.rb - About 1 hr to fix

                  Method sent has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def sent
                      email_logs = EmailLog.joins(<<~SQL)
                        LEFT JOIN post_reply_keys
                        ON post_reply_keys.post_id = email_logs.post_id
                        AND post_reply_keys.user_id = email_logs.user_id
                  Severity: Minor
                  Found in app/controllers/admin/email_controller.rb - About 1 hr to fix

                    Method is_local_username has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def is_local_username
                        usernames = params[:usernames] if params[:usernames].present?
                        usernames = [params[:username]] if params[:username].present?
                    
                        raise Discourse::InvalidParameters.new(:usernames) if !usernames.kind_of?(Array)
                    Severity: Minor
                    Found in app/controllers/users_controller.rb - About 1 hr to fix

                      Method user_found has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def user_found(user)
                          if user.has_any_second_factor_methods_enabled?
                            @auth_result.omniauth_disallow_totp = true
                            @auth_result.email = user.email
                            return
                      Severity: Minor
                      Found in app/controllers/users/omniauth_callbacks_controller.rb - About 1 hr to fix

                        Method timer has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def timer
                            params.permit(:time, :based_on_last_post, :category_id)
                            params.require(:status_type)
                        
                            status_type =
                        Severity: Minor
                        Found in app/controllers/topics_controller.rb - About 1 hr to fix

                          Method queue_specs has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def queue_specs(specs)
                              puts "@@@@@@@@@@@@ queue_specs --> #{specs}" if @debug
                          
                              if specs.length == 0
                                locked = @mutex.try_lock
                          Severity: Minor
                          Found in lib/autospec/manager.rb - About 1 hr to fix

                            Method default_handler has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def self.default_handler(manager)
                            
                                reason = post_needs_approval?(manager)
                                return if reason == :skip
                            
                            
                            Severity: Minor
                            Found in lib/new_post_manager.rb - About 1 hr to fix

                              Method update_lifecycle has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def update_lifecycle(id, days, prefix: nil, tag: nil)
                                  filter = {}
                              
                                  if prefix
                                    filter[:prefix] = prefix
                              Severity: Minor
                              Found in lib/s3_helper.rb - About 1 hr to fix

                                Method can_edit_post? has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def can_edit_post?(post)
                                    if Discourse.static_doc_topic_ids.include?(post.topic_id) && !is_admin?
                                      return false
                                    end
                                
                                
                                Severity: Minor
                                Found in lib/guardian/post_guardian.rb - About 1 hr to fix

                                  Method side_by_side_html has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def side_by_side_html
                                      i = 0
                                      left, right = [], []
                                      while i < @block_by_block_diff.size
                                        op_code = @block_by_block_diff[i][1]
                                  Severity: Minor
                                  Found in lib/discourse_diff.rb - About 1 hr to fix

                                    Method warn has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def self.warn(message, env = nil)
                                        append = env ? (+" ") << env.map { |k, v|"#{k}: #{v}" }.join(" ") : ""
                                    
                                        if !(Logster::Logger === Rails.logger)
                                          Rails.logger.warn("#{message}#{append}")
                                    Severity: Minor
                                    Found in lib/discourse.rb - About 1 hr to fix

                                      Method create has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        def create
                                          if valid?
                                            transaction do
                                              build_post_stats
                                              create_topic
                                      Severity: Minor
                                      Found in lib/post_creator.rb - About 1 hr to fix

                                        Consider simplifying this complex logical expression.
                                        Open

                                            if (
                                              !this.isEditing &&
                                              ((this.action !== REPLY && _topicSnapshot) ||
                                                (this.action === REPLY &&
                                                  _topicSnapshot &&
                                        Severity: Critical
                                        Found in app/assets/javascripts/select-kit/addon/components/composer-actions.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language