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

It is not possible to generate todo file in a subdirectory #5970

Closed
Ana06 opened this issue Jun 7, 2018 · 0 comments
Closed

It is not possible to generate todo file in a subdirectory #5970

Ana06 opened this issue Jun 7, 2018 · 0 comments
Labels

Comments

@Ana06
Copy link
Contributor

Ana06 commented Jun 7, 2018

I have the following

root
  -> .rubocop.yml
  -> .rubocop_todo.yml
  -> directory
     -> .rubocop.yml

The content of directory/.rubocop.yml is:

inherit_from: ../.rubocop.yml

Running rubocop --auto-gen-config inside the directory fails:

> rubocop --auto-gen-config
(.rubocop.yml): could not find expected ':' while scanning a simple key at line 5 column 1
/usr/lib64/ruby/2.5.0/psych.rb:402:in `parse'
/usr/lib64/ruby/2.5.0/psych.rb:402:in `parse_stream'
/usr/lib64/ruby/2.5.0/psych.rb:350:in `parse'
/usr/lib64/ruby/2.5.0/psych.rb:314:in `safe_load'
/usr/lib64/ruby/gems/2.5.0/gems/rubocop-0.57.1/lib/rubocop/config_loader.rb:184:in `yaml_safe_load'
/usr/lib64/ruby/gems/2.5.0/gems/rubocop-0.57.1/lib/rubocop/config_loader.rb:157:in `load_yaml_configuration'
/usr/lib64/ruby/gems/2.5.0/gems/rubocop-0.57.1/lib/rubocop/config_loader.rb:130:in `add_inheritance_from_auto_generated_file'
/usr/lib64/ruby/gems/2.5.0/gems/rubocop-0.57.1/lib/rubocop/cli.rb:125:in `reset_config_and_auto_gen_file'
/usr/lib64/ruby/gems/2.5.0/gems/rubocop-0.57.1/lib/rubocop/cli.rb:77:in `execute_runners'
/usr/lib64/ruby/gems/2.5.0/gems/rubocop-0.57.1/lib/rubocop/cli.rb:41:in `run'
/usr/lib64/ruby/gems/2.5.0/gems/rubocop-0.57.1/exe/rubocop:13:in `block in <top (required)>'
/usr/lib64/ruby/2.5.0/benchmark.rb:308:in `realtime'
/usr/lib64/ruby/gems/2.5.0/gems/rubocop-0.57.1/exe/rubocop:12:in `<top (required)>'
/usr/local/bin/rubocop:23:in `load'
/usr/local/bin/rubocop:23:in `<main>'

The content of directory/.rubocop.yml after running the command is:

inherit_from:
  - .rubocop_todo.yml
  - ../.rubocop.yml

/.rubocop.yml

If I change the content of directory/.rubocop.yml to

inherit_from:
  - .rubocop_todo.yml
  - ../.rubocop.yml

then it works as expected, but I think that the first case should work as well.

RuboCop version

0.57.1 (using Parser 2.5.1.0, running on ruby 2.5.0 x86_64-linux-gnu)
@Drenmi Drenmi added the bug label Oct 3, 2018
jonas054 added a commit to jonas054/rubocop that referenced this issue Oct 26, 2018
We couldn't deal with slashes in inherit_from file paths.

There was also a weird checking of falsiness of the parameter
rubocop_yml_contents, even though it's always truthy. Checking if it contains
any non-whitespace achieves the desired result.
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