diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 8fdf192a0..08de57791 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit` -# on 2026-07-28 13:33:16 UTC using RuboCop version 1.88.2. +# on 2026-07-28 13:49:30 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 @@ -18,14 +18,6 @@ Capybara/RSpec/VisibilityMatcher: Exclude: - 'spec/components/chapters_sidebar_component_spec.rb' -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowedMethods, AllowedPatterns. -Lint/AmbiguousBlockAssociation: - Exclude: - - 'spec/controllers/admin/member_notes_controller_spec.rb' - - 'spec/services/three_month_email_service_spec.rb' - # Offense count: 2 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: AllowSafeAssignment. @@ -60,34 +52,11 @@ Lint/UnderscorePrefixedVariableName: Exclude: - 'spec/models/group_spec.rb' -# Offense count: 8 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. -Lint/UnusedBlockArgument: - Exclude: - - 'spec/fabricators/member_fabricator.rb' - - 'spec/fabricators/sponsor_fabricator.rb' - -# Offense count: 9 -# This cop supports safe autocorrection (--autocorrect). -Lint/UselessAssignment: - Exclude: - - 'spec/features/admin/event_spec.rb' - - 'spec/features/subscribing_to_emails_spec.rb' - - 'spec/lib/tasks/delete_member_rake_spec.rb' - - 'spec/models/meeting_spec.rb' - - 'spec/models/tutorial_spec.rb' - - 'spec/presenters/member_presenter_spec.rb' - - 'spec/support/select_from_chosen.rb' - -# Offense count: 8 +# Offense count: 5 # This cop supports unsafe autocorrection (--autocorrect-all). Lint/UselessTimes: Exclude: - - 'spec/features/listing_coaches_spec.rb' - - 'spec/models/chapter_spec.rb' - 'spec/models/event_spec.rb' - - 'spec/models/workshop_invitation_spec.rb' - 'spec/models/workshop_spec.rb' # Offense count: 32 @@ -227,14 +196,6 @@ Naming/PredicatePrefix: - 'app/policies/event_policy.rb' - 'app/policies/workshop_policy.rb' -# Offense count: 2 -# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns. -# SupportedStyles: snake_case, normalcase, non_integer -# AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64 -Naming/VariableNumber: - Exclude: - - 'spec/models/tutorial_spec.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: SafeMultiline. diff --git a/spec/controllers/admin/member_notes_controller_spec.rb b/spec/controllers/admin/member_notes_controller_spec.rb index a839f2bb5..57fafc0a5 100644 --- a/spec/controllers/admin/member_notes_controller_spec.rb +++ b/spec/controllers/admin/member_notes_controller_spec.rb @@ -7,7 +7,7 @@ it "Doesn't allow anonymous users to create notes" do expect do post :create, params: { member_note: { note: member_note.note, member_id: member.id } } - end.not_to change { MemberNote.all.count } + end.not_to(change { MemberNote.all.count }) end it "Doesn't allow regular users to create notes" do @@ -15,7 +15,7 @@ expect do post :create, params: { member_note: { note: member_note.note, member_id: member.id } } - end.not_to change { MemberNote.all.count } + end.not_to(change { MemberNote.all.count }) end it 'Allows chapter organisers to create notes' do @@ -30,7 +30,7 @@ it "Doesn't allow blank notes to be created" do expect do post :create, params: { member_note: { note: ' ', member_id: member.id } } - end.not_to change { MemberNote.all.count } + end.not_to(change { MemberNote.all.count }) end end end diff --git a/spec/fabricators/member_fabricator.rb b/spec/fabricators/member_fabricator.rb index 0564bcb48..9317eac5e 100644 --- a/spec/fabricators/member_fabricator.rb +++ b/spec/fabricators/member_fabricator.rb @@ -13,11 +13,11 @@ end Fabricator(:student, from: :member) do - groups(count: 2) { |attrs, i| Fabricate(:students) } + groups(count: 2) { |_attrs, _i| Fabricate(:students) } end Fabricator(:coach, from: :member) do - groups(count: 2) { |attrs, i| Fabricate(:coaches) } + groups(count: 2) { |_attrs, _i| Fabricate(:coaches) } end Fabricator(:banned_member, from: :member) do @@ -26,7 +26,7 @@ Fabricator(:banned_student, from: :member) do bans(count: 1) { Fabricate(:ban) } - groups(count: 1) { |attrs, i| Fabricate(:students) } + groups(count: 1) { |_attrs, _i| Fabricate(:students) } end Fabricator(:chapter_organiser, from: :member) do diff --git a/spec/fabricators/sponsor_fabricator.rb b/spec/fabricators/sponsor_fabricator.rb index 7b3e25ce8..119830340 100644 --- a/spec/fabricators/sponsor_fabricator.rb +++ b/spec/fabricators/sponsor_fabricator.rb @@ -21,14 +21,14 @@ end Fabricator(:sponsor_with_member_contacts, from: :sponsor) do - after_build do |sponsor, transients| + after_build do |sponsor, _transients| Fabricate.times(3, :member_contact, sponsor: sponsor) end end Fabricator(:sponsor_with_contacts, from: :sponsor_full) do - after_build do |sponsor, transients| + after_build do |sponsor, _transients| Fabricate(:contact, sponsor: sponsor) end diff --git a/spec/features/admin/event_spec.rb b/spec/features/admin/event_spec.rb index a88a0e87f..2c0587a03 100644 --- a/spec/features/admin/event_spec.rb +++ b/spec/features/admin/event_spec.rb @@ -45,7 +45,7 @@ describe 'can successfully create a virtual event' do scenario 'when they fill in all mandatory fields' do - sponsor = Fabricate(:sponsor) + Fabricate(:sponsor) date = Time.zone.today + 2.days visit new_admin_event_path diff --git a/spec/features/listing_coaches_spec.rb b/spec/features/listing_coaches_spec.rb index 86b772cbb..6788d4969 100644 --- a/spec/features/listing_coaches_spec.rb +++ b/spec/features/listing_coaches_spec.rb @@ -27,7 +27,7 @@ current_workshop = Fabricate(:workshop, date_and_time: Time.current) latest_workshop = Fabricate(:workshop, date_and_time: 1.year.ago) old_workshop = Fabricate(:workshop, date_and_time: 3.years.ago) - 1.times { Fabricate(:attended_coach, workshop: current_workshop) } + Fabricate(:attended_coach, workshop: current_workshop) 3.times { Fabricate(:attended_coach, workshop: latest_workshop) } 2.times { Fabricate(:attended_coach, workshop: old_workshop) } diff --git a/spec/features/subscribing_to_emails_spec.rb b/spec/features/subscribing_to_emails_spec.rb index 1caa02fe5..2f080912d 100644 --- a/spec/features/subscribing_to_emails_spec.rb +++ b/spec/features/subscribing_to_emails_spec.rb @@ -15,7 +15,7 @@ end scenario '#unsubscribe' do - subscription = Fabricate.create(:subscription, member: member, group: group) + Fabricate.create(:subscription, member: member, group: group) visit subscriptions_path click_on 'Subscribed' diff --git a/spec/lib/tasks/delete_member_rake_spec.rb b/spec/lib/tasks/delete_member_rake_spec.rb index 38499d09f..9265536e8 100644 --- a/spec/lib/tasks/delete_member_rake_spec.rb +++ b/spec/lib/tasks/delete_member_rake_spec.rb @@ -19,7 +19,7 @@ invitations = Fabricate.times(2, :workshop_invitation, member: member) tokens = invitations.map(&:token) - subscriptions = Fabricate.times(1, :subscription, member: member) + Fabricate.times(1, :subscription, member: member) allow($stdin).to receive(:getch) diff --git a/spec/models/chapter_spec.rb b/spec/models/chapter_spec.rb index 14d132002..1362c1d65 100644 --- a/spec/models/chapter_spec.rb +++ b/spec/models/chapter_spec.rb @@ -34,7 +34,7 @@ context 'scopes' do describe '#active' do it 'only returns active Chapters' do - 1.times { Fabricate(:chapter) } + Fabricate(:chapter) 2.times { Fabricate(:chapter, active: false) } expect(described_class.active.all.count).to eq(1) diff --git a/spec/models/meeting_spec.rb b/spec/models/meeting_spec.rb index 9f7d036db..4a61346ad 100644 --- a/spec/models/meeting_spec.rb +++ b/spec/models/meeting_spec.rb @@ -11,7 +11,7 @@ describe '#slug' do it 'fails when slug not present' do - meeting = Fabricate(:meeting, slug: 'meeting') + Fabricate(:meeting, slug: 'meeting') new_meeting = Fabricate.build(:meeting, slug: 'meeting') new_meeting.slug = '' new_meeting.valid? @@ -20,7 +20,7 @@ end it 'passes if slug present' do - meeting = Fabricate(:meeting, slug: 'meeting') + Fabricate(:meeting, slug: 'meeting') new_meeting = Fabricate.build(:meeting, slug: 'meeting') new_meeting.date_and_time = nil new_meeting.slug = 'meeting' diff --git a/spec/models/tutorial_spec.rb b/spec/models/tutorial_spec.rb index fd3de45e7..8052cfd8c 100644 --- a/spec/models/tutorial_spec.rb +++ b/spec/models/tutorial_spec.rb @@ -16,8 +16,8 @@ end it 'gets all titles' do - tutorial_1 = described_class.create(title: 'title1') - tutorial_2 = described_class.create(title: 'title2') + described_class.create(title: 'title1') + described_class.create(title: 'title2') expect(described_class.all_titles).to match_array(%w[title1 title2]) end diff --git a/spec/models/workshop_invitation_spec.rb b/spec/models/workshop_invitation_spec.rb index 2b880ac80..5c578f13e 100644 --- a/spec/models/workshop_invitation_spec.rb +++ b/spec/models/workshop_invitation_spec.rb @@ -79,7 +79,7 @@ old_workshop = Fabricate(:workshop, date_and_time: Time.zone.now - 2.years) 2.times { Fabricate(:attended_coach, workshop: new_workshop) } - 1.times { Fabricate(:attended_coach, workshop: old_workshop) } + Fabricate(:attended_coach, workshop: old_workshop) expect(described_class.year(Time.zone.now.year).count).to eq(2) expect(described_class.year((Time.zone.now - 2.years).year).count).to eq(1) diff --git a/spec/presenters/member_presenter_spec.rb b/spec/presenters/member_presenter_spec.rb index 885665b60..4b572c070 100644 --- a/spec/presenters/member_presenter_spec.rb +++ b/spec/presenters/member_presenter_spec.rb @@ -74,7 +74,7 @@ it 'returns false for organiser of a different chapter' do other_chapter = Fabricate(:chapter) - other_workshop = Fabricate(:workshop_no_sponsor, chapter: other_chapter) + Fabricate(:workshop_no_sponsor, chapter: other_chapter) organiser = Fabricate(:member) organiser.add_role(:organiser, other_chapter) presenter = described_class.new(organiser) diff --git a/spec/services/three_month_email_service_spec.rb b/spec/services/three_month_email_service_spec.rb index d1dc27f52..19308784b 100644 --- a/spec/services/three_month_email_service_spec.rb +++ b/spec/services/three_month_email_service_spec.rb @@ -100,12 +100,12 @@ it 'does not email a member already present in member_email_deliveries' do expect { perform_enqueued_jobs { call } } - .not_to change { MemberEmailDelivery.where(member: already_emailed_student).count } + .not_to(change { MemberEmailDelivery.where(member: already_emailed_student).count }) end it 'does not email students with a recent attended workshop' do expect { perform_enqueued_jobs { call } } - .not_to change { MemberEmailDelivery.where(member: student_with_recent_attendance).count } + .not_to(change { MemberEmailDelivery.where(member: student_with_recent_attendance).count }) end it 'does not email members without a student subscription' do diff --git a/spec/support/select_from_chosen.rb b/spec/support/select_from_chosen.rb index 4bdc62589..70c52cbf1 100644 --- a/spec/support/select_from_chosen.rb +++ b/spec/support/select_from_chosen.rb @@ -10,7 +10,7 @@ module SelectFromChosen def select_from_chosen(item_text, options) # Find the native