fiedl/your_platform

View on GitHub

Showing 213 of 251 total issues

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

  def initialize(user, options = {})
    # Define abilities for the passed in user here. For example:
    #
    #   user ||= User.new # guest user (not logged in)
    #   if user.admin?
Severity: Minor
Found in app/models/ability.rb - About 1 hr to fix

    Method << has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def <<(object)
        begin
          if object.kind_of? User
            raise RuntimeError 'Users can only be assigned to groups.' unless self.kind_of? Group
            self.assign_user(object) unless self.child_users.include? object
    Severity: Minor
    Found in app/models/concerns/structureable.rb - About 1 hr to fix

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

        def create
          authorize! :create_accommodation_sepa_debit, corporation
      
          institution.settings.creditor_identifier = creditor_identifier
      
      
      Severity: Minor
      Found in app/controllers/accommodation_sepa_debits_controller.rb - About 1 hr to fix

        Method comment_email has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def comment_email(post:, recipient:)
            @subject = post.title
            @post_url = post_url(post)
            @current_user = recipient
        
        
        Severity: Minor
        Found in app/mailers/comment_mailer.rb - About 1 hr to fix

          Method hidden_menu has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def hidden_menu
              hidden = super
              hidden = true if self.navable.kind_of? User if hidden.nil?
              hidden = true if self.navable.kind_of? Event if hidden.nil?
              hidden = true if self.navable.title == I18n.t(:officers_parent) if hidden.nil?
          Severity: Minor
          Found in app/models/nav_node.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 assign_user has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def assign_user(user, options = {})
                raise RuntimeError, "no user given" if not user
                time_of_joining = options[:joined_at] || options[:at] || options[:time] || Time.zone.now
                if m = Membership.with_past.find_by_user_and_group(user, self)
                  m.valid_from = time_of_joining if m.valid_from && time_of_joining < m.valid_from
          Severity: Minor
          Found in app/models/concerns/group_memberships.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 search_by_breadcrumbs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def search_by_breadcrumbs(query, options = {})
                # "Erlanger Wingolf > Aktivitas > Burschen" should match "Erlanger Burschen".
                limit = options[:limit]
                count = 0
                base_class = options[:base_class] || Group
          Severity: Minor
          Found in app/models/concerns/structureable_search.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 per_corporation_and_time has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

            def per_corporation_and_time
              authorize! :index, :activity_charts
          
              # The `groupdate` gem is used for date binning:
              # https://github.com/ankane/groupdate#dynamic-grouping
          Severity: Minor
          Found in app/controllers/charts/activities_controller.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 member_table_rows has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def member_table_rows
              if memberships.count == members.count
                memberships_for_member_list.reorder('valid_from ASC').collect do |membership|
                  if user = membership.user
                    hash = {
          Severity: Minor
          Found in app/models/concerns/group_member_list.rb - About 1 hr to fix

            Method vue_post_page has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def vue_post_page(post)
                content_tag :vue_post_page, "", {
                  ':post': post.as_json.merge({
                    author: post.author.as_json.merge({
                      path: (polymorphic_path(post.author) if can?(:read, post.author))
            Severity: Minor
            Found in app/helpers/vue_helper.rb - About 1 hr to fix

              Method deliver has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def deliver
                  if not user.has_account?
                    self.comment = "User has no account."
                    self.failed_at = Time.zone.now
                    self.save
              Severity: Minor
              Found in app/models/post_delivery.rb - About 1 hr to fix

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

                  def initialize(address_labels, options = {title: '', updated_at: Time.zone.now, sender: '', book_rate: false})
                    super(page_size: 'A4', top_margin: 0.mm, bottom_margin: 0.mm, left_margin: 0.mm, right_margin: 0.mm)
                    
                    @document_title = options[:title]
                    @document_updated_at = options[:updated_at]
                Severity: Minor
                Found in app/pdfs/address_labels_dpag7037_pdf.rb - About 1 hr to fix

                  Method extensive_name has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def extensive_name
                      if has_flag? :attendees
                        name + (parent_events.first ? ": " + parent_events.first.name : '')
                      elsif has_flag? :contact_people
                        name + (parent_events.first ? ": " + parent_events.first.name : '')
                  Severity: Minor
                  Found in app/models/group.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 create has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def create
                      raise ActionController::ParameterMissing, 'name not given' if params[:first_name].blank? or params[:last_name].blank?
                      raise ActionController::ParameterMissing, 'email not given' if params[:email].blank?
                      raise ActionController::ParameterMissing, 'no password' if params[:password].blank?
                      raise ActionController::BadRequest, 'password too short' if params[:password].length < 9
                  Severity: Minor
                  Found in app/controllers/setup_controller.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 current_role_preview has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def current_role_preview
                      preview_as = nil
                      if current_user
                        preview_as = params[:preview_as] || load_preview_as_from_cookie
                        if preview_as.present? || current_user.is_global_officer?
                  Severity: Minor
                  Found in app/controllers/concerns/current_role.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 generate_rss_feed has 33 lines of code (exceeds 25 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 1 hr to fix

                    Function nodePasteRule has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function nodePasteRule(regexp, type, getAttrs) {
                      const handler = fragment => {
                        const nodes = [];
                    
                        fragment.forEach(child => {
                    Severity: Minor
                    Found in app/vue/lib/tiptap/node_paste_rule.js - About 1 hr to fix

                      Method per_corporation_and_time has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def per_corporation_and_time
                          authorize! :index, :activity_charts
                      
                          # The `groupdate` gem is used for date binning:
                          # https://github.com/ankane/groupdate#dynamic-grouping
                      Severity: Minor
                      Found in app/controllers/charts/activities_controller.rb - About 1 hr to fix

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

                          Method html_convert_h1_to_boxes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def html_convert_h1_to_boxes( html_code, options = {} )
                          
                              # Further Nokogiri Reference
                              # * http://stackoverflow.com/questions/3449767/
                              # * http://www.engineyard.com/blog/2010/getting-started-with-nokogiri/
                          Severity: Minor
                          Found in app/helpers/box_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

                          Severity
                          Category
                          Status
                          Source
                          Language