class PreCommit::ListEvaluator
Attributes
config[R]
Public Class Methods
new(config)
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 12 def initialize(config) @config = config end
Public Instance Methods
checks_config()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 35 def checks_config get_combined_checks - get_arr_checks_remove end
checks_evaluated(type = :evaluated_names)
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 39 def checks_evaluated(type = :evaluated_names) PreCommit::PluginsList.new(get_combined_checks, get_arr_checks_remove) do |name| config.pluginator.find_check(name) end.send(type) end
list()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 16 def list <<-DATA Available providers: #{config.providers.list.join(" ")} Available checks : #{plugin_names.join(" ")} Default checks : #{config.get_arr(:checks).join(" ")} Enabled checks : #{checks_config.join(" ")} Evaluated checks : #{checks_evaluated.join(" ")} Default warnings : #{config.get_arr(:warnings).join(" ")} Enabled warnings : #{warnings_config.join(" ")} Evaluated warnings : #{warnings_evaluated.join(" ")} DATA end
plugins()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 29 def plugins list = config.pluginator['checks'].map{|plugin| [class2string(class2name(plugin)), plugin] }.sort separator = list.map{|name, plugin| name.length }.max list.map{ |name, plugin| format_plugin(name, separator, plugin) }.flatten end
warnings_config()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 45 def warnings_config get_combined_warnings - get_arr_warnings_remove end
warnings_evaluated(type = :evaluated_names)
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 49 def warnings_evaluated(type = :evaluated_names) PreCommit::PluginsList.new(get_combined_warnings, get_arr_warnings_remove) do |name| config.pluginator.find_check(name) end.send(type) end
Private Instance Methods
format_plugin(name, separator, plugin)
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 61 def format_plugin(name, separator, plugin) line = [sprintf("%#{separator}s : %s", name, plugin.description)] line << sprintf("%#{separator}s - includes: %s", "", plugin.includes.join(" ")) if plugin.respond_to?(:includes) line << sprintf("%#{separator}s - excludes: %s", "", plugin.excludes.join(" ")) if plugin.respond_to?(:excludes) line end
get_arr_checks_remove()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 72 def get_arr_checks_remove @get_arr_checks_remove ||= config.get_arr("checks_remove") end
get_arr_warnings_remove()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 80 def get_arr_warnings_remove @get_arr_warnings_remove ||= config.get_arr("warnings_remove") end
get_combined_checks()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 68 def get_combined_checks @get_combined_checks ||= config.get_combined(:checks) end
get_combined_warnings()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 76 def get_combined_warnings @get_combined_warnings ||= config.get_combined(:warnings) end
plugin_names()
click to toggle source
# File lib/pre-commit/list_evaluator.rb, line 57 def plugin_names config.pluginator['checks'].map{|plugin| class2string(class2name(plugin)) }.sort end