GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — node/tools/lint-pr-url.mjs at main · styfle/node Expand file tree/ Copy pathlint-pr-url.mjsMore file actions executable file ·37 lines (30 loc) · 1.16 KB / Copy pathlint-pr-url.mjsFile metadata and controlsexecutable file ·37 lines (30 loc) · 1.16 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 #!/usr/bin/env node // Usage: // git diff upstream/main...HEAD -G"pr-url:" -- "*.md" | \ // ./tools/lint-pr-url.mjs <expected-pr-url> import process from 'node:process'; import readline from 'node:readline'; const [, , expectedPrUrl] = process.argv; const fileDelimiter = /^\+\+\+ b\/(.+\.md)$/; const changeDelimiter = /^@@ -\d+,\d+ \+(\d+),\d+ @@/; const prUrlDefinition = /^\+\s+pr-url: (.+)$/; const validatePrUrl = (url) => url == null || url === expectedPrUrl; let currentFile; let currentLine; const diff = readline.createInterface({ input: process.stdin }); for await (const line of diff) { if (fileDelimiter.test(line)) { currentFile = line.match(fileDelimiter)[1]; console.log(`Parsing changes in ${currentFile}.`); } else if (changeDelimiter.test(line)) { currentLine = Number(line.match(changeDelimiter)[1]); } else if (!validatePrUrl(line.match(prUrlDefinition)?.[1])) { console.warn( `::warning file=${currentFile},line=${currentLine++},col=${line.length}` + '::pr-url doesn\'t match the URL of the current PR.' ); } else if (line[0] !== '-') { // Increment line counter if line is not being deleted. currentLine++; } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |