Class: Appium::Lint::H2Multiple
- Defined in:
- lib/appium_doc_lint/lint/h2_multiple.rb
Overview
Each doc must have exactly 1 h1
Constant Summary collapse
- FAIL =
'each doc must contain exactly one h2'
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Appium::Lint::Base
Instance Method Details
#call ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/appium_doc_lint/lint/h2_multiple.rb', line 6 def call h1_count = 0 in_code_block = false input.lines.each_with_index do |line, index| code_block = !! line.match(/^```/) in_code_block = ! in_code_block if code_block next if in_code_block h1_detected = !! line.match(/^##[^#]/) if h1_detected # only warn if h1 detected h1_count += 1 warn index if h1_count > 1 end end warnings end |
#fail ⇒ Object
27 28 29 |
# File 'lib/appium_doc_lint/lint/h2_multiple.rb', line 27 def fail FAIL end |