mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-17 13:44:32 +01:00
Accept a requested docs fix when the audit names the file with a line number (#4437)
finish --docs-requested refused a correct fix when the docs audit named the
file as path:line ("changelog.d/engine-parity-decisions.md:8: wording") or
path:line:column, because the match only allowed whitespace, quotes or
punctuation right after the path. It now also allows :<line> and
:<line>:<column> before those, while a different file sharing the path's
prefix still doesn't match. Reported by Vorflux via FOUN-32.
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
e66a772722
commit
127bcd6d55
3 files changed
+24
-1
No files matched your search
+1
-1
@@ -546,7 +546,7 @@ function docsFresh(cwd: string, base: string, postFile: string, moved: readonly
|
||||
try { audit = resultFile ? JSON.parse(fs.readFileSync(resultFile, 'utf8')) : null; } catch { audit = null; }
|
||||
for (const p of requested.filter(q => stale!.includes(q) && !carried.tests.includes(q) && !carried.base.includes(q) && !carried.accepted.includes(q))) {
|
||||
const asked = [...(Array.isArray(audit?.blockers) ? audit.blockers : []), ...(Array.isArray(audit?.decisions) ? audit.decisions : [])].filter((s: unknown) => typeof s === 'string');
|
||||
const token = new RegExp(`(^|[\\s\`'"(\\[])${p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?=$|[\\s\`'")\\]]|[,.:;](?:$|\\s))`);
|
||||
const token = new RegExp(`(^|[\\s\`'"(\\[])${p.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?::\\d+(?::\\d+)?)?(?=$|[\\s\`'")\\]]|[,.:;](?:$|\\s))`);
|
||||
const stat = git(cwd, ['diff', '--numstat', '--no-renames', record.head, '--', `:(literal)${p}`]).stdout.trim().split(/\s+/);
|
||||
const lines = Number(stat[0]) + Number(stat[1]);
|
||||
const why = !audit ? 'needs --docs-result <the audit\'s saved result JSON>'
|
||||
|
||||
Reference in new issue
Block a user