Class: Appium::Lint::H156Invalid

Inherits:
Base
  • Object
show all
Defined in:
lib/appium_doc_lint/lint/h156_invalid.rb

Overview

h4, h5, and h6 should not be used. Slate works best with h1, h2, or h3

Constant Summary collapse

FAIL =
'h1, h5, h6 should not be used. Use h2, h3 or h4.'

Instance Attribute Summary

Attributes inherited from Base

#input, #warnings

Instance Method Summary collapse

Methods inherited from Base

#initialize, #warn

Constructor Details

This class inherits a constructor from Appium::Lint::Base

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/appium_doc_lint/lint/h156_invalid.rb', line 7

def call
  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

    h156_invalid = !!line.match(/^\#{5,6}[^#]|^#[^#]|^===+\s*$/)
    warn index if h156_invalid

  end
  warnings
end

#failObject



24
25
26
# File 'lib/appium_doc_lint/lint/h156_invalid.rb', line 24

def fail
  FAIL
end