lib/wcc/plugin.rb in danger-wcc-0.0.5 vs lib/wcc/plugin.rb in danger-wcc-0.0.6

- old
+ new

@@ -10,26 +10,29 @@ class Danger::DangerWCC < Danger::Plugin include Utils include Github - CHECKS = %i[ - rubocop_exceptions - todos - commit_lint - reek - flay - brakeman - jshint - ].freeze + DEFAULT_OPTIONS = { + rubocop_exceptions: true, + flay: true, + todos: true, + brakeman: true, + commit_lint: false, + reek: false, + jshint: false + }.freeze # Runs all the included checks in the plugin def all(options = {}) - to_run = CHECKS.reject { |check_name| options[check_name] == false } + options = DEFAULT_OPTIONS.merge(options) + + to_run = options.keys.reject { |check_name| options[check_name] == false } raise ArgumentError, 'No Enabled Checks' if to_run.empty? to_run.each do |check_name| - public_send(check_name, options.fetch(check_name, {})) + check_options = options.fetch(check_name, {}) + public_send(check_name, check_options == true ? {} : check_options) end end # Checks for added TODOs def todos(options = {})