fiedl/your_platform

View on GitHub

Showing 213 of 251 total issues

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

    def create_special_group( group_flag, options = {} )
      if find_special_group( group_flag, options )
        raise ActiveRecord::RecordNotSaved, "special group :#{group_flag} already exists."
      end
      object_to_create = options[:parent_element].try(:child_groups)
Severity: Minor
Found in app/models/concerns/special_groups.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 from_omniauth has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def from_omniauth(auth)
      case auth.provider
      when 'github', 'twitter', 'google_oauth2', 'facebook'
        User.find_by_email auth.info.email if auth.info.email.present?
      else
Severity: Minor
Found in app/models/concerns/user_omniauth.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 scan_address_field has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def self.scan_address_field(address_field)
    address_field.issues.destroy_auto
    if address_field.postal_or_first_address?
      if address_field.value.to_s.split("\n").count < 2
        address_field.issues.create title: 'issues.address_has_too_few_lines', description: 'issues.address_needs_between_2_and_4_lines', responsible_admin_id: address_field.profileable.try(:responsible_admin_id)
Severity: Minor
Found in app/models/issue.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 events has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def events
    if group
      @events = group.events_with_subgroups.where(publish_on_local_website: true)
    else
      @events = Event.where(publish_on_global_website: true)
Severity: Minor
Found in app/controllers/api/v1/public/events_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 text has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def text
    if self.multipart?
      self.parts.each do |part|
        if part.text?
          return part.body.decoded
Severity: Minor
Found in core_ext/mail/message.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 handle_inline_attachment_uploads has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def handle_inline_attachment_uploads
    if params[:inline_attachment].to_b == true
      params[:attachment] ||= {}
      params[:attachment][:parent_type] ||= params[:parent_type] if params[:parent_type].present?
      params[:attachment][:parent_id] ||= params[:parent_id] if params[:parent_id].present?
Severity: Minor
Found in app/controllers/attachments_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 find_object has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def find_object
    @object = base.descendant_groups.find_by token: query if base.respond_to? :descendant_groups
    @object ||= NavNode.where('url_component like ?', like_query).limit(1).first.try(:navable) if not params[:search_base].present?  # for example "erlangen/" -- as entry point for navigation
    @object ||= base.descendant_groups.where('name like ?', like_query).limit(1).first if base.respond_to? :descendant_groups
    @object ||= base.descendant_pages.where('title like ?', like_query).limit(1).first if base.respond_to? :descendant_pages
Severity: Minor
Found in app/controllers/compact_nav_search_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 restore_profile has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def restore_profile
    raise "This user (#{id}) already has an existing profile. Not restoring from backup file." if profile_fields.any?
    hash = ActiveSupport::JSON.decode(File.read(latest_backup_file))

    if (address = hash['profile_fields'].select { |pf| pf['type'] == "ProfileFields::Address" }.first) && address['children'].present?
Severity: Minor
Found in app/models/concerns/user_backup.rb - About 1 hr to fix

    Method list_export_by_preset has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def list_export_by_preset(preset, options = {})
        case preset.to_s
        when 'name_list', '', nil
          self.export_name_list(options)
        when 'address_list'
    Severity: Minor
    Found in app/models/concerns/group_list_exports.rb - About 1 hr to fix

      Method show has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def show
          authorize! :read, group
          authorize! :export_member_list, group
      
          list_preset_i18n = I18n.translate(list_preset) if list_preset.present?
      Severity: Minor
      Found in app/controllers/list_exports_controller.rb - About 1 hr to fix

        Method show has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def show
            set_current_title group.title
            set_current_navable group
            set_current_tab :contacts
        
        
        Severity: Minor
        Found in app/controllers/groups_controller.rb - About 1 hr to fix

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

            def generate_public_website
              homepage = child_pages.where(type: "Pages::PublicPage").first
              if not homepage
                if self.subdomain.present?
                  domain = "#{self.subdomain}.#{AppVersion.domain}"
          Severity: Minor
          Found in app/models/concerns/group_public_website.rb - About 1 hr to fix

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

              def generate_dummy_user
                Faker::Config.locale = Setting.preferred_locale || 'de'
            
                user = User.new
                user.first_name = Faker::Name.first_name
            Severity: Minor
            Found in app/models/concerns/group_dummy_users.rb - About 1 hr to fix

              Method create has 28 lines of code (exceeds 25 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

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

                  def self.parse(payload, sso_secret = nil)
                    sso = new
                    sso.sso_secret = sso_secret if sso_secret
                    parsed = Rack::Utils.parse_query(payload)
                    if sso.sign(parsed["sso"]) != parsed["sig"]
                Severity: Minor
                Found in app/services/single_sign_on.rb - About 1 hr to fix

                  Method initialize has 28 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: 8.mm, bottom_margin: 8.mm, left_margin: 10.mm, right_margin: 10.mm)
                  
                      @document_title = options[:title]
                      @document_updated_at = options[:updated_at]
                  Severity: Minor
                  Found in app/pdfs/address_labels_zweckform3475_pdf.rb - About 1 hr to fix

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

                        def parse(datetime, type)
                          return unless datetime
                          return datetime if datetime.respond_to?(:strftime) # already a Date/Time object -> no need to parse it
                    
                          translate_month_and_day_names(datetime)
                    Severity: Minor
                    Found in app/models/localized_date_time_parser.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 groups_of_user_table has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def groups_of_user_table(user, options = {require_post_ability: false})
                        content_tag :table, :class => "user_groups" do
                          content_tag :tr do
                    
                            # first column:
                    Severity: Minor
                    Found in app/helpers/groups_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 resource_breadcrumbs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def resource_breadcrumbs
                        ancestor_resource_controllers.reverse.collect { |controller|
                          if controller
                            if controller.action_methods.include? 'index'
                              underscored_controller_name = controller.name.gsub("Controller", "").underscore
                    Severity: Minor
                    Found in app/helpers/breadcrumbs_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 events has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def events
                        if show_events?
                          events = show_events_for_group.try(:events) || Event.all
                          events = events.where(publish_on_global_website: true) if settings.show_only_events_published_on_global_website
                          events = events.where(publish_on_local_website: true) if settings.show_only_events_published_on_local_website
                    Severity: Minor
                    Found in app/models/concerns/page_events.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