Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate rubocop-daemon #10706

Merged
merged 2 commits into from Jun 10, 2022
Merged

Commits on Jun 10, 2022

  1. Import rubocop-daemon

    Preparing to resolve rubocop#9503.
    
    This PR imports https://github.com/fohte/rubocop-daemon into RuboCop core.
    
    The rubocop-daemon's original license (MIT) is written at the beginning
    of the imported files.
    koic committed Jun 10, 2022
    Copy the full SHA
    f8d8693 View commit details
    Browse the repository at this point in the history
  2. Integrate rubocop-daemon

    The integrated daemon feature is described in the docs/modules/ROOT/pages/usage/server.adoc
    included in this PR.
    
    ## Daemon options
    
    ```console
    % bundle exec rubocop --help
    (snip)
    
    Server Options:
            --[no-]server                If the daemon process has not started yet, start the
                                         server process and execute inspection with server.
                                         Default is false.
                                         You can specify the daemon host and port with
                                         the $RUBOCOP_SERVER_HOST and the $RUBOCOP_SERVER_PORT
                                         environment variables.
            --restart-server             Restart server process.
            --start-server               Start server process.
            --stop-server                Stop server process.
            --server-status              Show server status.
    ```
    
    The daemon mode `--daemon` is disabled by default because it is not yet
    stable as an integrated feature.
    
    ## Design note
    
    `RuboCop::Daemon::CLI`'s daemon options are not integrated into
    `RuboCop::CLI` and `RuboCop::Options`.
    Because `RuboCop::CLI` and `RuboCop::Options` classes have many dependencies
    and require the rubocop client (`exe/rubocop`) to make unnecessary `require '...'`.
    
    It's important to be lightweight because the daemon mode runs fast,
    so this design decided to have command line daemon options
    own (lightweight) option parse logic.
    
    And this design only exe/rubocop and lib/rubocop/options.rb files have changed,
    So almost all daemon code keep independent.
    
    NOTE: This feature cannot be used on JRuby and Windows that do not support fork.
    koic committed Jun 10, 2022
    Copy the full SHA
    c76ff8d View commit details
    Browse the repository at this point in the history