Skip to content

--server mode does not honor --config cli options #14031

@tdeo

Description

@tdeo

When running rubocop --server --config path/to/config.yml, RuboCop server only restarts when picking up changes in the standard .rubocop.yml file and not to path/to/config.yml.


Expected behavior

RuboCop automatically restarts the server when changes occur in the file listed in the --config CLI argument

Actual behavior

RuboCop detects exclusively detects changes to the standard .rubocop.yml, no matter the --config CLI option:

% rubocop  --config .rubocop-ci.yml --server app/models/user.rb
Inspecting 1 file
.

1 file inspected, no offenses detected
% echo 'Style: { Enabled: false }' >> .rubocop-ci.yml
% rubocop  --config .rubocop-ci.yml --server app/models/user.rb
Inspecting 1 file
.

1 file inspected, no offenses detected
% echo 'Style: { Enabled: false }' >> .rubocop.yml
% rubocop  --config .rubocop-ci.yml --server app/models/user.rb
RuboCop version incompatibility found, RuboCop server restarting...
RuboCop server starting on 127.0.0.1:59337.
Inspecting 1 file
.

1 file inspected, no offenses detected

Steps to reproduce the problem

  1. Start rubocop in server mode with a custom config rubocop --server --config config.yml file.rb
  2. edit config.yml
  3. Re-run rubocop --server --config config.yml file.rb and observe how the server does not restart
  4. edit .rubocop.yml
  5. Re-run rubocop --server --config config.yml file.rb and observe the server restart unnecessarily.

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler.
If you see extension cop versions (e.g. rubocop-performance, rubocop-rspec, and others)
output by rubocop -V, include them as well. Here's an example:

% rubocop -V
1.74.0 (using Prism 1.4.0, rubocop-ast 1.38.1, analyzing as Ruby 3.3, running on ruby 3.4.2) +server [arm64-darwin24]
  - rubocop-factory_bot 2.27.1
  - rubocop-performance 1.24.0
  - rubocop-rails 2.30.3
  - rubocop-rspec 3.5.0
  - rubocop-rspec_rails 2.31.0
  - rubocop-inflector 1.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy