Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 0 additions & 71 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,51 +6,12 @@
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 4
Capybara/RSpec/NegationMatcherAfterVisit:
Exclude:
- 'spec/features/member_portal_spec.rb'
- 'spec/support/shared_examples/behaves_like_an_invitation_route.rb'
- 'spec/support/shared_examples/behaves_link_member_viewing_workshop.rb'

# Offense count: 1
Capybara/RSpec/VisibilityMatcher:
Exclude:
- 'spec/components/chapters_sidebar_component_spec.rb'

# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Exclude:
- 'app/controllers/application_controller.rb'
- 'app/models/feedback.rb'

# Offense count: 1
# Configuration parameters: AllowedMethods.
# AllowedMethods: enums
Lint/ConstantDefinitionInBlock:
Exclude:
- 'lib/tasks/setup.rake'

# Offense count: 1
# Configuration parameters: DebuggerMethods, DebuggerRequires.
Lint/Debugger:
Exclude:
- 'spec/spec_helper.rb'

# Offense count: 1
# Configuration parameters: AllowedParentClasses.
Lint/MissingSuper:
Exclude:
- 'app/components/event_card_component.rb'

# Offense count: 1
# Configuration parameters: AllowKeywordBlockArguments.
Lint/UnderscorePrefixedVariableName:
Exclude:
- 'spec/models/group_spec.rb'

# Offense count: 32
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
Metrics/AbcSize:
Expand Down Expand Up @@ -147,22 +108,6 @@ Metrics/PerceivedComplexity:
- 'app/services/invitation_manager.rb'
- 'lib/omniauth/strategies/codebar.rb'

# Offense count: 6
Naming/AccessorMethodName:
Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/admin/meetings_controller.rb'
- 'app/controllers/admin/workshops_controller.rb'
- 'app/controllers/feedback_controller.rb'

# Offense count: 1
# Configuration parameters: EnforcedStyle, AllowedPatterns, ForbiddenIdentifiers, ForbiddenPatterns.
# SupportedStyles: snake_case, camelCase
# ForbiddenIdentifiers: __id__, __send__
Naming/MethodName:
Exclude:
- 'app/models/member.rb'

# Offense count: 10
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
# NamePrefix: is_, has_, have_, does_
Expand All @@ -172,7 +117,6 @@ Naming/MethodName:
Naming/PredicatePrefix:
Exclude:
- 'app/controllers/application_controller.rb'
- 'app/models/member.rb'
- 'app/models/workshop.rb'
- 'app/policies/application_policy.rb'
- 'app/policies/chapter_policy.rb'
Expand All @@ -182,23 +126,8 @@ Naming/PredicatePrefix:
# Offense count: 2
RSpec/AnyInstance:
Exclude:
- 'spec/controllers/member/details_controller_spec.rb'
- 'spec/support/helpers/login_helpers.rb'

# Offense count: 1
# Configuration parameters: Max, CountAsOne.
RSpec/ExampleLength:
Exclude:
- 'spec/features/admin/event_spec.rb'

# Offense count: 3
# Configuration parameters: Max.
RSpec/MultipleExpectations:
Exclude:
- 'spec/features/admin/event_spec.rb'
- 'spec/features/admin/sponsor_spec.rb'
- 'spec/lib/omniauth/strategies/codebar_spec.rb'

# Offense count: 5
Rails/HasAndBelongsToMany:
Exclude:
Expand Down
1 change: 1 addition & 0 deletions app/components/event_card_component.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class EventCardComponent < ViewComponent::Base
def initialize(event_card:, user: nil)
super()
@event = event_card
@user = user
end
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/admin/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def new

def create
@event = Event.new(event_params)
set_organisers(organiser_ids)
assign_organisers(organiser_ids)

if @event.save
redirect_to [:admin, @event], notice: 'Event successfully created.'
Expand All @@ -31,7 +31,7 @@ def show
end

def update
set_organisers(organiser_ids)
assign_organisers(organiser_ids)

if @event.update(event_params)
redirect_to [:admin, @event], notice: 'You have just updated the event'
Expand Down Expand Up @@ -94,7 +94,7 @@ def grant_organiser_access(organiser_ids = [])
organiser_ids.each { |id| Member.find(id).add_role(:organiser, @event) }
end

def set_organisers(organiser_ids)
def assign_organisers(organiser_ids)
organiser_ids.reject!(&:empty?)
grant_organiser_access(organiser_ids)
revoke_organiser_access(organiser_ids)
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/admin/meetings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def create
@meeting = Meeting.new(meeting_params)

if @meeting.save
set_organisers(organiser_ids)
set_chapters(chapter_ids)
assign_organisers(organiser_ids)
assign_chapters(chapter_ids)
redirect_to [:admin, @meeting], notice: t('admin.messages.meeting.created')
else
flash[:notice] = @meeting.errors.full_messages.join(', ')
Expand All @@ -27,8 +27,8 @@ def show
def edit; end

def update
set_organisers(organiser_ids)
set_chapters(chapter_ids)
assign_organisers(organiser_ids)
assign_chapters(chapter_ids)

if @meeting.update(meeting_params)
redirect_to [:admin, @meeting], notice: t('admin.messages.meeting.updated')
Expand Down Expand Up @@ -86,13 +86,13 @@ def revoke_organiser_access(organiser_ids)
end
end

def set_organisers(organiser_ids)
def assign_organisers(organiser_ids)
organiser_ids.reject!(&:empty?)
grant_organiser_access(organiser_ids)
revoke_organiser_access(organiser_ids)
end

def set_chapters(chapter_ids)
def assign_chapters(chapter_ids)
chapter_ids.reject!(&:empty?)
@meeting.chapters = chapter_ids.map { |id| Chapter.find(id) }
end
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/admin/workshops_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def create

if workshop_type_valid? && @workshop.save
grant_organiser_access(@workshop.chapter.organisers.pluck(:id))
set_host(host_id)
assign_host(host_id)

redirect_to admin_workshop_path(@workshop), notice: I18n.t('admin.messages.workshop.created')
else
Expand Down Expand Up @@ -144,7 +144,7 @@ def workshop_id
params.permit(:workshop_id)[:workshop_id]
end

def set_host(host_id)
def assign_host(host_id)
return unless host_id

host = @workshop.workshop_sponsors.find_or_initialize_by(sponsor_id: host_id)
Expand All @@ -154,7 +154,7 @@ def set_host(host_id)
host.update(host: true)
end

def set_organisers(organiser_ids)
def assign_organisers(organiser_ids)
organiser_ids.reject!(&:empty?)
grant_organiser_access(organiser_ids)
revoke_organiser_access(organiser_ids)
Expand Down Expand Up @@ -199,7 +199,7 @@ def workshop_type_valid?
end

def update_workshop_details
set_organisers(organiser_ids)
set_host(host_id)
assign_organisers(organiser_ids)
assign_host(host_id)
end
end
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ def chapters
end

def redirect_back(fallback_location:, **args)
if referer = request.headers['Referer']
referer = request.headers['Referer']
if referer
redirect_to referer, **args
else
redirect_to fallback_location, **args
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/feedback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def show
return redirect_to root_path
end

set_coaches(feedback_request.workshop)
assign_coaches(feedback_request.workshop)

@workshop = feedback_request.workshop
@feedback = Feedback.new
Expand All @@ -22,7 +22,7 @@ def submit
redirect_to root_path
else
feedback_request = FeedbackRequest.find_by!(token: params[:id], submited: false)
set_coaches(feedback_request.workshop)
assign_coaches(feedback_request.workshop)

@workshop = feedback_request.workshop
@feedback = Feedback.new(feedback_params)
Expand All @@ -39,7 +39,7 @@ def feedback_params
params.expect(feedback: %i[coach_id tutorial_id request rating suggestions])
end

def set_coaches(workshop)
def assign_coaches(workshop)
@coaches = workshop.invitations.to_coaches.accepted_or_attended
.order(Arel.sql('attended DESC NULLS LAST'))
.map(&:member)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/workshop_invitation_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def accept
return back_with_message(t('messages.already_rsvped')) if @invitation.attending?
return back_with_message(t('messages.invitations.closed')) unless workshop.rsvp_available?

if user.has_existing_RSVP_on(workshop.date_and_time)
if user.existing_rsvp_on?(workshop.date_and_time)
return back_with_message(t('messages.invitations.rsvped_to_other_workshop'))
end

Expand Down
3 changes: 2 additions & 1 deletion app/models/feedback.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ class Feedback < ApplicationRecord
validates :tutorial, presence: true

def self.submit_feedback(params, token)
return false unless feedback_request = FeedbackRequest.find_by(token: token)
feedback_request = FeedbackRequest.find_by(token: token)
return false unless feedback_request

feedback = Feedback.new(params)
feedback.workshop = feedback_request.workshop
Expand Down
2 changes: 1 addition & 1 deletion app/models/member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def requires_additional_details?
can_log_in? && !valid?
end

def has_existing_RSVP_on(date)
def existing_rsvp_on?(date)
invitations_on(date).any?
end

Expand Down
Loading