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

[Fix #10771] Make server mode aware of --cache-root command line option #10849

Merged

Conversation

koic
Copy link
Member

@koic koic commented Aug 1, 2022

Fix #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.
#10842 needs a different solution than --cache-root option. I'm working on it separately from solving this issue.


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.

@koic koic force-pushed the make_server_mode_aware_of_command_line_option branch from ce5bb93 to c28e9c0 Compare August 1, 2022 03:06
@koic koic force-pushed the make_server_mode_aware_of_command_line_option branch 2 times, most recently from a0cf812 to 6e9ea10 Compare August 1, 2022 04:28
…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.
@koic koic force-pushed the make_server_mode_aware_of_command_line_option branch from 6e9ea10 to 9ec766e Compare August 1, 2022 05:34
@bbatsov bbatsov merged commit b2594cf into rubocop:master Aug 1, 2022
@bbatsov
Copy link
Collaborator

bbatsov commented Aug 1, 2022

Looks good to me. Thanks!

@koic koic deleted the make_server_mode_aware_of_command_line_option branch August 1, 2022 06:35
koic added a commit to koic/rubocop that referenced this pull request Aug 3, 2022
…d two env vars

Fixes rubocop#10842 and follow up rubocop#10849.

This PR makes server mode aware of `CacheRootDirectory` config option value,
`RUBOCOP_CACHE_ROOT`, and `XDG_CACHE_HOME` environment variables.

`RuboCop::ConfigLoader` and `RuboCop::ResultCache` classes to get these values has many dependencies.
So, it is not suitable for use in server mode where speed is required.

This solution is to extract `ConfigPathFinder` class from `ConfigLoader` class and `CacheRoot` class
from `ResultCache` class.
This allows server mode to depend on lightweight `ConfigPathFinder` and `CacheRoot` classes.
bbatsov pushed a commit that referenced this pull request Aug 3, 2022
…nv vars (#10852)

Fixes #10842 and follow up #10849.

This PR makes server mode aware of `CacheRootDirectory` config option value,
`RUBOCOP_CACHE_ROOT`, and `XDG_CACHE_HOME` environment variables.

`RuboCop::ConfigLoader` and `RuboCop::ResultCache` classes to get these values has many dependencies.
So, it is not suitable for use in server mode where speed is required.

This solution is to extract `ConfigFinder` class from `ConfigLoader` class and `CacheConfig` class
from `ResultCache` class.
This allows server mode to depend on lightweight `ConfigFinder` and `CacheConfig` classes.
WJWH pushed a commit to WJWH/rubocop that referenced this pull request Aug 8, 2022
…d two env vars (rubocop#10852)

Fixes rubocop#10842 and follow up rubocop#10849.

This PR makes server mode aware of `CacheRootDirectory` config option value,
`RUBOCOP_CACHE_ROOT`, and `XDG_CACHE_HOME` environment variables.

`RuboCop::ConfigLoader` and `RuboCop::ResultCache` classes to get these values has many dependencies.
So, it is not suitable for use in server mode where speed is required.

This solution is to extract `ConfigFinder` class from `ConfigLoader` class and `CacheConfig` class
from `ResultCache` class.
This allows server mode to depend on lightweight `ConfigFinder` and `CacheConfig` classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server cache does not respect --cache-root configuration
3 participants