ZeusWPI/FK-enrolment

View on GitHub

Showing 15 of 17 total issues

Method submit has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def submit(member, card)
    return if card.academic_year != Member.current_academic_year
    return if not ['request'].include? card.isic_status
    return if card.status != 'paid'

Severity: Minor
Found in app/exports/isic_export.rb - About 2 hrs to fix

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

      def submit(member, card)
        return if card.academic_year != Member.current_academic_year
        return if not ['request'].include? card.isic_status
        return if card.status != 'paid'
    
    
    Severity: Minor
    Found in app/exports/isic_export.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 field_for_extra_attribute_type has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def field_for_extra_attribute_type(f, type)
        label = f.object.spec.name
        values = f.object.spec.values
    
        case type
    Severity: Minor
    Found in app/helpers/extra_attributes_helper.rb - About 1 hr to fix

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

        def filter_params
          report_params = { club_id: @club.id }
          @filtered = false
          if params[:member_report]
            # This will check if members are actually filtered
      Severity: Minor
      Found in app/controllers/backend/members_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 verify_fk has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def verify_fk
          # Development backdoor
          return session[:club] = "FK" if Rails.env.development?
      
          if session[:cas].blank? || session[:cas]['user'].blank?
      Severity: Minor
      Found in app/controllers/backend/fk_controller.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 add_members has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        def add_members(members, academic_year)
          return if members.length == 0
      
          club = members.first.club
          members.each_with_index do |member, i|
      Severity: Minor
      Found in app/exports/excel_export.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 export has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def export
          if self.citylife?
            self.delay.export_to_citylife unless self.citylife_exported
          end
      
      
      Severity: Minor
      Found in app/models/card.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 photo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def photo
          skip_step unless @member.uses_isic? || (@member.uses_citylife? && ! @member.club.skip_photo_step)
          if params[:member]
            @member.save # Trigger paperclip callbacks
            # All image uploading and processing is done by the model
      Severity: Minor
      Found in app/controllers/frontend/registration_controller.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 pay has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def pay
          @card = @member.current_card || Card.build_for(@member)
      
          if params[:card] || params[:commit]
            @card.attributes = params[:card] if params[:card]
      Severity: Minor
      Found in app/controllers/backend/members_controller.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 request_clubnames has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def request_clubnames
          # Development backdoor
          return Club.pluck(:internal_name) if Rails.env.development?
      
          ugent_login = session[:cas]['user']
      Severity: Minor
      Found in app/controllers/backend/backend_controller.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 valid_card_number has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def valid_card_number
          return if self.number.blank? or not self.member
          return if self.club && self.club.uses_citylife?
      
          # Only check the rules of current cards
      Severity: Minor
      Found in app/models/card.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 find_member_for_club has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.find_member_for_club(member_id, club)
          return [nil, :not_found] unless member_id
      
          member = includes(:current_card).where(:id => member_id, :enabled => true)
          if member = member.first
      Severity: Minor
      Found in app/models/member.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 render_extra_attribute_value has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def render_extra_attribute_value(attribute)
          return if attribute.spec.field_type.blank?
      
          if attribute.value.is_a? Array
            # Filter out empty values
      Severity: Minor
      Found in app/helpers/extra_attributes_helper.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 photo_dimensions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def photo_dimensions
          return unless photo? or not photo.dirty?
      
          # If an exception occurs, its probably not a valid photo
          # and a previous validator will show an error
      Severity: Minor
      Found in app/models/member/photo.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 determine_isic_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def determine_isic_status
          return unless self.isic?
          raise "Record is not new, won't change status" unless new_record?
          raise "No member associated yet" unless member
          self.isic_status = 'request'
      Severity: Minor
      Found in app/models/card.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

      Severity
      Category
      Status
      Source
      Language