discourse/discourse

View on GitHub

Showing 2,973 of 3,784 total issues

Function newline has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function newline(state, silent) {
  var token,
    pmax,
    max,
    pos = state.pos;

    Function initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      initialize(container) {
        if (this.isVerboseLocalizationEnabled(container)) {
          I18n.enableVerboseLocalization();
        }
    
    
    Severity: Minor
    Found in app/assets/javascripts/discourse/app/initializers/localization.js - About 1 hr to fix

      Function collapseStream has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        collapseStream(stream) {
          const uniq = {};
          const collapsed = [];
          let pos = 0;
      
      
      Severity: Minor
      Found in app/assets/javascripts/discourse/app/models/user-action.js - About 1 hr to fix

        Function action has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              action() {
                const panels = [
                  {
                    id: "share",
                    title: "topic.share.extended_title",

          Function initialize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            initialize(container) {
              withPluginApi("0.1", api => {
                const siteSettings = container.lookup("site-settings:main");
                api.decorateCooked(highlightSyntax, {
                  id: "discourse-syntax-highlighting"

            Function _loadCachedShortUrls has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function _loadCachedShortUrls(uploadElements, siteSettings) {
              uploadElements.forEach(upload => {
                switch (upload.tagName) {
                  case "A":
                    retrieveCachedUrl(upload, siteSettings, "orig-href", url => {
            Severity: Minor
            Found in app/assets/javascripts/pretty-text/addon/upload-short-url.js - About 1 hr to fix

              Function triggerNewPostInStream has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                triggerNewPostInStream(postId) {
                  const resolved = Promise.resolve();
              
                  if (!postId) {
                    return resolved;
              Severity: Minor
              Found in app/assets/javascripts/discourse/app/models/post-stream.js - About 1 hr to fix

                Function createAccount has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      createAccount() {
                        this.clearFlash();
                
                        const validation = [
                          this.emailValidation,
                Severity: Minor
                Found in app/assets/javascripts/discourse/app/controllers/create-account.js - About 1 hr to fix

                  Function editPost has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      editPost(post) {
                        if (!this.currentUser) {
                          return bootbox.alert(I18n.t("post.controls.edit_anonymous"));
                        } else if (!post.can_edit) {
                          return false;
                  Severity: Minor
                  Found in app/assets/javascripts/discourse/app/controllers/topic.js - About 1 hr to fix

                    Function markdownOptions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      markdownOptions() {
                        return {
                          previewing: true,
                    
                          formatUsername,
                    Severity: Minor
                    Found in app/assets/javascripts/discourse/app/components/composer-editor.js - About 1 hr to fix

                      Function dockCheck has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        dockCheck(info) {
                          const mainOffset = $("#main").offset();
                          const offsetTop = mainOffset ? mainOffset.top : 0;
                          const topicTop = $(".container.posts").offset().top - offsetTop;
                          const topicBottom =
                      Severity: Minor
                      Found in app/assets/javascripts/discourse/app/components/topic-timeline.js - About 1 hr to fix

                        Function addSynonyms has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            addSynonyms() {
                              bootbox.confirm(
                                I18n.t("tagging.add_synonyms_explanation", {
                                  count: this.newSynonyms.length,
                                  tag_name: this.tagInfo.name
                        Severity: Minor
                        Found in app/assets/javascripts/discourse/app/components/tag-info.js - About 1 hr to fix

                          Function autoUpdatingRelativeAge has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function autoUpdatingRelativeAge(date, options) {
                            if (!date) return "";
                            if (+date === +new Date(0)) return "";
                          
                            options = options || {};
                          Severity: Minor
                          Found in app/assets/javascripts/discourse/app/lib/formatter.js - About 1 hr to fix

                            Function tick has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              tick() {
                                const now = Date.now();
                            
                                // If the user hasn't scrolled the browser in a long time, stop tracking time read
                                const sinceScrolled = now - this._lastScrolled;
                            Severity: Minor
                            Found in app/assets/javascripts/discourse/app/lib/screen-track.js - About 1 hr to fix

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

                                html(c) {
                                  if (c.parent_category_id) {
                                    this.tagName += ".subcategory";
                                  }
                              
                              

                                Function constructor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  constructor(attrs, register, opts) {
                                    opts = opts || {};
                                    this.attrs = attrs || {};
                                    this.mergeState = opts.state;
                                    this.model = opts.model;
                                Severity: Minor
                                Found in app/assets/javascripts/discourse/app/widgets/widget.js - About 1 hr to fix

                                  Method poll_pop3 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      def poll_pop3
                                        pop3 = Net::POP3.new(SiteSetting.pop3_polling_host, SiteSetting.pop3_polling_port)
                                  
                                        if SiteSetting.pop3_polling_ssl
                                          if SiteSetting.pop3_polling_openssl_verify
                                  Severity: Minor
                                  Found in app/jobs/scheduled/poll_mailbox.rb - About 1 hr to fix

                                    Method execute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        def execute(args)
                                          if SiteSetting.default_trust_level < 3
                                            # Demotions
                                            demoted_user_ids = []
                                            User.real
                                    Severity: Minor
                                    Found in app/jobs/scheduled/tl3_promotions.rb - About 1 hr to fix

                                      Method change has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        def change
                                          create_table :polls do |t|
                                            t.references :post, index: true, foreign_key: true
                                            t.string :name, null: false, default: "poll"
                                            t.datetime :close_at
                                      Severity: Minor
                                      Found in plugins/poll/db/migrate/20180820073549_create_polls_tables.rb - About 1 hr to fix

                                        Method publish_new has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          def self.publish_new(topic)
                                            return unless topic.regular?
                                        
                                            tags, tag_ids = nil
                                            if SiteSetting.tagging_enabled
                                        Severity: Minor
                                        Found in app/models/topic_tracking_state.rb - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language