loomio/loomio

View on GitHub

Showing 175 of 175 total issues

Function dispatchTasks has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function dispatchTasks (tasks, textAlign, selectionIsCell, tr, dispatch, paragraph) {
  if (!tasks.length) {
    return false
  }

Severity: Minor
Found in vue/src/shared/tiptap_extentions/utils/alignment.js - About 1 hr to fix

    Method set_messenger_profile has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def set_messenger_profile
        post "me/messenger_profile?access_token=#{ENV['FACEBOOK_APP_PAGE_TOKEN']}", params: {
          get_started: { payload: "test" },
          home_url: {
            url: "#{https_host}/facebook/webview",
    Severity: Minor
    Found in app/extras/clients/facebook.rb - About 1 hr to fix

      Method search has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def self.search(chain: start, params:)
          if group = Group.find_by(id: params[:group_id])
            group_ids = case params[:subgroups]
              when 'mine', 'all'
                group.id_and_subgroup_ids
      Severity: Minor
      Found in app/queries/membership_query.rb - About 1 hr to fix

        Method catch_up has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def catch_up(user_id, time_since = nil, frequency = 'daily')
            user = User.find(user_id)
            return unless user.email_catch_up_day
            @recipient = @user = user
        
        
        Severity: Minor
        Found in app/mailers/user_mailer.rb - About 1 hr to fix

          Method group_privacy= has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def group_privacy=(term)
              case term
              when 'open'
                self.is_visible_to_public = true
                self.discussion_privacy_options = 'public_only'
          Severity: Minor
          Found in app/models/concerns/group_privacy.rb - About 1 hr to fix

            Method invite has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.invite(group:, params:, actor:)
                actor.ability.authorize! :announce, group
            
                group_ids = if params[:invited_group_ids]
                  Array(params[:invited_group_ids])
            Severity: Minor
            Found in app/services/group_service.rb - About 1 hr to fix

              Method create_activity_items has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def create_activity_items(discussion: , actor: )
                  # create poll
                  options = {poll: %w[apple turnip peach],
                             count: %w[yes no],
                             proposal: %w[agree disagree abstain block],
              Severity: Minor
              Found in app/helpers/dev/polls_helper.rb - About 1 hr to fix

                Function schema has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  get schema() {
                    return {
                      attrs: {
                        done: {
                          default: false,
                Severity: Minor
                Found in vue/src/components/lmo_textarea/todo_item.js - About 1 hr to fix

                  Method included has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.included(base)
                      base.rescue_from(ActionController::UnknownFormat) do
                        respond_with_error message: :"errors.not_found", status: 404
                      end
                  
                  
                  Severity: Minor
                  Found in app/helpers/error_rescue_helper.rb - About 1 hr 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 add_tags_complete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def add_tags_complete
                      scope[:tags_by_type_and_id] ||= {}
                  
                      Tag.where(group_id: group_ids).each do |tag|
                          scope[:tags_by_type_and_id]['Group'] ||= {}
                  Severity: Minor
                  Found in app/services/record_cache.rb - About 1 hr 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 migrate_paperclip has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.migrate_paperclip
                      models = [Group, User, Discussion, Comment, Poll, Stance, Outcome, Document]
                  
                      models.each do |model|
                        attachments = model.column_names.map do |c|
                  Severity: Minor
                  Found in app/services/migrate_events_service.rb - About 1 hr 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 callback has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def callback
                      saml_provider = session_saml_provider
                      saml_response = OneLogin::RubySaml::Response.new(params[:SAMLResponse], settings: sp_settings(saml_provider))
                  
                      if saml_response.success?
                  Severity: Minor
                  Found in app/controllers/saml_providers_controller.rb - About 1 hr to fix

                    Method create has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def self.create(stance:, actor:, params: {}, force_create: false)
                    
                        stance = Stance.where(
                          poll_id: stance.poll_id,
                          participant_id: actor.id,
                    Severity: Minor
                    Found in app/services/stance_service.rb - About 1 hr to fix

                      Method accessible_records has 27 lines of code (exceeds 25 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 1 hr to fix

                        Method nil_methods has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def nil_methods
                            %w(
                              parent
                              id
                              key
                        Severity: Minor
                        Found in app/models/concerns/null/group.rb - About 1 hr to fix

                          Function applyMark has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function applyMark (tr, markType, attrs) {
                            if (!tr.selection || !tr.doc || !markType) {
                              return tr
                            }
                          
                          
                          Severity: Minor
                          Found in vue/src/shared/tiptap_extentions/utils/mark.js - About 1 hr to fix

                            Method perform has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def perform(ids, source_discussion_id, target_discussion_id)
                                source_discussion = Discussion.find(source_discussion_id)
                                target_discussion = Discussion.find(target_discussion_id)
                            
                                #safe
                            Severity: Minor
                            Found in app/workers/move_comments_worker.rb - About 1 hr to fix

                              Method visible_to has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def self.visible_to(chain: start,
                                                    user: LoggedOutUser.new,
                                                    group_ids: [], tags: [], discussion_ids: [],
                                                    only_unread: false, or_public: true, or_subgroups: true)
                                  if tags.any?
                              Severity: Minor
                              Found in app/queries/discussion_query.rb - About 55 mins 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 group_privacy= has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def group_privacy=(term)
                                  case term
                                  when 'open'
                                    self.is_visible_to_public = true
                                    self.discussion_privacy_options = 'public_only'
                              Severity: Minor
                              Found in app/models/concerns/group_privacy.rb - About 55 mins 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 create has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def self.create(stance:, actor:, params: {}, force_create: false)
                              
                                  stance = Stance.where(
                                    poll_id: stance.poll_id,
                                    participant_id: actor.id,
                              Severity: Minor
                              Found in app/services/stance_service.rb - About 55 mins 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

                              Severity
                              Category
                              Status
                              Source
                              Language