lib/rubocop/cop/faker/deprecated_arguments.rb in rubocop-faker-0.1.0 vs lib/rubocop/cop/faker/deprecated_arguments.rb in rubocop-faker-0.2.0

- old
+ new

@@ -103,10 +103,20 @@ arguments.last.source_range.end_pos ) end def argument_keywords - cop_config.fetch('ArgumentKeywords', {}) + cop_config.fetch('ArgumentKeywords') + # Workaround for a problem that config/default.yml setting is not applied + # if .rubocop.yml does not exist when `rubocop --require rubocop-faker` + # option is used. + rescue KeyError + config = File.read( + File.join(File.dirname(__FILE__), '../../../../config/default.yml') + ) + yaml = YAML.safe_load(config) + + yaml[cop_name].fetch('ArgumentKeywords', {}) end end end end end