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

Odd inconsistency with --cache-root #10766

Closed
dgollahon opened this issue Jun 28, 2022 · 1 comment · Fixed by #11748
Closed

Odd inconsistency with --cache-root #10766

dgollahon opened this issue Jun 28, 2022 · 1 comment · Fixed by #11748
Labels

Comments

@dgollahon
Copy link
Contributor

Expected behavior

Configuring --cache-root would behave exactly like setting RUBOCOP_CACHE_ROOT or AllCops: CacheRootDirectory, modulo precedence.

Actual behavior

The --cache-root flag specifies the exact cache folder. The other two options end up creating a nested rubocop_cache directory. I think I see from the code why this is happening but it is perplexing as an end user (and messed up my CI cache at first).

Steps to reproduce the problem

Specify a directory to --cache-root and separately either of the other options and observe that the directory structure it creates is different.

RuboCop version

1.31.0 (using Parser 3.1.2.0, rubocop-ast 1.18.0, running on ruby 2.7.6 x86_64-linux)
  - rubocop-performance 1.14.2
  - rubocop-rspec 2.11.1

I'm not sure if this should be changed to match or if the difference should just be documented but it is very surprising as-is. I actually prefer the --cache-root behavior (so i don't have an extra nesting of directories) but the main issue here is that it is confusing.

@dgollahon dgollahon changed the title Odd behavior with --cache-root Odd inconsistency with --cache-root Jun 28, 2022
@jonas054
Copy link
Collaborator

I think this is a bug. A rubocop_cache directory level should be added, also for --cache_root.

@jonas054 jonas054 added the bug label Jul 11, 2022
nobuyo added a commit to nobuyo/rubocop that referenced this issue Apr 1, 2023
…rent for `rubocop_cache` dir like other ways to specify it
koic added a commit that referenced this issue Apr 1, 2023
[Fix #10766] Use the path given by `--cache-root` to be the parent for  `rubocop_cache` dir like other ways to specify it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants