tamperward 2.29.5 → 2.29.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +52 -6
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -3432,22 +3432,53 @@ function isCommentLine(trimmed, lang) {
|
|
|
3432
3432
|
return SLASH_COMMENT.test(trimmed);
|
|
3433
3433
|
}
|
|
3434
3434
|
function insideStringLiteral(line, idx, lang) {
|
|
3435
|
-
const
|
|
3435
|
+
const l = lang ?? "js";
|
|
3436
|
+
const hash = HASH_COMMENT_LANGS.has(l);
|
|
3436
3437
|
let quote = null;
|
|
3437
3438
|
for (let j = 0; j < idx; j++) {
|
|
3438
3439
|
const ch = line[j];
|
|
3439
3440
|
if (quote) {
|
|
3440
3441
|
if (ch === "\\") j++;
|
|
3441
|
-
else if (
|
|
3442
|
+
else if (quote.length === 3) {
|
|
3443
|
+
if (ch === quote[0] && line[j + 1] === quote[0] && line[j + 2] === quote[0]) {
|
|
3444
|
+
quote = null;
|
|
3445
|
+
j += 2;
|
|
3446
|
+
}
|
|
3447
|
+
} else if (ch === quote) quote = null;
|
|
3442
3448
|
continue;
|
|
3443
3449
|
}
|
|
3444
|
-
if (
|
|
3450
|
+
if (l === "py" && (ch === '"' || ch === "'") && line[j + 1] === ch && line[j + 2] === ch) {
|
|
3451
|
+
quote = ch.repeat(3);
|
|
3452
|
+
j += 2;
|
|
3453
|
+
} else if (ch === '"' || ch === "'" || ch === "`") quote = ch;
|
|
3445
3454
|
else if (ch === "/" && (line[j + 1] === "/" || line[j + 1] === "*")) return false;
|
|
3455
|
+
else if (l === "js" && ch === "/" && regexPosition(line.slice(0, j))) j = skipRegexLiteral(line, j);
|
|
3446
3456
|
else if (hash && ch === "#") return false;
|
|
3447
3457
|
}
|
|
3448
3458
|
return quote !== null;
|
|
3449
3459
|
}
|
|
3450
|
-
|
|
3460
|
+
function regexPosition(before) {
|
|
3461
|
+
const s = before.replace(/\s+$/, "");
|
|
3462
|
+
if (s === "") return true;
|
|
3463
|
+
const last = s[s.length - 1];
|
|
3464
|
+
if (/[\w$]/.test(last)) {
|
|
3465
|
+
const kw = /[A-Za-z_$][\w$]*$/.exec(s);
|
|
3466
|
+
return kw !== null && REGEX_KEYWORDS.has(kw[0]);
|
|
3467
|
+
}
|
|
3468
|
+
return last !== ")" && last !== "]" && last !== '"' && last !== "'" && last !== "`";
|
|
3469
|
+
}
|
|
3470
|
+
function skipRegexLiteral(line, start) {
|
|
3471
|
+
let inClass = false;
|
|
3472
|
+
for (let k = start + 1; k < line.length; k++) {
|
|
3473
|
+
const c = line[k];
|
|
3474
|
+
if (c === "\\") k++;
|
|
3475
|
+
else if (c === "[") inClass = true;
|
|
3476
|
+
else if (c === "]") inClass = false;
|
|
3477
|
+
else if (c === "/" && !inClass) return k;
|
|
3478
|
+
}
|
|
3479
|
+
return line.length - 1;
|
|
3480
|
+
}
|
|
3481
|
+
var CODE, EXT, COMMON, IMPORTS, HASH_COMMENT, DEBUG_ONLY, SLASH_COMMENT, HASH_COMMENT_LANGS, REGEX_KEYWORDS;
|
|
3451
3482
|
var init_files = __esm({
|
|
3452
3483
|
"src/detectors/files.ts"() {
|
|
3453
3484
|
"use strict";
|
|
@@ -3479,6 +3510,21 @@ var init_files = __esm({
|
|
|
3479
3510
|
DEBUG_ONLY = /^(?:console\.\w+\(.*\)\s*;?|debugger\s*;?)$/;
|
|
3480
3511
|
SLASH_COMMENT = /^(?:\/\/|\/\*|\*(?:\s|\/|$))/;
|
|
3481
3512
|
HASH_COMMENT_LANGS = /* @__PURE__ */ new Set(["py", "rb", "php"]);
|
|
3513
|
+
REGEX_KEYWORDS = /* @__PURE__ */ new Set([
|
|
3514
|
+
"return",
|
|
3515
|
+
"throw",
|
|
3516
|
+
"case",
|
|
3517
|
+
"yield",
|
|
3518
|
+
"do",
|
|
3519
|
+
"else",
|
|
3520
|
+
"in",
|
|
3521
|
+
"of",
|
|
3522
|
+
"typeof",
|
|
3523
|
+
"void",
|
|
3524
|
+
"delete",
|
|
3525
|
+
"instanceof",
|
|
3526
|
+
"new"
|
|
3527
|
+
]);
|
|
3482
3528
|
}
|
|
3483
3529
|
});
|
|
3484
3530
|
|
|
@@ -3890,8 +3936,8 @@ var init_lint_suppression = __esm({
|
|
|
3890
3936
|
{ re: /\bbiome-ignore\b/, why: "biome-ignore suppresses Biome diagnostics" }
|
|
3891
3937
|
],
|
|
3892
3938
|
py: [
|
|
3893
|
-
{ re: /#\s*noqa\b
|
|
3894
|
-
{ re: /#\s*(?:ruff|flake8):\s*noqa\b
|
|
3939
|
+
{ re: /#\s*noqa\b/i, why: "# noqa suppresses flake8/ruff findings" },
|
|
3940
|
+
{ re: /#\s*(?:ruff|flake8):\s*noqa\b/i, why: "# ruff: noqa / # flake8: noqa suppresses every finding in the file" },
|
|
3895
3941
|
{ re: /#\s*type:\s*ignore\b/, why: "# type: ignore suppresses the type checker" },
|
|
3896
3942
|
{ re: /#\s*mypy:\s*ignore-errors\b/, why: "# mypy: ignore-errors suppresses the type checker for the file" },
|
|
3897
3943
|
{ re: /#\s*pyright:\s*ignore\b/, why: "# pyright: ignore suppresses the type checker" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tamperward",
|
|
3
|
-
"version": "2.29.
|
|
3
|
+
"version": "2.29.6",
|
|
4
4
|
"description": "The deterministic agent-integrity gate. One ruleset, evaluated on the actual diff/commands as a verdict, enforced everywhere a change can be made.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "hexrift",
|