Add the English-comments check: corpus, ADR-0012, detector, report and reusable workflow #211

Merged
Tirsvad merged 5 commits from mil-013-english-comments into main 2026-10-19 06:48:54 +02:00
5 Commits
Author SHA1 Message Date
Tirsvad 57d9b63b3c Document the English-comments workflow: guide, README, wiki in three languages
TirSystem/github-action: Sync GitHub mirror metadata / sync-metadata (push) Skipped
Validate workflows / validate (pull_request) Successful in 57s
Adds the guide, the README section with its diagram, the wiki page in English,
Danish and Bahasa Malaysia, the Home and Capabilities rows, the sidebar entry
and the changelog entry under Unreleased.

Refs #206
Task: MIL-013#10
2026-10-19 12:34:15 +08:00
Tirsvad a767ded5e1 Add the reporting step and the reusable english-comments workflow
tools/english_comments_report.py keeps one comment on the pull request that
mentions the author, updates it on a re-run and marks it resolved when the
check passes. english-comments.yml runs the check on the full history, tells
the author even when the check fails, and then fails the run. A script that no
release holds yet no longer counts as missing from the default tools-ref.

Refs #201
Refs #202
Task: MIL-013#5
Task: MIL-013#6
2026-10-19 12:34:07 +08:00
Tirsvad b8e63d0a29 Add the comment extractor and the language detector of the English-comments check
tools/english_comments.py reads the comments and docstrings of the languages of
ADR-0010 (the scanner of count_loc.py now returns the comment text), joins the
lines of a block, removes everything that is not a word and judges the block
with langid (ADR-0012). It checks the lines a branch adds, or every tracked
file, honours an ignore marker and an allowed-words file, and prints each
finding as an annotation. The rates of the corpus are tests.

Refs #199
Refs #200
Refs #203
Task: MIL-013#3
Task: MIL-013#4
2026-10-19 12:34:00 +08:00
Tirsvad 7d8cc4522e Choose the detection method for the English-comments check (ADR-0012)
Compares a rule-based method, langdetect, langid and lingua on the corpus.
langid with a pre-filter and a 0.6 threshold flags 0 of 300 English comments,
44/45 Danish and 41/45 Malay. The comparison script is kept next to the corpus.

Refs #198
Task: MIL-013#2
2026-10-19 12:21:23 +08:00
Tirsvad 0603c61602 Add the labelled comment corpus for the English-comments check
300 English comments from this repository and 138 comments in Danish, Bahasa
Malaysia, German, Swedish, Norwegian and French, written for the purpose and
not checked by a native reader. The detection method is measured on it.

Refs #197
Task: MIL-013#1
2026-10-19 12:21:22 +08:00