Method: Appium::Lint#call
- Defined in:
- lib/appium_doc_lint/lint.rb
#call(opts = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/appium_doc_lint/lint.rb', line 47 def call opts={} @input = self.class.new_input opts all_warnings = {} @rules.each do |rule| warnings = rule.new(@input).call unless warnings.empty? all_warnings.merge!(warnings) do |key, old_val, new_val| # flatten to prevent { :a => [[1, 2], 2]} [old_val, new_val].flatten end end end return {} if all_warnings.empty? # sort by line number all_warnings = all_warnings.sort.to_h # wrap with file path if available input.file ? { input.file => all_warnings } : all_warnings end |