Skip to content

Conversation

@justin808
Copy link
Member

@justin808 justin808 commented Nov 16, 2025

Summary

  • Implements the --verbose/-v flag that was documented but not functional
  • Fixes OptionParser to properly handle the verbose flag
  • Updates all start() calls to pass through the verbose option

What was the problem?

The --verbose option was shown in bin/dev --help output but caused an OptionParser::InvalidOption error when used. This happened because:

  1. The help text documented --verbose, -v
  2. The start() method accepted a verbose: parameter
  3. But the OptionParser in run_from_command_line() didn't parse the flag
  4. All calls to start() hardcoded verbose: false

Changes

  • Added verbose: false to the options hash initialization
  • Implemented --verbose/-v flag parsing in OptionParser
  • Updated three start() calls to use options[:verbose] instead of hardcoded false
  • Added RuboCop disable/enable comments for AbcSize metric (slightly increased by parameter handling)

Test Plan

  • ✅ Manually tested --verbose and -v flags with all commands
  • ✅ All existing RSpec tests pass
  • ✅ RuboCop passes with no violations
  • ✅ Pre-commit and pre-push hooks pass

Testing

# All of these now work without error:
bin/dev --verbose
bin/dev -v
bin/dev static --verbose
bin/dev prod -v

Closes #1849

🤖 Generated with Claude Code


This change is Reviewable

The --verbose flag was documented in bin/dev --help but not
implemented in the OptionParser, causing an error when used.

This fix:
- Adds verbose: false to the options hash
- Implements --verbose/-v flag parsing in OptionParser
- Updates all start() calls to use options[:verbose] instead of hardcoded false
- Adds RuboCop disable comment for increased AbcSize metric

Closes #1849

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

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 16, 2025

Warning

Rate limit exceeded

@justin808 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 15 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between cbee429 and fdcb81d.

📒 Files selected for processing (1)
  • lib/react_on_rails/dev/server_manager.rb (3 hunks)
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch justin808/fix-dev-verbose-flag

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@justin808
Copy link
Member Author

@claude review this PR

@claude
Copy link

claude bot commented Nov 16, 2025

Claude finished @justin808's task —— View job


PR Review Complete ✅

Todo List

  • Read the changed file
  • Analyze the implementation
  • Provide review feedback

Code Review

This is a clean and straightforward fix that properly implements the --verbose flag functionality. The implementation correctly addresses all aspects of the problem described in the PR.

✅ What's Done Well

  1. Complete Implementation: The fix addresses all three parts of the problem:

    • ✅ Added verbose: false to options hash initialization (line 151)
    • ✅ Implemented OptionParser flag parsing (lines 164-166)
    • ✅ Updated all three start() calls to use options[:verbose] (lines 180, 183, 189)
  2. Consistent Approach: All three command cases (prod, static, and hmr/nil) now consistently pass through options[:verbose] instead of hardcoded false

  3. Proper Flag Syntax: The OptionParser correctly implements both short (-v) and long (--verbose) forms with proper help text

  4. RuboCop Handling: Appropriately added disable/enable comments for Metrics/AbcSize around the affected method

🔍 Minor Observations

  1. Line 180 Formatting: The start() call for production-assets is split across two lines to maintain readability. This is good practice given the line length.

  2. No Breaking Changes: The default behavior (verbose: false) is preserved, ensuring backward compatibility.

📝 Suggestions (Optional)

The code looks production-ready as-is. However, for future consideration:

  1. Verbose Flag Usage: The verbose flag is currently passed to PackGenerator.generate(verbose: verbose) in run_development() (line 449) and run_static_development() (line 442), but the _verbose parameter in run_production_like() is unused (line 288). This is likely intentional since production mode handles pack generation automatically during assets:precompile, but you might want to verify this is the desired behavior.

  2. Testing: While you mention manual testing was done, you might consider adding an automated test to verify the flag parsing works correctly (though this may be out of scope for this simple fix).

✅ Final Verdict

LGTM! This PR successfully implements the documented --verbose flag and fixes the OptionParser::InvalidOption error. The code is clean, consistent, and maintains backward compatibility.

Changes in lib/react_on_rails/dev/server_manager.rb (lines 147-196):

  • Added verbose: false to options hash initialization
  • Implemented -v, --verbose flag parsing in OptionParser
  • Updated three start() method calls to pass options[:verbose]
  • Added RuboCop disable/enable comments for AbcSize metric

The fix is minimal, targeted, and solves exactly what was described in issue #1849.


View PR |

@justin808 justin808 merged commit 3fe5033 into master Nov 16, 2025
19 checks passed
@justin808 justin808 deleted the justin808/fix-dev-verbose-flag branch November 16, 2025 07:40
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.

bin/dev --verbose option causes error despite being listed in help

2 participants