fix: detect unpunctuated Korean plain endings
This commit is contained in:
@@ -38,7 +38,7 @@ Write Korean reader-facing prose as a supported first-person experience, not as
|
|||||||
- Use conversational but disciplined Korean. A Korean developer should be able to say the sentence naturally to a colleague without turning it into forced colloquial speech.
|
- Use conversational but disciplined Korean. A Korean developer should be able to say the sentence naturally to a colleague without turning it into forced colloquial speech.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
_PLAIN_FORM_ENDING = re.compile(r"(?<!니)다(?=[.!?](?:\s|$))")
|
_PLAIN_FORM_ENDING = re.compile(r"(?<!니)다(?=(?:[.!?](?:\s|$)|$))")
|
||||||
_FIRST_PERSON = re.compile(r"(?:저는|제가)")
|
_FIRST_PERSON = re.compile(r"(?:저는|제가)")
|
||||||
_FENCE = re.compile(r"^\s*(?:```|~~~)")
|
_FENCE = re.compile(r"^\s*(?:```|~~~)")
|
||||||
_HEADING = re.compile(r"^\s{0,3}(#{1,6})\s+(.+?)\s*$")
|
_HEADING = re.compile(r"^\s{0,3}(#{1,6})\s+(.+?)\s*$")
|
||||||
|
|||||||
@@ -201,6 +201,19 @@ class LintTests(unittest.TestCase):
|
|||||||
self.assertEqual(issues[0].severity, Severity.BLOCKER)
|
self.assertEqual(issues[0].severity, Severity.BLOCKER)
|
||||||
self.assertEqual(report.metrics["plain_form_ending_count"], 1)
|
self.assertEqual(report.metrics["plain_form_ending_count"], 1)
|
||||||
|
|
||||||
|
def test_korean_experience_contract_blocks_unpunctuated_plain_ending(self) -> None:
|
||||||
|
brief = self._korean_experience_brief()
|
||||||
|
sources = make_sources()
|
||||||
|
text, outline = self._experience_document(
|
||||||
|
brief,
|
||||||
|
extra_by_section={0: "현재 구현은 이 값을 사용한다"},
|
||||||
|
)
|
||||||
|
|
||||||
|
report = lint_document(text, brief, outline, sources)
|
||||||
|
|
||||||
|
self.assertIn("STYLE002", {issue.code for issue in report.issues})
|
||||||
|
self.assertEqual(report.metrics["plain_form_ending_count"], 1)
|
||||||
|
|
||||||
def test_korean_style_lint_exempts_non_reader_prose(self) -> None:
|
def test_korean_style_lint_exempts_non_reader_prose(self) -> None:
|
||||||
brief = self._korean_experience_brief()
|
brief = self._korean_experience_brief()
|
||||||
sources = make_sources()
|
sources = make_sources()
|
||||||
|
|||||||
Reference in New Issue
Block a user