Showing 11 of 191 total issues
Class WorkshopsController
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Admin::WorkshopsController < Admin::ApplicationController
include Admin::SponsorConcerns
include Admin::WorkshopConcerns
before_action :set_workshop_by_id, only: %i[show edit destroy update]
Class ApplicationController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
include Pundit::Authorization
include Pagy::Backend
Class EventPresenter
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class EventPresenter < BasePresenter
PRESENTER = { workshop: 'WorkshopPresenter',
meeting: 'MeetingPresenter',
event: 'EventPresenter' }.freeze
Method attend
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def attend
event = @invitation.event
return redirect_back fallback_location: root_path, notice: t('messages.already_rsvped') if @invitation.attending?
if @invitation.student_spaces? || @invitation.coach_spaces?
- 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 create
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
member_type = cookies[:member_type]
current_service = AuthService.find_by(provider: omnihash[:provider],
uid: omnihash[:uid])
Method create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create
member_type = cookies[:member_type]
current_service = AuthService.find_by(provider: omnihash[:provider],
uid: omnihash[: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 reject
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def reject
@workshop = WorkshopPresenter.decorate(@invitation.workshop)
if @invitation.workshop.date_and_time - 3.5.hours >= Time.zone.now
if @invitation.attending.eql? false
- 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 accept
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def accept
user = current_user || @invitation.member
workshop = @invitation.workshop
return back_with_message(t('messages.already_rsvped')) if @invitation.attending?
- 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 mail_args
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def mail_args(member, subject, from_email = 'meetings@codebar.io', cc = '', bcc = '')
Method rsvp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def rsvp
unless @workshop.available_for_rsvp?
return redirect_back(
fallback_location: root_path,
notice: t('workshops.registration_not_open')
- 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 send_event_emails
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_event_emails(event, chapter)
return 'The event is not invitable' unless event.invitable?
invite_coaches_to_event(event, chapter) unless event.audience.eql?('Students')
invite_students_to_event(event, chapter) unless event.audience.eql?('Coaches')
- 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"