loomio/loomio

View on GitHub

Showing 128 of 182 total issues

File emoji_table.js has 579 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export default {
  'common': {
    'slight_smile': '🙂',
    'heart': '❤️',
    'tada': '🎉',
Severity: Major
Found in vue/src/shared/helpers/emoji_table.js - About 1 day to fix

    Class Poll has 56 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Poll < ApplicationRecord
      extend  HasCustomFields
      include CustomCounterCache::Model
      include ReadableUnguessableUrls
      include HasEvents
    Severity: Major
    Found in app/models/poll.rb - About 1 day to fix

      Class SnorlaxBase has 53 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class API::V1::SnorlaxBase < ActionController::Base
        rescue_from(CanCan::AccessDenied)                    { |e| respond_with_standard_error e, 403 }
        rescue_from(ActionController::UnpermittedParameters) { |e| respond_with_standard_error e, 400 }
        rescue_from(ActionController::ParameterMissing)      { |e| respond_with_standard_error e, 400 }
        rescue_from(ActiveRecord::RecordNotFound)            { |e| respond_with_standard_error e, 404 }
      Severity: Major
      Found in app/controllers/api/v1/snorlax_base.rb - About 7 hrs to fix

        File poll.rb has 377 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        class Poll < ApplicationRecord
          extend  HasCustomFields
          include CustomCounterCache::Model
          include ReadableUnguessableUrls
          include HasEvents
        Severity: Minor
        Found in app/models/poll.rb - About 5 hrs to fix

          Class ApplicationSerializer has 37 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ApplicationSerializer < ActiveModel::Serializer
            embed :ids, include: true
          
            def scope
              super || {}
          Severity: Minor
          Found in app/serializers/application_serializer.rb - About 4 hrs to fix

            Class Group has 36 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Group < ApplicationRecord
              include HasTimeframe
              include HasRichText
              include CustomCounterCache::Model
              include ReadableUnguessableUrls
            Severity: Minor
            Found in app/models/group.rb - About 4 hrs to fix

              Method initialize has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize(user)
                  super(user)
              
                  can :add_options, ::Poll do |poll|
                    user_is_author_of?(poll) || (user.can?(:vote_in, poll) && poll.voter_can_add_options)
              Severity: Minor
              Found in app/models/ability/poll.rb - About 4 hrs 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

              Class User has 31 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class User < ApplicationRecord
                include CustomCounterCache::Model
                include ReadableUnguessableUrls
                include MessageChannel
                include HasExperiences
              Severity: Minor
              Found in app/models/user.rb - About 3 hrs to fix

                Class Event has 30 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Event < ApplicationRecord
                  include ActionView::Helpers::SanitizeHelper
                  include CustomCounterCache::Model
                  include HasTimeframe
                  extend HasCustomFields
                Severity: Minor
                Found in app/models/event.rb - About 3 hrs to fix

                  Function setAlignment has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function setAlignment (type, attrs = {}) {
                    return (state, dispatch) => {
                      const {
                        doc,
                        selection,
                  Severity: Major
                  Found in vue/src/shared/tiptap_extentions/utils/alignment.js - About 3 hrs to fix

                    Class RecordCache has 29 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class RecordCache
                      attr_accessor :scope
                      attr_accessor :exclude_types
                      attr_accessor :user_ids
                      attr_accessor :current_user_id
                    Severity: Minor
                    Found in app/services/record_cache.rb - About 3 hrs to fix

                      File ninties_movies_helper.rb has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      module Dev::NintiesMoviesHelper
                        include Dev::FakeDataHelper
                      
                        private
                      
                      
                      Severity: Minor
                      Found in app/helpers/dev/ninties_movies_helper.rb - About 3 hrs to fix

                        Method initialize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                        Open

                          def initialize(user)
                            super(user)
                        
                            can [:show], ::Group do |group|
                              !group.archived_at &&
                        Severity: Minor
                        Found in app/models/ability/group.rb - About 3 hrs 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

                        Class Base has 28 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                          class Base
                            attr_accessor :name, :installed, :enabled # GK: TODO: enabled is to prevent existing plugins from blowing up, but we should fix all the plugins
                            attr_reader :assets, :static_assets, :actions, :events, :outlets, :routes, :translations, :extensions, :enabled, :config
                            alias :read_attribute_for_serialization :send
                        
                        
                        Severity: Minor
                        Found in lib/plugins/base.rb - About 3 hrs to fix

                          Function printHtml has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function printHtml (dom) {
                            let style = Array.from(document.querySelectorAll('style, link'))
                              .reduce((str, style) => str + style.outerHTML, '')
                            style = style.replace(new RegExp('<link href=".*.js" .*[ht]">', 'g'), '')
                            style = style.replace(new RegExp('href="', 'g'), 'href="/')
                          Severity: Minor
                          Found in vue/src/shared/tiptap_extentions/utils/print.js - About 3 hrs 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

                          Method accessible_records has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def accessible_records
                              load_and_authorize(:discussion)
                              records = Event.where(discussion_id: @discussion.id)
                          
                              if %w[position_key sequence_id].include?(params[:order_by])
                          Severity: Minor
                          Found in app/controllers/api/v1/events_controller.rb - About 3 hrs 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

                          Method initialize has 73 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def initialize(user)
                              super(user)
                          
                              can [:show], ::Group do |group|
                                !group.archived_at &&
                          Severity: Major
                          Found in app/models/ability/group.rb - About 2 hrs to fix

                            Method initialize has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                              def initialize(user)
                                super(user)
                            
                                can [:show,
                                     :print,
                            Severity: Minor
                            Found in app/models/ability/discussion.rb - About 2 hrs 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 group.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class Group < ApplicationRecord
                              include HasTimeframe
                              include HasRichText
                              include CustomCounterCache::Model
                              include ReadableUnguessableUrls
                            Severity: Minor
                            Found in app/models/group.rb - About 2 hrs to fix

                              File record_cache.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              class RecordCache
                                attr_accessor :scope
                                attr_accessor :exclude_types
                                attr_accessor :user_ids
                                attr_accessor :current_user_id
                              Severity: Minor
                              Found in app/services/record_cache.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language