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

--config FILE argument appears to be ignored when --auto-gen-config is used #5934

Closed
Kache opened this issue May 31, 2018 · 0 comments
Closed
Labels

Comments

@Kache
Copy link

Kache commented May 31, 2018

Instead of using .rubocop.yml default, I'm using rubocop --config my_path/my_file.yml. In attempting to incorporate --auto-gen-config and todo.yml in order for an incremental fix workflow, I found that rubocop --config my_path/my_file.yml --auto-gen-config operates as if I ran rubocop.

Specifically, this means that all the rules in my config are effectively ignored (and a new .rubocop.yml file is added for me as well).

My workaround is renaming my_path/my_file.yml to .rubocop.yml, and then the --auto-gen-config feature works as expected. (Great to have, by the way!)


Expected behavior

rubocop --config my_path/my_file.yml --auto-gen-config should operate on my_path/my_file.yml as if it were named .rubocop.yml

Actual behavior

My config file is completely ignored, as if it didn't exist. A new .rubocop.yml is created and modified to inherit .rubocop_todo.yml as well.

Steps to reproduce the problem

Create a custom rubocop configuration at some_path/some_name.yml with a Cop disabled. In a codebase where that Cop would activate, rubocop --config some_path/some_name.yml should not alert.

Then, run rubocop --config some_path/some_name.yml --auto-gen-config, and the cop will have been "reactivated" because the --config argument appears to get ignored.

RuboCop version

0.56.0 (using Parser 2.5.1.0, running on ruby 2.3.7 x86_64-darwin16)

@bbatsov bbatsov added the bug label Sep 23, 2018
jonas054 added a commit to jonas054/rubocop that referenced this issue Oct 26, 2018
When a --config option is given with a file name that should be used instead of
.rubocop.yml, we need to use the given file name throughout the somewhat
complicated generation of the todo file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants