forked from rubocop/rubocop
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…line option Fix rubocop#10771. This PR makes server mode aware of `--cache-root` command line option. The logic for getting `--cache-root` from command line option is original to make the implementation lighter. Because the client of server mode should be lightweight. rubocop#10842 needs a different solution than `--cache-root` option. I'm working on it separately from solving this issue.
- Loading branch information
Showing
5 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* [#10771](https://github.com/rubocop/rubocop/issues/10771): Make server mode aware of `--cache-root` command line option. ([@koic][]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# frozen_string_literal: true | ||
|
||
RSpec.describe RuboCop::Server::Cache do | ||
subject(:cache_class) { described_class } | ||
|
||
describe '.cache_path' do | ||
context 'when cache root path is not specified as default' do | ||
before do | ||
cache_class.cache_root_path = nil | ||
end | ||
|
||
it 'is the default path' do | ||
expect(cache_class.cache_path).to eq("#{Dir.home}/.cache/rubocop_cache/server") | ||
end | ||
end | ||
|
||
context 'when cache root path is specified path' do | ||
before do | ||
cache_class.cache_root_path = '/tmp' | ||
end | ||
|
||
it 'is the specified path' do | ||
if RuboCop::Platform.windows? | ||
expect(cache_class.cache_path).to eq('D:/tmp/rubocop_cache/server') | ||
else | ||
expect(cache_class.cache_path).to eq('/tmp/rubocop_cache/server') | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters