discourse/discourse

View on GitHub

Showing 2,996 of 3,817 total issues

Consider simplifying this complex logical expression.
Open

    if (
      this.action === REPLY &&
      this.topic &&
      this.topic.isPrivateMessage &&
      this.topic.details &&
Severity: Critical
Found in app/assets/javascripts/select-kit/addon/components/composer-actions.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

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

      Consider simplifying this complex logical expression.
      Open

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

        Function logger has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const logger = (() => {
            let inGroup = false;
            const methodToColorMap = {
              debug: `#7f8c8d`,
              // Gray
        Severity: Minor
        Found in public/javascripts/workbox/workbox-core.dev.js - About 1 hr to fix

          Function _initialize has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _initialize() {
              this.resumable = new Resumable({
                target: getURL(this.target),
                maxFiles: 1, // only 1 file at a time
                headers: {
          Severity: Minor
          Found in app/assets/javascripts/admin/components/resumable-upload.js - About 1 hr to fix

            Function select has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              select(value, item) {
                if (!isPresent(value)) {
                  if (!this.validateSelect(this.selectKit.highlighted)) {
                    return;
                  }
            Severity: Minor
            Found in app/assets/javascripts/select-kit/addon/components/multi-select.js - About 1 hr to fix

              Function textPostProcess has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function textPostProcess(content, state, ruler) {
                let result = null;
                let match;
                let pos = 0;
              
              

                Function lookup has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                I18n.lookup = function(scope, options) {
                  options = options || {};
                
                  var translations = this.prepareOptions(I18n.translations),
                    locale = options.locale || I18n.currentLocale(),
                Severity: Minor
                Found in app/assets/javascripts/locales/i18n.js - About 1 hr to fix

                  Function appendMore has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    appendMore() {
                      // Make sure we can append more posts
                      if (!this.canAppendMore) {
                        return Promise.resolve();
                      }
                  Severity: Minor
                  Found in app/assets/javascripts/discourse/app/models/post-stream.js - About 1 hr to fix

                    Function init has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      init() {
                        this._super(...arguments);
                    
                        this.saveAttrNames = [
                          "email_level",

                      Function loadMore has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        loadMore() {
                          if (this.loadingMore) {
                            return Promise.resolve();
                          }
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/discourse/app/models/topic-list.js - About 1 hr to fix

                        Function delete has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            delete() {
                              this.set("deleting", true);
                              const message = I18n.t("user.delete_account_confirm"),
                                model = this.model,
                                buttons = [

                          Function _findSimilar has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            _findSimilar() {
                              const composer = this.composer;
                          
                              // We don't care about similar topics unless creating a topic
                              if (!composer.get("creatingTopic")) {

                            Function _bindEmojiClick has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _bindEmojiClick($emojisContainer) {
                                const handler = event => {
                                  const code = this._codeForEmojiButton($(event.currentTarget));
                            
                                  if (
                            Severity: Minor
                            Found in app/assets/javascripts/discourse/app/components/emoji-picker.js - About 1 hr to fix

                              Function _processQueue has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                _processQueue() {
                                  if (_queue.length === 0) return;
                                  if (_processing >= MAX_CONCURRENCY) return;
                              
                                  _processing++;
                              Severity: Minor
                              Found in app/assets/javascripts/discourse/app/lib/reports-loader.js - About 1 hr to fix

                                Function logo has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  logo() {
                                    const { siteSettings } = this;
                                    const mobileView = this.site.mobileView;
                                
                                    const mobileLogoUrl = this.mobileLogoUrl();
                                Severity: Minor
                                Found in app/assets/javascripts/discourse/app/widgets/home-logo.js - About 1 hr to fix

                                  Function html has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    html(attrs, state) {
                                      if (!this.attrs.links || this.attrs.links.length === 0) {
                                        // shortcut all work
                                        return;
                                      }
                                  Severity: Minor
                                  Found in app/assets/javascripts/discourse/app/widgets/post-links.js - About 1 hr to fix

                                    Function html has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      html(attrs) {
                                        const buttons = [];
                                    
                                        if (!attrs.selected && attrs.post_number > 1) {
                                          if (attrs.replyCount > 0) {
                                    Severity: Minor
                                    Found in app/assets/javascripts/discourse/app/widgets/post.js - About 1 hr to fix

                                      Function html has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        html(attrs, state) {
                                          let result = [
                                            new PostCooked(attrs, new DecoratorHelper(this), this.currentUser)
                                          ];
                                      
                                      
                                      Severity: Minor
                                      Found in app/assets/javascripts/discourse/app/widgets/post.js - About 1 hr to fix

                                        Method say_hello has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            def say_hello
                                              raw = I18n.t(
                                                "#{I18N_KEY}.hello.message",
                                                i18n_post_args(
                                                  username: @user.username,
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language