i18n-keys' "a plugin's words are its own" has been red on main since73c98ebc2and was filed four times with no owner. Each red was a Go comment citing a word from the window: search_row_archive_test.go's "(View routing, the …", trace.go's '"No session ID")' and skills_shared_copy_test.go's "Use the library's sets …". A comment says nothing to the window, so whole-line // comments in .go and .js are left out of the scan. Words in code are still found. Run on mote at this tree (on origin/mainc9a1c557d): - node --test i18n-keys.test.cjs: 4 pass, 0 fail (was 1 fail one3f1efdaa, the same three words). Broken by hand: a code line t("View routing") in app.js turns it red ("plugins/usage/i18n.js "View routing": internal/gui/assets/app.js says it too").
This commit is contained in:
@@ -46,7 +46,14 @@ test("a plugin's words are its own", () => {
|
||||
const p = path.join(d, e.name);
|
||||
if (e.isDirectory()) {
|
||||
if (!["node_modules", ".git", "site", "tests", "testdata", "docs"].includes(e.name)) walk(p);
|
||||
} else if (/\.(go|js|html|css)$/.test(e.name) && e.name !== "i18n.js") texts.push([p, fs.readFileSync(p, "utf8")]);
|
||||
} else if (/\.(go|js|html|css)$/.test(e.name) && e.name !== "i18n.js") {
|
||||
let text = fs.readFileSync(p, "utf8");
|
||||
// a comment line says nothing to the window: Go's "(View routing,
|
||||
// the …" and "Use the library's sets …" cite a plugin's words
|
||||
// (#5332, #5327, #5426, #5482)
|
||||
if (/\.(go|js)$/.test(e.name)) text = text.split("\n").filter((l) => !/^\s*\/\//.test(l)).join("\n");
|
||||
texts.push([p, text]);
|
||||
}
|
||||
}
|
||||
};
|
||||
walk(repo);
|
||||
|
||||
Reference in New Issue
Block a user