fiedl/your_platform

View on GitHub

Showing 213 of 251 total issues

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

  class ListExportUser < User

    attr_accessor :list_export_group

    def personal_title_and_name
Severity: Minor
Found in app/models/list_exports/list_export_user.rb - About 3 hrs to fix

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

      def text_size(str, book_rate = false)
        if book_rate
          # If there is a "book rate" badge, the actual address text needs to be smaller.
          if str.present?
            return 10.pt if num_of_lines_required(str, 12.pt) < 5
    Severity: Minor
    Found in app/pdfs/address_labels_pdf.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 rights_for_signed_in_users has 84 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def rights_for_signed_in_users
        can :read, :terms_of_use
        can :accept, :terms_of_use if not read_only_mode?
        can :use, :single_sign_on
    
    
    Severity: Major
    Found in app/models/ability.rb - About 3 hrs to fix

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

      class Group < ApplicationRecord
      
        has_dag_links ancestor_class_names: %w(Group Page Event), descendant_class_names: %w(Group User Page Workflow Project Post), link_class_name: 'DagLink'
      
        default_scope { includes(:flags) }
      Severity: Minor
      Found in app/models/group.rb - About 3 hrs to fix

        Method fill_cache has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

          def fill_cache
            super
        
            # If we change the title of the current navable, it will affect
            # the navigation of the descendants.
        Severity: Minor
        Found in app/models/concerns/navable_caching.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 Attachment has 27 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Attachment < ApplicationRecord
        
          belongs_to :parent, polymorphic: true
          belongs_to :parent_group, -> { where(attachments: {parent_type: "Group"}).includes(:attachments) }, foreign_key: :parent_id, class_name: "Group"
          belongs_to :parent_page, -> { where(attachments: {parent_type: "Page"}).includes(:attachments) }, foreign_key: :parent_id, class_name: "Page"
        Severity: Minor
        Found in app/models/attachment.rb - About 3 hrs to fix

          Class IncomingMail has 27 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class IncomingMail
          
            def initialize(message)
              message = Mail::Message.new(message) if message.kind_of? String
              message.message_id ||= Mail::MessageIdField.new.value if Rails.env.development? # Because our test mails usually don't have a message id.
          Severity: Minor
          Found in app/models/incoming_mail.rb - About 3 hrs to fix

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

              def tab_path(object, tab)
                if object.kind_of?(Groups::GroupOfGroups)
                  group_path(object)
                elsif object.kind_of?(Group)
                  case tab.to_s
            Severity: Minor
            Found in app/controllers/concerns/current_tab.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 processed_data has 75 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def processed_data
                if preset.to_s.in?(['birthday_list', 'address_list', 'dpag_internetmarke', 'phone_list']) && @data.kind_of?(Group)
                  # To be able to generate lists from Groups as well as search results, these presets expect
                  # an Array of Users as data. If a Group is given instead, just take the group members as data.
                  #
            Severity: Major
            Found in app/models/list_export.rb - About 3 hrs to fix

              Consider simplifying this complex logical expression.
              Open

                  if not read_only_mode?
                    can :update, Attachment do |attachment|
                      parent_ability_can?(:read, attachment) &&
                      (attachment.parent.respond_to?(:group) && attachment.parent.group) && (attachment.parent.group.officers_of_self_and_ancestors.include?(user)) &&
                      ((attachment.author == user) || (attachment.parent.respond_to?(:author) && attachment.parent.author == user))
              Severity: Critical
              Found in app/models/abilities/attachment_ability.rb - About 3 hrs to fix

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

                  def index
                    authorize! :index, Event
                
                    respond_to do |format|
                      format.html do
                Severity: Major
                Found in app/controllers/events_controller.rb - About 2 hrs to fix

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

                    def replace(search, replace)
                      if self.multipart?
                        self.parts.each do |part|
                          if part.text?
                            part.body.raw_source.replace part.body.decoded.gsub(search, replace) if part.body.decoded.include? search
                  Severity: Minor
                  Found in core_ext/mail/message.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

                  Class CorporationScore has 25 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class CorporationScore < TermReports::ForCorporation
                  
                    def title
                      corporation.title
                    end
                  Severity: Minor
                  Found in app/models/corporation_score.rb - About 2 hrs to fix

                    Method generate_rss_feed has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def generate_rss_feed(xml, args = {})
                        args[:root_element] || raise(ActionController::ParameterMissing, 'no :root_element given')
                        args[:items] || raise(ActionController::ParameterMissing, 'no :items given')
                    
                        description = args[:root_element].description if args[:root_element].respond_to? :description
                    Severity: Minor
                    Found in app/helpers/rss_helper.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

                    Method members= has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def members=(new_members)
                          for member in self.direct_members
                            unassign_user member unless member.in? new_members if member
                          end
                          for new_member in new_members
                    Severity: Minor
                    Found in app/models/concerns/group_memberships.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

                    Class ReceivedMail has 24 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ReceivedMail
                      
                      def initialize(message)
                        require 'mail'
                        @message = message
                    Severity: Minor
                    Found in app/models/received_mail.rb - About 2 hrs to fix

                      Method sync_to_graph_database has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def sync_to_graph_database
                          if self.direct?
                            Graph::HasSubgroup.sync self if ancestor.kind_of?(Group) && descendant.kind_of?(Group)
                            Graph::Membership.sync self if ancestor.kind_of?(Group) && descendant.kind_of?(User)
                            Graph::HasSubpage.sync self if ancestor.kind_of?(Page) && descendant.kind_of?(Page)
                      Severity: Minor
                      Found in app/models/concerns/dag_link_graph.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

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

                        def initialize(user, options = {})
                      
                          # Preview other roles.
                          # Attention: Check outside whether the user's role allowes that preview!
                          # Currently, this is done in ApplicationController#current_ability.
                      Severity: Minor
                      Found in app/models/abilities/base_ability.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

                      Class ListExportUser has 23 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ListExportUser < User
                      
                        def personal_title_and_name
                          "#{personal_title} #{name}".strip
                        end
                      Severity: Minor
                      Found in app/models/list_export.rb - About 2 hrs to fix

                        File list_export.rb has 268 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'csv'
                        
                        # This class helps to export data to CSV, XLS and possibly others.
                        #
                        # Example:
                        Severity: Minor
                        Found in app/models/list_export.rb - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language