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

enabled_cops: all fails with NoMethodError #327

Closed
russellshackleford opened this issue Apr 16, 2020 · 4 comments
Closed

enabled_cops: all fails with NoMethodError #327

russellshackleford opened this issue Apr 16, 2020 · 4 comments
Labels

Comments

@russellshackleford
Copy link
Contributor

When using the hardcore rubocop profile in .sync.yml, I get the following

pdk (FATAL): Failed to render template '.rubocop.yml.erb'
NoMethodError: undefined method `keys' for "all":String

.sync.yml:

.rubocop.yml:
  selected_profile: hardcore

I'm using tags/1.17.0-0-gd3a4319 on Ubuntu 18.04 with a new module that was created with pdk new module, then .sync.yml was created, followed by running pdk update.

@russellshackleford russellshackleford added the bug Something isn't working label Apr 16, 2020
@DavidS DavidS added hacktoberfest and removed bug Something isn't working labels Sep 29, 2020
@DavidS DavidS added the bug label Jan 18, 2021
@DavidS
Copy link
Contributor

DavidS commented Jan 18, 2021

I could reproduce this issue with the current version of the pdk-templates and PDK 1.18.1:

david@zion:~/tmp$ pdk new module hardcore --skip-interview
pdk (INFO): Creating new module: hardcore
pdk (INFO): Using the default template-url and template-ref.
pdk (INFO): Module 'hardcore' generated at path '/home/david/tmp/hardcore'.
pdk (INFO): In your module directory, add classes with the 'pdk new class' command.
david@zion:~/tmp$ cd hardcore/
david@zion:~/tmp/hardcore$ vi .sync.yml
david@zion:~/tmp/hardcore$ pdk update --force
pdk (FATAL): Failed to render template '.rubocop.yml.erb'
NoMethodError: undefined method `keys' for "all":String
david@zion:~/tmp/hardcore$ pdk --version
1.18.1
david@zion:~/tmp/hardcore$ cat .sync.yml 
---
.rubocop.yml:
  selected_profile: hardcore

david@zion:~/tmp/hardcore$ 

@russellshackleford
Copy link
Contributor Author

This is still a problem with latest released pdk and templates

  "pdk-version": "2.2.0",
  "template-url": "pdk-default#2.2.0",
  "template-ref": "tags/2.2.0-0-g2381db6"

@russellshackleford
Copy link
Contributor Author

The error displayed has changed slightly since the original report. Here is the output for selected_profile: off and selected_profile: hardcore (respectively):

$ pdk update
pdk (FATAL): Failed to render template '.rubocop.yml.erb'
NoMethodError: undefined method `[]' for nil:NilClass

$ pdk update
pdk (FATAL): Failed to render template '.rubocop.yml.erb'
NoMethodError: undefined method `&' for {}:Hash

The cleanups_only and strict profiles work.

@russellshackleford
Copy link
Contributor Author

#L36 Appears to be the problem.

michaeltlombardi added a commit that referenced this issue Aug 30, 2021
(GH-327) Fix rubocop "off" & "hardcore" profiles
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