Class: Appium::Lint::H2Missing

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

Overview

Each file must have a h2 This forms the title for the document and is used to anchor the #filename.md link.

The file should start with the h2. This rule will fail if the document doesn’t contain at least one h2

Constant Summary collapse

FAIL =
'h2 is missing'

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



11
12
13
14
15
16
# File 'lib/appium_doc_lint/lint/h2_missing.rb', line 11

def call
  # either the doc has a h2 or it doesn't
  # attach warning to line 0
  h2_missing = !input.data.match(/^##[^#]/m)
  h2_missing ? warn(0) : warnings
end

#failObject



20
21
22
# File 'lib/appium_doc_lint/lint/h2_missing.rb', line 20

def fail
  FAIL
end