discourse/discourse

View on GitHub

Showing 3,892 of 3,892 total issues

File data.js has 4551 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// DO NOT EDIT THIS FILE!!!
// Update it by running `rake javascript:update_constants`

export const emojis = [
  "grinning",
Severity: Major
Found in app/assets/javascripts/pretty-text/addon/emoji/data.js - About 1 wk to fix

    Function mparser has 1196 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var mparser = (function(){
        /*
         * Generated by PEG.js 0.7.0.
         *
         * http://pegjs.majda.cz/
    Severity: Major
    Found in lib/javascripts/messageformat.js - About 5 days to fix

      Function parse has 1151 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            parse: function(input, startRule) {
              var parseFunctions = {
                "start": parse_start,
                "messageFormatPattern": parse_messageFormatPattern,
                "messageFormatPatternRight": parse_messageFormatPatternRight,
      Severity: Major
      Found in lib/javascripts/messageformat.js - About 5 days to fix

        Function core has 1025 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        this.workbox.core = (function (exports) {
          'use strict';
        
          try {
            self['workbox:core:4.3.1'] && _();
        Severity: Major
        Found in public/javascripts/workbox/workbox-core.dev.js - About 5 days to fix

          Function core has a Cognitive Complexity of 214 (exceeds 5 allowed). Consider refactoring.
          Open

          this.workbox.core = (function (exports) {
            'use strict';
          
            try {
              self['workbox:core:4.3.1'] && _();
          Severity: Minor
          Found in public/javascripts/workbox/workbox-core.dev.js - About 4 days to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          File messageformat.js has 1412 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * messageformat.js
           *
           * ICU PluralFormat + SelectFormat for JavaScript
           *
          Severity: Major
          Found in lib/javascripts/messageformat.js - About 3 days to fix

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

            class Topic < ActiveRecord::Base
              class UserExists < StandardError; end
              class NotAllowed < StandardError; end
              include ActionView::Helpers::SanitizeHelper
              include RateLimiter::OnCreateRecord
            Severity: Major
            Found in app/models/topic.rb - About 3 days to fix

              Class User has 175 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 users_controller.rb has 1309 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class UsersController < ApplicationController
                  skip_before_action :authorize_mini_profiler, only: [:avatar]
                
                  requires_login only: [
                    :username, :update, :upload_user_image,
                Severity: Major
                Found in app/controllers/users_controller.rb - About 3 days to fix

                  File user.rb has 1238 lines of code (exceeds 250 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.js has 1226 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import I18n from "I18n";
                    import { isPresent, isEmpty } from "@ember/utils";
                    import { or, and, not, alias } from "@ember/object/computed";
                    import EmberObject from "@ember/object";
                    import { next, schedule } from "@ember/runloop";
                    Severity: Major
                    Found in app/assets/javascripts/discourse/app/controllers/topic.js - About 3 days to fix

                      Function default has a Cognitive Complexity of 154 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export default function (options) {
                        const autocompletePlugin = this;
                      
                        if (this.length === 0) return;
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/discourse/app/lib/autocomplete.js - About 3 days to fix

                      Cognitive Complexity

                      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                      A method's cognitive complexity is based on a few simple rules:

                      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                      • Code is considered more complex for each "break in the linear flow of the code"
                      • Code is considered more complex when "flow breaking structures are nested"

                      Further reading

                      Function strategies has 586 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      this.workbox.strategies = (function (exports, logger_mjs, assert_mjs, cacheNames_mjs, cacheWrapper_mjs, fetchWrapper_mjs, getFriendlyURL_mjs, WorkboxError_mjs) {
                        'use strict';
                      
                        try {
                          self['workbox:strategies:4.3.1'] && _();
                      Severity: Major
                      Found in public/javascripts/workbox/workbox-strategies.dev.js - About 2 days to fix

                        File composer.js has 1042 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import I18n from "I18n";
                        import { isEmpty } from "@ember/utils";
                        import { reads, equal, not, or, and } from "@ember/object/computed";
                        import EmberObject, { set } from "@ember/object";
                        import { cancel, later, next, throttle } from "@ember/runloop";
                        Severity: Major
                        Found in app/assets/javascripts/discourse/app/models/composer.js - About 2 days to fix

                          File workbox-core.dev.js has 1029 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          this.workbox = this.workbox || {};
                          this.workbox.core = (function (exports) {
                            'use strict';
                          
                            try {
                          Severity: Major
                          Found in public/javascripts/workbox/workbox-core.dev.js - About 2 days to fix

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

                            require "digest"
                            
                            module Email
                            
                              class Receiver
                            Severity: Major
                            Found in lib/email/receiver.rb - About 2 days to fix

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

                              class Search
                                DIACRITICS ||= /([\u0300-\u036f]|[\u1AB0-\u1AFF]|[\u1DC0-\u1DFF]|[\u20D0-\u20FF])/
                                HIGHLIGHT_CSS_CLASS = 'search-highlight'
                              
                                cattr_accessor :preloaded_topic_custom_fields
                              Severity: Major
                              Found in lib/search.rb - About 2 days to fix

                                File composer.js has 1002 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import getURL from "discourse-common/lib/get-url";
                                import I18n from "I18n";
                                import { isEmpty } from "@ember/utils";
                                import { and, or, alias, reads } from "@ember/object/computed";
                                import { cancel, debounce } from "@ember/runloop";
                                Severity: Major
                                Found in app/assets/javascripts/discourse/app/controllers/composer.js - About 2 days to fix

                                  File pikaday.js has 972 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  /*!
                                   * Pikaday
                                   *
                                   * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/Pikaday/Pikaday
                                   */
                                  Severity: Major
                                  Found in public/javascripts/pikaday.js - About 2 days to fix

                                    Function routing has 475 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    this.workbox.routing = (function (exports, assert_mjs, logger_mjs, cacheNames_mjs, WorkboxError_mjs, getFriendlyURL_mjs) {
                                      'use strict';
                                    
                                      try {
                                        self['workbox:routing:4.3.1'] && _();
                                    Severity: Major
                                    Found in public/javascripts/workbox/workbox-routing.dev.js - About 2 days to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language