discourse/discourse

View on GitHub

Showing 1,782 of 2,040 total issues

Consider simplifying this complex logical expression.
Open

  if ((n % 10) === 0 || ((n % 10) >= 5 && (n % 10) <= 9) ||
      ((n % 100) >= 11 && (n % 100) <= 14) && n == Math.floor(n)) {
    // return 'many';
    return 'other'; // TODO should be "many" but is not defined in translations
  }
Severity: Major
Found in lib/javascripts/locale/uk.js - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

      if ((n % 10) === 0 || ((n % 10) >= 5 && (n % 10) <= 9) ||
          ((n % 100) >= 11 && (n % 100) <= 14) && n == Math.floor(n)) {
        return 'many';
      }
    Severity: Major
    Found in lib/javascripts/locale/hr.js - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

          if user_token.auth_token != token && user_token.prev_auth_token == token && user_token.auth_token_seen
            changed_rows = UserAuthToken
              .where("rotated_at < ?", 1.minute.ago)
              .where(id: user_token.id, prev_auth_token: token)
              .update_all(auth_token_seen: false)
      Severity: Major
      Found in app/models/user_auth_token.rb - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

            if title_changed? && !new_record? && user_profile
              badge_matching_title = title && badges.find do |badge|
                badge.allow_title? && (badge.display_name == title || badge.name == title)
              end
              user_profile.update(
        Severity: Major
        Found in app/models/user.rb - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                elsif !(node.children.count == 1 && (node.children[0].name != "img" && node.children[0].children.blank?)) &&
                  !(node.name == "a" && node.children.count > 1 && !node_children_names(node).include?("img"))
                  next
          Severity: Major
          Found in app/services/inline_uploads.rb - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                  if (saved = (!save_options || user.user_option.save) && user_profile.save && user.save) &&
                     (name_changed && old_user_name.casecmp(attributes.fetch(:name)) != 0)
            
                    StaffActionLogger.new(@actor).log_name_change(
                      user.id,
            Severity: Major
            Found in app/services/user_updater.rb - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                  if ((status.enabled? && (status.autoclosed? || status.closed? || status.archived?)) ||
                      (status.disabled? && status.visible?))
                    CategoryFeaturedTopic.where(topic_id: topic.id).delete_all
                  end
              Severity: Major
              Found in app/services/topic_status_updater.rb - About 40 mins to fix

                Consider simplifying this complex logical expression.
                Open

                    if (
                      SiteSetting.staff_edit_locks_post? &&
                      !@post.wiki? &&
                      @fields.has_key?('raw') &&
                      @editor.staff? &&
                Severity: Major
                Found in lib/post_revisor.rb - About 40 mins to fix

                  Function SyntaxError has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      result.SyntaxError = function(expected, found, offset, line, column) {
                  Severity: Minor
                  Found in lib/javascripts/messageformat.js - About 35 mins to fix

                    Method set has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      def self.set(user, key, sequence, data, owner = nil, retry_not_unique: true)
                    Severity: Minor
                    Found in app/models/draft.rb - About 35 mins to fix

                      Method toggle_status has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                            def toggle_status(post_id, poll_name, status, user, raise_errors = true)
                      Severity: Minor
                      Found in plugins/poll/plugin.rb - About 35 mins to fix

                        Method message_for_email has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def message_for_email(user, post, type, notification, args = nil)
                        Severity: Minor
                        Found in app/jobs/regular/user_email.rb - About 35 mins to fix

                          Method bulk_perform_targets has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            def self.bulk_perform_targets(performed_by, action, type, target_ids, args = nil)
                          Severity: Minor
                          Found in app/models/reviewable.rb - About 35 mins to fix

                            Method add has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              def self.add(user_profile_id, ip, user_id = nil, at = nil, skip_redis = false)
                            Severity: Minor
                            Found in app/models/user_profile_view.rb - About 35 mins to fix

                              Method update_topic_list_read_indicator has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                def self.update_topic_list_read_indicator(topic, groups, last_read_post_number, user_id, write_event)
                              Severity: Minor
                              Found in app/models/topic_tracking_state.rb - About 35 mins to fix

                                Method add has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  def self.add(topic_id, ip, user_id = nil, at = nil, skip_redis = false)
                                Severity: Minor
                                Found in app/models/topic_view_item.rb - About 35 mins to fix

                                  Method invite_by_email has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    def self.invite_by_email(email, invited_by, topic = nil, group_ids = nil, custom_message = nil)
                                  Severity: Minor
                                  Found in app/models/invite.rb - About 35 mins to fix

                                    Method resize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                      def self.resize(from, to, width, height, opts = {})
                                    Severity: Minor
                                    Found in app/models/optimized_image.rb - About 35 mins to fix

                                      Method process_timings has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                        def self.process_timings(current_user, topic_id, topic_time, timings, opts = {})
                                      Severity: Minor
                                      Found in app/models/post_timing.rb - About 35 mins to fix

                                        Method optimize has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                          def self.optimize(operation, from, to, dimensions, opts = {})
                                        Severity: Minor
                                        Found in app/models/optimized_image.rb - About 35 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language