lib/salsify_rubocop.rb in salsify_rubocop-0.41.0 vs lib/salsify_rubocop.rb in salsify_rubocop-0.42.0
- old
+ new
@@ -1,5 +1,16 @@
require 'salsify_rubocop/version'
+require 'rubocop-rspec'
-# Top-level gem module
-module SalsifyRubocop
-end
+# Because RuboCop doesn't yet support plugins, we have to monkey patch in a
+# bit of our configuration. Based on approach from rubocop-rspec:
+DEFAULT_FILES = File.expand_path('../../config/default.yml', __FILE__)
+
+path = File.absolute_path(DEFAULT_FILES)
+hash = RuboCop::ConfigLoader.send(:load_yaml_configuration, path)
+config = RuboCop::Config.new(hash, path)
+puts "configuration from #{DEFAULT_FILES}" if RuboCop::ConfigLoader.debug?
+config = RuboCop::ConfigLoader.merge_with_default(config, path)
+RuboCop::ConfigLoader.instance_variable_set(:@default_configuration, config)
+
+# cops
+require 'rubocop/cop/salsify/rspec_doc_string'