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
Fix default config for sub-departments #1163
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ module RSpec | |
# Builds a YAML config file from two config hashes | ||
class ConfigFormatter | ||
EXTENSION_ROOT_DEPARTMENT = %r{^(RSpec/)}.freeze | ||
SUBDEPARTMENTS = %(RSpec/Capybara RSpec/FactoryBot RSpec/Rails) | ||
STYLE_GUIDE_BASE_URL = 'https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/' | ||
|
||
def initialize(config, descriptions) | ||
|
@@ -24,6 +25,8 @@ def dump | |
|
||
def unified_config | ||
cops.each_with_object(config.dup) do |cop, unified| | ||
next if SUBDEPARTMENTS.include?(cop) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so those are not really cops, but departments declarations. Nice There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of them are cops, but some are departments. It's because |
||
|
||
unified[cop] = config.fetch(cop) | ||
.merge(descriptions.fetch(cop)) | ||
.merge('StyleGuide' => STYLE_GUIDE_BASE_URL + cop.sub('RSpec/', '')) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this could be named, e.g. alphanumeric. Might make the file less scary, if it has proper names :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vaguely recall I planned to do so (to mimic the well-known
&default
fromconfig/database.yml
😄), but ended up with numbers somehow. Fixed 👍There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, now I recall. It's
bin/build_config
that does that:Supposedly,
YAML.dump(unified_config)
has no respect for named anchors.I'll revert, otherwise CI is red.