-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Resolve #290 to inherit rubocop config from a gem. #2270
Conversation
Working on the Ruby 1.9.3 failures. And I'll add a test for it as well |
1501039
to
8992b1f
Compare
Apart from the commit message and the missing changelog the PR looks reasonable to me. @jonas054 what do you think? |
def resolve_inheritance_from_gems(hash, gems) | ||
(gems || {}).each_pair do |gem_name, config_path| | ||
hash['inherit_from'] ||= [] | ||
hash['inherit_from'] << gem_config_path(gem_name, config_path) |
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.
If hash['inherit_from']
already contains a string, e.g. .rubocop_todo.yml
, this will concatenate to that string.
Super cool feature! I found one bug. |
What specifically about the commit message is problematic? Would you prefer that I rewrite the commit message and/or amend the commit with all changes squashed (instead of keeping the chain of 3 commits once I fix Jonas's bug)? @jonas054 Nice find.. Just tested and confirmed that it fails with the String (instead of Array) yaml syntax. I'll definitely clean it up to make it more explicit. |
787249e
to
4ab8ae4
Compare
Any suggestions for dropping 1 line from this class? 🎱 |
You can just increase to max class length. Regarding the commit message - the title should not end with a |
I also think it'd be a good idea to mention this feature somewhere in the README, otherwise most people will likely miss it. |
3aaa4e8
to
5a26e31
Compare
@bbatsov Thanks! I've updated the max class length, fixed the trailing commit summary punctuation, and added a blurb to the README. |
I don't see why we should warn and continue when a config file from a gem can't be found. We should fail just like when a file listed in |
The main reason I went this route is for cases when you might need to run I don't mind either way. I'll make it fail instead of warning, if that is the consensus? |
Yeah, that would probably be best. |
Sounds good -- done! |
Fixing the rspec test... |
The config directive should be in Hash format, with the `gem_name` as the key, and the `relative_path_to_config` as the value. Ex: inherit_from: .rubocop_todo.yml inherit_gem: cucumber: config/rubocop.yml mygem: path/to/my/shared/rubocop.yml
Resolve #290 to inherit rubocop config from a gem
The config directive should be in Hash format, with the
gem_name
as the key, and the
relative_path_to_config
as the value. Ex:If the gem is not installed, a warning is emitted, but execution
continues without the gem's config.