feat(#1726): G1-G6 portability AST rules; fix all offenders; delete the ratchet (Phase 4) (#1731)

Phase 4 of epic #1702. Closes #1726.
This commit is contained in:
Tom Boucher
2026-06-25 18:24:39 -04:00
committed by GitHub
parent 2990305f78
commit f08b177215
88 changed files with 2038 additions and 377 deletions

View File

@@ -59,7 +59,7 @@ function scanFiles(files, pattern, _description) {
const failures = [];
for (const file of files) {
const content = fs.readFileSync(file, 'utf8');
const lines = content.split('\n');
const lines = content.split(/\r?\n/);
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const trimmed = line.trimStart();
@@ -105,7 +105,7 @@ describe('no hardcoded /home/ absolute paths', () => {
test('no /home/<username>/ paths in string literals', () => {
// Requires: quote + /home/ + non-slash chars (the username) + /
// This avoids matching things like regex patterns /^home/
const homePath = /['"`]\/home\/[^/\s'"` \n]+\//;
const homePath = /['"`]\/home\/[^/\s'"` \r\n]+\//;
const failures = scanFiles(sourceFiles, homePath);
assert.deepStrictEqual(
failures, [],
@@ -122,7 +122,7 @@ describe('no hardcoded /home/ absolute paths', () => {
describe('no hardcoded /Users/ absolute paths', () => {
test('no /Users/<username>/ paths in string literals', () => {
// Requires: quote + /Users/ + username chars + /
const usersPath = /['"`]\/Users\/[^/\s'"` \n]+\//;
const usersPath = /['"`]\/Users\/[^/\s'"` \r\n]+\//;
const failures = scanFiles(sourceFiles, usersPath);
assert.deepStrictEqual(
failures, [],