Showing 3 of 239 total issues
Class Event
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
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
Method new_with_session
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Confirmed
Confirmed
def new_with_session(_, session)
super.tap do |user|
if valid_omniauth_session? session
data = session['omniauth.data']
user.uid = data['uid']
- Read upRead up
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
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
- Read upRead up
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"