Class: PreCommit::ListEvaluator
- Inherits:
-
Object
- Object
- PreCommit::ListEvaluator
- Includes:
- Pluginator::Extensions::Conversions
- Defined in:
- lib/pre-commit/list_evaluator.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #checks_config ⇒ Object
- #checks_evaluated(type = :evaluated_names) ⇒ Object
-
#initialize(config) ⇒ ListEvaluator
constructor
A new instance of ListEvaluator.
- #list ⇒ Object
- #plugins ⇒ Object
- #warnings_config ⇒ Object
- #warnings_evaluated(type = :evaluated_names) ⇒ Object
Constructor Details
permalink #initialize(config) ⇒ ListEvaluator
Returns a new instance of ListEvaluator.
12 13 14 |
# File 'lib/pre-commit/list_evaluator.rb', line 12 def initialize(config) @config = config end |
Instance Attribute Details
permalink #config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/pre-commit/list_evaluator.rb', line 10 def config @config end |
Instance Method Details
permalink #checks_config ⇒ Object
[View source]
35 36 37 |
# File 'lib/pre-commit/list_evaluator.rb', line 35 def checks_config get_combined_checks - get_arr_checks_remove end |
permalink #checks_evaluated(type = :evaluated_names) ⇒ Object
[View source]
39 40 41 42 43 |
# 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 |
permalink #list ⇒ Object
[View source]
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/pre-commit/list_evaluator.rb', line 16 def list "Available providers: \#{config.providers.list.join(\" \")}\nAvailable checks : \#{plugin_names.join(\" \")}\nDefault checks : \#{config.get_arr(:checks).join(\" \")}\nEnabled checks : \#{checks_config.join(\" \")}\nEvaluated checks : \#{checks_evaluated.join(\" \")}\nDefault warnings : \#{config.get_arr(:warnings).join(\" \")}\nEnabled warnings : \#{warnings_config.join(\" \")}\nEvaluated warnings : \#{warnings_evaluated.join(\" \")}\n" end |
permalink #plugins ⇒ Object
[View source]
29 30 31 32 33 |
# 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 |
permalink #warnings_config ⇒ Object
[View source]
45 46 47 |
# File 'lib/pre-commit/list_evaluator.rb', line 45 def warnings_config get_combined_warnings - get_arr_warnings_remove end |
permalink #warnings_evaluated(type = :evaluated_names) ⇒ Object
[View source]
49 50 51 52 53 |
# 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 |