lib/standard/rspec/plugin.rb in standard-rspec-0.1.7 vs lib/standard/rspec/plugin.rb in standard-rspec-0.2.0

- old
+ new

@@ -1,10 +1,14 @@ require "yaml" module Standard module Rspec class Plugin < LintRoller::Plugin + def initialize(config) + @config = config + end + def about LintRoller::About.new( name: "standard-rspec", version: VERSION, homepage: "https://github.com/shilin-anton/standard-rspec", @@ -20,14 +24,22 @@ trick_rubocop_into_thinking_we_required_rubocop_rspec! LintRoller::Rules.new( type: :object, config_format: :rubocop, - value: YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml"), aliases: true) + value: rules_with_config_applied ) end private + + def rules_with_config_applied + YAML.load_file(Pathname.new(__dir__).join("../../../config/base.yml"), aliases: true).tap do |rules| + if @config["action_policy_enabled"] + rules["inherit_gem"] = { "action_policy" => "config/rubocop-rspec.yml" } + end + end + end # This is not fantastic. # # When you `require "rubocop-rspec"`, it will not only load the cops, # but it will also monkey-patch RuboCop's default_configuration, which is