Skip to content

Conversation

@jcouball
Copy link
Member

@jcouball jcouball commented Nov 11, 2025

Summary

Refactored the monolithic 79-line Rakefile into a clean 15-line loader that dynamically imports task definitions from separate files in the tasks/ directory.

Changes

New Structure

  • Created tasks/ directory with 5 focused rake files:
    • tasks/test.rake - test execution tasks
    • tasks/rubocop.rake - RuboCop linting tasks
    • tasks/yard.rake - YARD documentation tasks
    • tasks/gem_tasks.rake - gem building and release tasks
    • tasks/test_gem.rake - gem sanity check task

Main Rakefile

  • Now loads all .rake files from tasks/ directory
  • Dynamically builds default task list based on available tasks
  • Reduced from 79 lines to 15 lines
  • Improved separation of concerns

Platform Logic

  • Moved platform-specific logic (JRuby/TruffleRuby check) into yard.rake where it belongs
  • Each task file now encapsulates its own requirements and constraints

Maintained Functionality

All original functionality is preserved:

  • ✅ Default tasks remain: test, rubocop, yard, yardstick:coverage, build
  • yardstick remains commented out of defaults (too many warnings)
  • ✅ All task descriptions and behavior unchanged
  • ✅ Platform-specific behavior preserved
  • ✅ All rake commands work identically

Benefits

  1. Better organization - Related tasks are grouped together
  2. Easier maintenance - Changes to specific task groups are isolated
  3. Improved readability - Main Rakefile is now simple and clear
  4. Separation of concerns - Each file has a single responsibility

Testing

rake -T  # All tasks available
rake --dry-run  # Confirms default task sequence
rake  # Successfully runs all default tasks

Summary

Remove redundant regexp escape in BRANCH_LINE_REGEXP flagged by new RuboCop cop Style/RedundantRegexpEscape.

Details

Before: (?<detached_ref>[^\)]+)
After: (?<detached_ref>[^)]+)

This is a purely stylistic cleanup with no behavior change.

Rationale

RuboCop now detects unnecessary escaping of ) inside a character class. Removing it reduces noise and keeps style consistent.

Verification

bundle exec rubocop reports zero offenses after the change.
rake test reports zero failures.

The monolithic 79-line Rakefile has been refactored into a clean
15-line loader that dynamically imports task definitions from the
tasks/ directory.

Changes:
- Created tasks/ directory with 5 focused rake files:
  - tasks/test.rake - test execution tasks
  - tasks/rubocop.rake - RuboCop linting tasks
  - tasks/yard.rake - YARD documentation tasks
  - tasks/gem_tasks.rake - gem building and release tasks
  - tasks/test_gem.rake - gem sanity check task

- Main Rakefile now:
  - Loads all .rake files from tasks/ directory
  - Dynamically builds default task list based on available tasks
  - Simplified from 79 lines to 15 lines

- Moved platform-specific logic (JRuby/TruffleRuby check) into
  yard.rake where it belongs

- Maintained all original functionality and default task behavior:
  - Default tasks: test, rubocop, yard, yardstick:coverage, build
  - yardstick remains commented out of defaults (too many warnings)

This refactoring improves maintainability and separation of concerns
while preserving all existing rake task functionality.
@jcouball jcouball merged commit 4a03b5c into main Nov 11, 2025
7 checks passed
@jcouball jcouball deleted the fix_redundant_regexp_escape branch November 11, 2025 18:07
@jcouball jcouball changed the title style: remove redundant escape in BRANCH_LINE_REGEXP build: refactor Rakefile by splitting tasks into separate files Nov 11, 2025
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.

2 participants