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
75 changes: 29 additions & 46 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit`
# on 2026-07-28 07:23:34 UTC using RuboCop version 1.88.2.
# on 2026-07-28 07:56:09 UTC using RuboCop version 1.88.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -18,78 +18,53 @@ Capybara/RSpec/VisibilityMatcher:
Exclude:
- 'spec/components/chapters_sidebar_component_spec.rb'

# Offense count: 2
# Offense count: 3
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_argument, with_fixed_indentation
Layout/ArgumentAlignment:
Exclude:
- 'app/controllers/admin/invitations_controller.rb'
- 'spec/features/member_portal_spec.rb'

# Offense count: 14
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: with_first_element, with_fixed_indentation
Layout/ArrayAlignment:
Exclude:
- 'app/controllers/admin/events_controller.rb'
- 'app/controllers/admin/workshops_controller.rb'
- 'app/controllers/concerns/member_concerns.rb'

# Offense count: 9
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Layout/BlockEndNewline:
Exclude:
- 'spec/components/event_card_component_spec.rb'
- 'spec/controllers/member/details_controller_spec.rb'
- 'spec/controllers/payments_controller_spec.rb'
- 'spec/features/admin/member_search_spec.rb'
- 'spec/features/manage_contact_preferences_spec.rb'
- 'spec/features/viewing_pages_spec.rb'
- 'spec/helpers/email_header_helper_spec.rb'
- 'spec/models/eligibility_inquiry_spec.rb'
- 'spec/models/feedback_request_spec.rb'
- 'app/models/workshop_invitation.rb'

# Offense count: 2
# Offense count: 6
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
Layout/ExtraSpacing:
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_braces
Layout/FirstHashElementIndentation:
Exclude:
- 'spec/support/capybara.rb'
- 'lib/omniauth/strategies/codebar.rb'

# Offense count: 16
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/HashAlignment:
Exclude:
- 'lib/omniauth/strategies/codebar.rb'
- 'spec/lib/services/mailing_list_spec.rb'

# Offense count: 9
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
# URISchemes: http, https
Layout/LineLength:
Exclude:
- 'Gemfile'
- 'app/controllers/admin/invitations_controller.rb'
- 'app/controllers/concerns/member_concerns.rb'
- 'app/controllers/dashboard_controller.rb'
- 'app/models/workshop_invitation.rb'
- 'lib/tasks/setup.rake'

# Offense count: 2
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, IndentationWidth.
# SupportedStyles: aligned, indented, indented_relative_to_receiver
Layout/MultilineMethodCallIndentation:
Exclude:
- 'spec/support/shared_examples/behaves_like_sending_workshop_emails.rb'
- 'app/controllers/dashboard_controller.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowInHeredoc.
Layout/TrailingWhitespace:
Exclude:
- 'app/controllers/admin/invitations_controller.rb'

# Offense count: 10
# This cop supports safe autocorrection (--autocorrect).
Expand Down Expand Up @@ -979,6 +954,14 @@ Style/InverseMethods:
Exclude:
- 'app/controllers/admin/chapters_controller.rb'

# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: line_count_dependent, lambda, literal
Style/Lambda:
Exclude:
- 'app/models/workshop_invitation.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/LineEndConcatenation:
Expand Down
12 changes: 9 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ ruby file: '.ruby-version'
gem 'rails', '~> 8.1.2' # LOCKED: It is Rails.
# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
gem 'sprockets-rails'
gem 'coffee-script' # LOCKED: Added because Sprockets autoloads it when seeing .coffee files in the asset pipeline. Can be removed when that does not happen.
# LOCKED: Added because Sprockets autoloads it when seeing .coffee files in the
# asset pipeline. Can be removed when that does not happen.
gem 'coffee-script'

gem 'amazing_print' # colourful output (suggested by rails_semantic_logger)
gem 'rails_semantic_logger' # condense log lines: https://github.com/codebar/planner/issues/2339
Expand All @@ -14,7 +16,9 @@ gem 'benchmark' # LOCKED: Added because of activesupport 7.0
gem 'bigdecimal' # LOCKED: Added because of activesupport 7.0
gem 'carrierwave'
gem 'cocoon'
gem 'csv' # LOCKED: csv was loaded from the standard library, but is not part of the default gems starting from Ruby 3.4.0. Due to config/application.rb
# LOCKED: csv was loaded from the standard library, but is not part of the default
# gems starting from Ruby 3.4.0. Due to config/application.rb
gem 'csv'
gem 'delayed_job'
gem 'delayed_job_active_record'
gem 'drb' # LOCKED: Added because of pry-remote
Expand All @@ -40,7 +44,9 @@ gem 'premailer-rails'

gem 'pundit'
gem 'reline' # LOCKED: Added because of readline is not part of Ruby 3.5.0
gem 'readline' # LOCKED: readline was loaded from the standard library, but is not part of the default gems starting from Ruby 4.0.0.
# LOCKED: readline was loaded from the standard library, but is not part of the
# default gems starting from Ruby 4.0.0.
gem 'readline'
gem 'rolify'
# Use Sass to process CSS
gem 'sassc-rails'
Expand Down
17 changes: 9 additions & 8 deletions app/controllers/admin/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ def set_event
def event_params
params.expect(event: [
:virtual, :name, :slug, :date_and_time, :local_date, :local_time, :local_end_time, :description,
:info, :schedule, :venue_id, :external_url, :coach_spaces, :student_spaces, :email, :announce_only,
:tito_url, :invitable, :time_zone, :student_questionnaire, :confirmation_required, :surveys_required,
:audience, :coach_questionnaire, :show_faq, :display_coaches, :display_students,
{ bronze_sponsor_ids: [] },
{ silver_sponsor_ids: [] },
{ gold_sponsor_ids: [] },
{ sponsor_ids: [] },
{ chapter_ids: [] }
:info, :schedule, :venue_id, :external_url, :coach_spaces, :student_spaces, :email, :announce_only,
:tito_url, :invitable, :time_zone, :student_questionnaire,
:confirmation_required, :surveys_required,
:audience, :coach_questionnaire, :show_faq, :display_coaches, :display_students,
{ bronze_sponsor_ids: [] },
{ silver_sponsor_ids: [] },
{ gold_sponsor_ids: [] },
{ sponsor_ids: [] },
{ chapter_ids: [] }
])
end

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/admin/invitations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ def update

if request.xhr?
if params[:attended].present?
render partial: 'admin/workshop/attendance_row', locals: { invitation: InvitationPresenter.new(@invitation), workshop: @workshop }
render partial: 'admin/workshop/attendance_row',
locals: { invitation: InvitationPresenter.new(@invitation), workshop: @workshop }
else
set_admin_workshop_data
render partial: 'admin/workshops/invitation_management'
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 @@ -119,11 +119,11 @@ def changes
def workshop_params
params.expect(workshop: [
:local_date, :local_time, :local_end_time, :chapter_id,
:invitable, :seats, :virtual, :slack_channel, :slack_channel_link,
:rsvp_open_local_date, :rsvp_open_local_time, :description,
:rsvp_close_local_date, :rsvp_close_local_time,
:coach_spaces, :student_spaces,
{ sponsor_ids: [] }
:invitable, :seats, :virtual, :slack_channel, :slack_channel_link,
:rsvp_open_local_date, :rsvp_open_local_time, :description,
:rsvp_close_local_date, :rsvp_close_local_time,
:coach_spaces, :student_spaces,
{ sponsor_ids: [] }
])
end

Expand Down
5 changes: 3 additions & 2 deletions app/controllers/concerns/member_concerns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ module InstanceMethods

def member_params
params.expect(member: [
:pronouns, :name, :surname, :email, :mobile, :about_you, :skill_list, :newsletter, :other_dietary_restrictions, :how_you_found_us,
:how_you_found_us_other_reason, { dietary_restrictions: [] }
:pronouns, :name, :surname, :email, :mobile, :about_you, :skill_list,
:newsletter, :other_dietary_restrictions, :how_you_found_us,
:how_you_found_us_other_reason, { dietary_restrictions: [] }
]).tap do |permitted_params|
# We want to keep Rails' hidden blank field in the form so that all dietary restrictions for a member can be
# removed by submitting the form with all check boxes unticked. However, we want to remove the blank value
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def show

def dashboard
@user = MemberPresenter.new(current_user)
@ordered_events = DashboardQuery.upcoming_events_for_user(current_user).map.each_with_object({}) do |(key, value), hash|
@ordered_events = DashboardQuery.upcoming_events_for_user(current_user)
.map.each_with_object({}) do |(key, value), hash|
hash[key] = EventPresenter.decorate_collection(value)
end
@announcements = current_user.announcements.active
Expand Down
3 changes: 2 additions & 1 deletion app/models/workshop_invitation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class WorkshopInvitation < ApplicationRecord
scope :last_six_months, -> { joins(:workshop).where(workshops: { date_and_time: 6.months.ago...Time.zone.now }) }
scope :not_reminded, -> { where(reminded_at: nil) }
scope :on_waiting_list, -> { joins(:waiting_list) }
scope :with_notes_and_their_authors, -> { includes(member: [{ member_notes: :author }, :attendance_warnings]).includes(:overrider) }
scope :with_notes_and_their_authors, -> {
includes(member: [{ member_notes: :author }, :attendance_warnings]).includes(:overrider) }

def waiting_list_position
@waiting_list_position ||= WaitingList.by_workshop(workshop)
Expand Down
27 changes: 14 additions & 13 deletions lib/omniauth/strategies/codebar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,17 @@ def callback_phase
email = payload['email'] || payload['sub']
@env['omniauth.auth'] = AuthHash.new({
provider: name,
uid: email,
info: {
uid: email,
info: {
email: email,
name: payload['name'] || email
},
credentials: {
credentials: {
token: tokens['access_token'],
expires: tokens['expires_at'],
refresh_token: tokens['refresh_token']
},
extra: {
extra: {
raw_info: payload
}
})
Expand Down Expand Up @@ -141,10 +141,11 @@ def exchange_code(code, code_verifier)
request['User-Agent'] = 'Codebar Planner/1.0'
request.body = URI.encode_www_form({
grant_type: 'authorization_code',
code: code,
client_id: 'planner',
redirect_uri: session.delete('omniauth.codebar.redirect_uri') || callback_url,
code_verifier: code_verifier
code: code,
client_id: 'planner',
redirect_uri: session.delete('omniauth.codebar.redirect_uri') ||
callback_url,
code_verifier: code_verifier
})

response = http_for(uri).request(request)
Expand All @@ -168,11 +169,11 @@ def verify_jwt(token)
decode = lambda { |jwks|
JWT.decode(token, nil, true, {
algorithms: %w[RS256],
jwks: jwks,
iss: options.auth_url,
aud: options.audience,
verify_iss: true,
verify_aud: true
jwks: jwks,
iss: options.auth_url,
aud: options.audience,
verify_iss: true,
verify_aud: true
}).first
}

Expand Down
6 changes: 4 additions & 2 deletions lib/tasks/setup.rake
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ namespace :setup do
def check_postgresql
if !system('which psql > /dev/null 2>&1')
error('PostgreSQL', 'psql not found',
'Install: brew install postgresql && brew services start postgresql (macOS) or see docs/development-setup.md')
'Install: brew install postgresql && brew services start postgresql (macOS)' \
' or see docs/development-setup.md')
return
end

Expand All @@ -112,7 +113,8 @@ namespace :setup do
ok('PostgreSQL', "running and accepting connections on #{host}:#{port}")
else
error('PostgreSQL', "not accepting connections on #{host}:#{port}",
'Start PostgreSQL: brew services start postgresql (macOS). Check credentials in config/database.yml or env vars.')
'Start PostgreSQL: brew services start postgresql (macOS).' \
' Check credentials in config/database.yml or env vars.')
end
end

Expand Down
1 change: 0 additions & 1 deletion spec/components/event_card_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,4 @@
expect(page).to have_text('Attending')
end
end

end
1 change: 0 additions & 1 deletion spec/controllers/member/details_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@

expect(response.body).to include('You must select one option')
end

end
end
end
1 change: 0 additions & 1 deletion spec/controllers/payments_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@
expect(response).to be_successful
end
end

end
end
1 change: 0 additions & 1 deletion spec/features/admin/member_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@

expect(page).to have_text('Juliet Capulet')
end

end
1 change: 0 additions & 1 deletion spec/features/manage_contact_preferences_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
RSpec.feature 'Managing contact preferences', type: :feature do

context 'A sponsor contact can manage their contact preferences' do
let(:manager) { Fabricate(:member) }

Expand Down
1 change: 0 additions & 1 deletion spec/features/viewing_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@

expect(page).to have_text('Page not found')
end

end
1 change: 0 additions & 1 deletion spec/helpers/email_header_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,4 @@
helper.mail_to_member(member, 'Test Subject', 'from@codebar.io', 'cc@codebar.io', 'bcc@codebar.io')
end
end

end
6 changes: 3 additions & 3 deletions spec/lib/services/mailing_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
expect(client).to receive(:subscribe)
.with({
email: :email,
first_name: :first_name,
last_name: :last_name,
segment_ids: [:list_id]
first_name: :first_name,
last_name: :last_name,
segment_ids: [:list_id]
})

mailing_list.subscribe(:email, :first_name, :last_name)
Expand Down
1 change: 0 additions & 1 deletion spec/models/eligibility_inquiry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@

expect(eligibility_inquiry.issued_by).to eq(admin)
end

end
end
1 change: 0 additions & 1 deletion spec/models/feedback_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@
end
end
end

end
4 changes: 2 additions & 2 deletions spec/support/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# Try multiple patterns to find the headless shell executable on different platforms
cache_dir = File.expand_path('~/.cache/ms-playwright')
patterns = [
'chromium_headless_shell-*/**/headless_shell', # Linux
'chromium_headless_shell-*/**/chrome-headless-shell' # Mac
'chromium_headless_shell-*/**/headless_shell', # Linux
'chromium_headless_shell-*/**/chrome-headless-shell' # Mac
]

headless_shell = patterns.map do |pattern|
Expand Down
Loading