fiedl/wingolfsplattform

View on GitHub
app/models/user.rb

Summary

Maintainability
D
2 days
Test Coverage

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

class User
  prepend UserOverrides
  include UserLeibverhaeltnisse
  include UserNetenvData

Severity: Major
Found in app/models/user.rb - About 7 hrs to fix

    File user.rb has 343 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require_dependency YourPlatform::Engine.root.join( 'app/models/user' ).to_s
    
    # This class represents a user of the platform. A user may or may not have an account.
    # While the most part of the user class is contained in the your_platform engine,
    # this re-opened class contains all wingolf-specific additions to the user model.
    Severity: Minor
    Found in app/models/user.rb - About 4 hrs to fix

      Method adapt_bv_to_primary_address has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def adapt_bv_to_primary_address
          self.groups.reload
          new_bv = correct_bv
      
          # Wenn der Philister einen Wunsch-BV hat, wird die automatische Zuordnung
      Severity: Minor
      Found in app/models/user.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 adapt_bv_to_primary_address has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def adapt_bv_to_primary_address
          self.groups.reload
          new_bv = correct_bv
      
          # Wenn der Philister einen Wunsch-BV hat, wird die automatische Zuordnung
      Severity: Minor
      Found in app/models/user.rb - About 1 hr to fix

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

          def fill_in_template_profile_information
            self.profile_fields.create(label: :personal_title, type: "ProfileFields::General")
            self.profile_fields.create(label: :academic_degree, type: "ProfileFields::AcademicDegree")
            self.profile_fields.create(label: :cognomen, type: "ProfileFields::General")
            self.profile_fields.create(label: :klammerung, type: "ProfileFields::Klammerung")
        Severity: Minor
        Found in app/models/user.rb - About 1 hr to fix

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

            def fill_in_template_profile_information
              self.profile_fields.create(label: :personal_title, type: "ProfileFields::General")
              self.profile_fields.create(label: :academic_degree, type: "ProfileFields::AcademicDegree")
              self.profile_fields.create(label: :cognomen, type: "ProfileFields::General")
              self.profile_fields.create(label: :klammerung, type: "ProfileFields::Klammerung")
          Severity: Minor
          Found in app/models/user.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 in_allen_verbindungen_philistrieren! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def in_allen_verbindungen_philistrieren!
              raise "Noch kein Philister. Das geht nur, wenn er schon in einer Verbindung Philister ist." unless philistrationsdatum
              self.current_corporations.each do |corporation|
                unless self.member_of? corporation.philisterschaft
                  status_group_ids_in_this_corporation = StatusGroup.find_all_by_group(corporation.aktivitas).map(&:id)
          Severity: Minor
          Found in app/models/user.rb - About 45 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 personal_greeting has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def personal_greeting(options = {})
              if self.wingolfit?
                bbr = if self.aktiver?
                  "Bundesbruder"
                else
          Severity: Minor
          Found in app/models/user.rb - About 35 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 change_status has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def change_status(new_status, options = {})
              corporation_token = options[:in]
              corp = if self.current_corporations.count == 1
                print "Ignoriere :in-Option, da nur ein Band vorliegt.\n" if corporation_token
                self.current_corporations.first
          Severity: Minor
          Found in app/models/user.rb - About 35 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 status_export_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def status_export_string
              self.corporations.collect do |corporation|
                if membership = self.current_status_membership_in(corporation)
                  "#{membership.group.name.singularize} im #{corporation.name} seit #{I18n.localize(membership.valid_from.to_date) if membership.valid_from}"
                else
          Severity: Minor
          Found in app/models/user.rb - About 25 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

          There are no issues that match your filters.

          Category
          Status