refactor: simplify pass (trekexecute)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
051331a5ef
commit
7cb038cce3
2 changed files with 3 additions and 8 deletions
|
|
@ -353,11 +353,7 @@ function argsShellOpeners(text) {
|
||||||
if (k !== second + 1) unreadable = true;
|
if (k !== second + 1) unreadable = true;
|
||||||
k = skip(k + 1);
|
k = skip(k + 1);
|
||||||
}
|
}
|
||||||
while (k < n) {
|
while (text[k] === ' ' || text[k] === '\t') k = skip(k + 1);
|
||||||
if (text[k] === ' ' || text[k] === '\t') k += 1;
|
|
||||||
else if (text[k] === '\\' && text[k + 1] === '\n') k += 2;
|
|
||||||
else break;
|
|
||||||
}
|
|
||||||
const start = k;
|
const start = k;
|
||||||
let word = '';
|
let word = '';
|
||||||
let quoted = false;
|
let quoted = false;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ async function expectArgsBlocked(command) {
|
||||||
const { code, stderr } = await runHook(PRE_BASH, bashInput(command));
|
const { code, stderr } = await runHook(PRE_BASH, bashInput(command));
|
||||||
assert.match(stderr, ARGS_RULE, `the guard did not name args-heredoc-closed-early for: ${JSON.stringify(command)}`);
|
assert.match(stderr, ARGS_RULE, `the guard did not name args-heredoc-closed-early for: ${JSON.stringify(command)}`);
|
||||||
assert.strictEqual(code, 2, `the guard did not block: ${JSON.stringify(command)}`);
|
assert.strictEqual(code, 2, `the guard did not block: ${JSON.stringify(command)}`);
|
||||||
|
return stderr;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function expectArgsAllowed(command) {
|
async function expectArgsAllowed(command) {
|
||||||
|
|
@ -47,9 +48,7 @@ async function expectArgsAllowed(command) {
|
||||||
const UNQUOTED = /opens VOYAGE_ARGS_EOF_7F3C9E unquoted/;
|
const UNQUOTED = /opens VOYAGE_ARGS_EOF_7F3C9E unquoted/;
|
||||||
|
|
||||||
async function expectUnquoted(command) {
|
async function expectUnquoted(command) {
|
||||||
const { code, stderr } = await runHook(PRE_BASH, bashInput(command));
|
const stderr = await expectArgsBlocked(command);
|
||||||
assert.match(stderr, ARGS_RULE, `the guard did not name args-heredoc-closed-early for: ${JSON.stringify(command)}`);
|
|
||||||
assert.strictEqual(code, 2, `the guard did not block: ${JSON.stringify(command)}`);
|
|
||||||
assert.match(stderr, UNQUOTED, `the guard did not give the unquoted reason for: ${JSON.stringify(command)}`);
|
assert.match(stderr, UNQUOTED, `the guard did not give the unquoted reason for: ${JSON.stringify(command)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue