hpi-swt2/sport-portal

View on GitHub

Showing 3 of 239 total issues

Class Event has 33 methods (exceeds 20 allowed). Consider refactoring.
Open

class Event < ApplicationRecord
  belongs_to :owner, class_name: 'User'
  has_many :matches, -> { order gameday_number: :asc, index: :asc }, dependent: :destroy
  has_many :participants
  has_many :teams, through: :participants
Severity: Minor
Found in app/models/event.rb - About 4 hrs to fix

    Method new_with_session has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Confirmed

        def new_with_session(_, session)
          super.tap do |user|
            if valid_omniauth_session? session
              data = session['omniauth.data']
              user.uid = data['uid']
    Severity: Minor
    Found in app/models/user.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 perform_action_on_multiple_members has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def perform_action_on_multiple_members
        target_members = ensure_current_user_is_last params[:members]
        unaffected_users = []
        target_members.each do |member_id|
          @team.reload
    Severity: Minor
    Found in app/controllers/teams_controller.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