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

StyleGuideBaseURL can't be set on nested departments #9452

Closed
tas50 opened this issue Jan 29, 2021 · 1 comment
Closed

StyleGuideBaseURL can't be set on nested departments #9452

tas50 opened this issue Jan 29, 2021 · 1 comment

Comments

@tas50
Copy link
Contributor

tas50 commented Jan 29, 2021

Expected behavior

Full disclosure: I might be missing something here. Trust but verify.

So #7295 enabled setting the StyleGuideBaseURL config at the department level, which is great because I have 200 cops in a few different departments and I want to push users to our docs when they encounter those cops. It's not really something I want to include in the config 200 times. Per department is 😘.

The problem is I have nested departments like Chef/Style/UsePlatformHelpers

In the config if I set

Chef/Style:
    StyleGuideBaseURL: https://docs.chef.io/whatever

and then later define the cop with a StyleGuide config like this:

Chef/Style/UsePlatformHelpers:
  Description: Use platform? and platform_family? helpers to check node platform in resources and recipes
  StyleGuide: '#chefstyleuseplatformhelpers'
  Enabled: true
  VersionAdded: '5.6.0'
  Exclude:
    - '**/metadata.rb'
    - '**/libraries/*'
    - '**/Berksfile'

You would think I'd end up with:

R: [Correctable] Chef/Style/UsePlatformHelpers: Use platform? and platform_family? helpers to check a node's platform (https://docs.chef.io/whatever#chefstyleuseplatformhelpers)
      version << rhel_append_version if node['platform_family'] == 'rhel' &&
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Actual behavior

You get the BaseURL defined in AllCops in the rubocop project config:

R: [Correctable] Chef/Style/UsePlatformHelpers: Use platform? and platform_family? helpers to check a node's platform (https://rubystyle.guide#chefstyleuseplatformhelpers)
      version << rhel_append_version if node['platform_family'] == 'rhel' &&
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If I change it at the AllCops level in my config it works fine, but not at the department level.

RuboCop version

This is in within Cookstyle in a RuboCop 1.9 branch here: https://github.com/chef/cookstyle/tree/1.9

$ [bundle exec] rubocop -V
1.9.0 (using Parser 3.0.0.0, rubocop-ast 1.4.1, running on ruby 2.7.2 x86_64-darwin20)
  - rubocop-performance 1.9.2

As always to everyone here. RuboCop is amazing. Thanks for everything you do.

@tas50
Copy link
Contributor Author

tas50 commented Jan 30, 2021

Fixed by #9480

@tas50 tas50 closed this as completed Jan 31, 2021
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

No branches or pull requests

1 participant