Fix: Failed to execute rubocop fixer on other machine #3916
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Expectation
I want to apply the fixer of rubocop in the container to the Ruby file that is volume mounted by docker-compose.
Use
b:ale_command_wrapper
andb:ale_filename_mappings
to run fixer inside docker.Problem
Linter succeeded, but Fixer failed.
Linter Log(succeeded)
Fixer Log(failed)
Cause
Fixer fails because host filepath is passed to
--config
of rubocop in thecontainer.
Files targeted by Fixer are mapped as specified in
b:ale_filename_mappings
, but file path of--config
are not mapped.Rubocop does not work because
--config
specified an invalid file path.Solution
This problem can be resolved by removing
--config
.Fixer Log(succeeded)
According to the commit log, ALE specifies
--config
to resolve #732.At that time, there seemed to be a problem that
.rubocop.yml
was not loaded when using rubocop fixer from ALE.However current rubocop fixer reads
.rubocop.yml
even if ALE doesn't specify--config
.Also, in previous implementations, fixer specified
--config
, but linter did not specify--config
, so the behavior could be different.If ALE user wants to specify
--config
, it can be specified withg:ale_ruby_rubocop_options
.