Skip to content

Conversation

@mroderick
Copy link
Collaborator

This PR is an attempt at removing dead code from the repository, to make it leaner and easier to maintain.

Starting it in draft, to see if the tests pass :)

mroderick and others added 6 commits January 13, 2026 18:50
The `available_spaces?` private method was defined but never called anywhere
in the controller or codebase. This method checked if a workshop had available
spaces for students or coaches based on the invitation role.

Analysis:
- No references found in any controller actions or concerns
- Not used in views or service objects
- Space availability checks are handled elsewhere in the application

This removal reduces code complexity and removes dead code that could
confuse future maintainers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The `Sponsor.latest` class method was defined but never called anywhere in
the application. This method returned the 15 most recent workshop sponsors by
querying WorkshopSponsor and extracting unique sponsor records.

Analysis:
- No references found using `Sponsor.latest` in controllers, views, or services
- No references found using `.latest` on Sponsor model instances
- The application uses other scopes and queries to retrieve recent sponsors:
  - `recent_for_chapter` scope for chapter-specific recent sponsors
  - Direct workshop_sponsors associations for related queries
- The method's functionality (fetching recent sponsors via WorkshopSponsor)
  can be easily recreated if needed in the future

This removal eliminates unused code and reduces the model's API surface,
making the codebase easier to maintain and understand.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Removed multiple blocks of commented-out code that serve no purpose and
clutter the codebase, making it harder to maintain and understand.

Analysis of removed code:

1. app/views/admin/events/_invitation_management.html.haml (13 lines)
   - Commented-out simple_form_for implementation for manual RSVP management
   - Old form that allowed manually adding invitations via dropdown
   - Functionality has been replaced or removed from the application
   - No indication this code needs to be restored

2. app/views/events/_faq.html.haml (13 lines)
   - Two commented-out FAQ items about experience requirements and contributions
   - These questions were likely removed to simplify event requirements
   - Content is outdated (references http://tutorials.codebar.io)
   - If needed, can be recreated from localization files

3. app/uploaders/avatar_uploader.rb (18 lines)
   - Commented-out CarrierWave generator boilerplate
   - Includes unused examples: default_url, scale processing, filename override
   - Standard Rails practice is to remove unused generator comments
   - Well-documented in CarrierWave docs if needed

4. app/uploaders/image_uploader.rb (18 lines)
   - Same as avatar_uploader - unused CarrierWave boilerplate
   - Includes commented storage options and example methods
   - Removes visual clutter without affecting functionality

Impact:
- Removes 62 lines of dead code across 4 files
- Improves code readability and reduces cognitive load
- Makes it clear what the actual implementation is vs. unused alternatives
- Reduces confusion for developers trying to understand current behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The `latest_members` scope was defined but never called anywhere in the
application. This scope joined the members association and ordered by
created_at, but had no references in the codebase.

Analysis:
- Searched for `Group.latest_members` - no results found
- Searched for `.latest_members` on Group instances - no results found
- Not used in any controllers, views, services, or other models
- The Group model has other scopes (students, coaches) that ARE actively used
- Other models have different approaches for getting latest members directly

The application retrieves members through the `has_many :members, through:
:subscriptions` association when needed, making this scope redundant even if
it were to be used.

This removal reduces the model's API surface and eliminates potentially
confusing unused code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The `no_admins` scope was defined but never used in production code. It only
existed in specs to test itself, which provides no value. This is a classic
example of testing implementation rather than behavior.

Analysis:
- Searched for `Role.no_admins` - only found in model definition and its spec
- Not used in any controllers, views, services, or other models
- The scope filtered out Admin roles, but no feature actually needs this
- Role is a simple join model managed by Rolify gem
- Role permissions are checked via `member.has_role?(:admin)` not via scopes

Changes:
1. Removed `scope :no_admins` from app/models/role.rb
2. Simplified spec/models/role_spec.rb to remove the now-unnecessary test
3. Added comment explaining Role is managed by Rolify and doesn't need
   model-specific tests currently

Impact:
- Reduces model API surface
- Removes test that only verified the scope implementation worked
- Eliminates confusion about when/how to filter admin roles
- Role model is now minimal and focused on its purpose as a join model

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The `reminders` method was defined but never called anywhere in the
application. This method returned waiting list entries with `auto_rsvp:
false`, but no view or controller ever used this functionality.

Analysis:
- Searched for `.reminders` calls - no results found
- The presenter is instantiated in Admin::WorkshopConcerns
- Views only use the `list` method (auto_rsvp: true) to display the waiting
  list in app/views/admin/workshop/_waiting_list.html.haml
- The waiting list feature only shows users who opted in for auto-RSVP
- No UI or feature exists for handling manual reminder cases

The `list` method is retained as it IS actively used:
- Called in app/views/admin/workshop/_waiting_list.html.haml (lines 1, 13)
- Filters waiting list to show only auto-RSVP enabled entries
- Essential for the waiting list display functionality

Impact:
- Removes unused method that could confuse developers about waiting list
  behavior
- Clarifies that waiting list only handles auto-RSVP scenarios
- Reduces presenter API surface to only what's actually needed

Note: No spec files existed for this presenter, so no test cleanup needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mroderick
Copy link
Collaborator Author

OK, I need to take smaller tests and run the tests locally after each change. Closing this

@mroderick mroderick closed this Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant