-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
Description
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
- Start rubocop in server mode with a custom config
rubocop --server --config config.yml file.rb
- edit config.yml
- Re-run
rubocop --server --config config.yml file.rb
and observe how the server does not restart - edit
.rubocop.yml
- 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