Class: Mdlint::Linter::Rules::StrongStyle

Inherits:
Mdlint::Linter::Rule show all
Includes:
SourceStyleSupport
Defined in:
lib/mdlint/linter/rules/source_style.rb,
sig/internal.rbs

Constant Summary

Constants included from SourceStyleSupport

Mdlint::Linter::Rules::SourceStyleSupport::FENCE_REGEXP, Mdlint::Linter::Rules::SourceStyleSupport::LIST_MARKER_REGEXP

Instance Attribute Summary

Attributes inherited from Mdlint::Linter::Rule

#violations

Instance Method Summary collapse

Methods included from SourceStyleSupport

#fenced_lines, #inline_tokens, #line_is_blank?, #lines, #outside_fence?

Methods inherited from Mdlint::Linter::Rule

#add_violation, #fix, inherited, #initialize

Constructor Details

This class inherits a constructor from Mdlint::Linter::Rule

Instance Method Details

#check(tokens, _source) ⇒ Object



304
305
306
307
308
309
310
311
312
313
# File 'lib/mdlint/linter/rules/source_style.rb', line 304

def check(tokens, _source)
  expected = @options.fetch(:strong_style, :asterisk).to_s
  inline_tokens(tokens).each do |token|
    next unless token.type == :strong_open
    next unless (expected == "asterisk" && token.markup == "__") || (expected == "underscore" && token.markup == "**")

    add_violation(message: "Use #{expected} strong markers", line: 1, fixable: false)
  end
  @violations
end