Class: Mdlint::Linter::Rules::JapanesePunctuation
- Inherits:
-
Mdlint::Linter::Rule
- Object
- Mdlint::Linter::Rule
- Mdlint::Linter::Rules::JapanesePunctuation
- Includes:
- JapaneseHelpers
- Defined in:
- lib/mdlint/linter/rules/japanese.rb,
sig/internal.rbs
Constant Summary
Constants included from JapaneseHelpers
Mdlint::Linter::Rules::JapaneseHelpers::CJK, Mdlint::Linter::Rules::JapaneseHelpers::JAPANESE
Instance Attribute Summary
Attributes inherited from Mdlint::Linter::Rule
Instance Method Summary collapse
Methods included from JapaneseHelpers
#each_inline, #line_for, #prose_content
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
61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/mdlint/linter/rules/japanese.rb', line 61 def check(tokens, _source) each_inline(tokens) do |token| content = prose_content(token) next unless content.match?(JAPANESE) next unless content.match?(/[、。!?] |[,:!?](?:#{JAPANESE})|(?<!\.)\.(?:#{JAPANESE})/) add_violation( message: "Use Japanese punctuation consistently in Japanese prose", line: line_for(token), fixable: false ) end @violations end |