@kevinrabun/judges 3.59.0 → 3.60.0
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/CHANGELOG.md +12 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/adoption-track.d.ts +5 -0
- package/dist/commands/adoption-track.d.ts.map +1 -0
- package/dist/commands/adoption-track.js +247 -0
- package/dist/commands/adoption-track.js.map +1 -0
- package/dist/commands/context-blind.d.ts +5 -0
- package/dist/commands/context-blind.d.ts.map +1 -0
- package/dist/commands/context-blind.js +273 -0
- package/dist/commands/context-blind.js.map +1 -0
- package/dist/commands/finding-budget.d.ts +5 -0
- package/dist/commands/finding-budget.d.ts.map +1 -0
- package/dist/commands/finding-budget.js +233 -0
- package/dist/commands/finding-budget.js.map +1 -0
- package/dist/commands/hallucination-detect.d.ts +5 -0
- package/dist/commands/hallucination-detect.d.ts.map +1 -0
- package/dist/commands/hallucination-detect.js +351 -0
- package/dist/commands/hallucination-detect.js.map +1 -0
- package/dist/commands/over-abstraction.d.ts +5 -0
- package/dist/commands/over-abstraction.d.ts.map +1 -0
- package/dist/commands/over-abstraction.js +308 -0
- package/dist/commands/over-abstraction.js.map +1 -0
- package/dist/commands/review-digest.d.ts +5 -0
- package/dist/commands/review-digest.d.ts.map +1 -0
- package/dist/commands/review-digest.js +266 -0
- package/dist/commands/review-digest.js.map +1 -0
- package/dist/commands/security-theater.d.ts +5 -0
- package/dist/commands/security-theater.d.ts.map +1 -0
- package/dist/commands/security-theater.js +279 -0
- package/dist/commands/security-theater.js.map +1 -0
- package/dist/commands/stale-pattern.d.ts +5 -0
- package/dist/commands/stale-pattern.d.ts.map +1 -0
- package/dist/commands/stale-pattern.js +294 -0
- package/dist/commands/stale-pattern.js.map +1 -0
- package/package.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security-theater — detect security-looking code that provides no actual protection.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
5
|
+
import { join, extname } from "path";
|
|
6
|
+
// ─── File Collection ────────────────────────────────────────────────────────
|
|
7
|
+
const CODE_EXTS = new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".java", ".go", ".cs"]);
|
|
8
|
+
function collectFiles(dir, max = 300) {
|
|
9
|
+
const files = [];
|
|
10
|
+
function walk(d) {
|
|
11
|
+
if (files.length >= max)
|
|
12
|
+
return;
|
|
13
|
+
let entries;
|
|
14
|
+
try {
|
|
15
|
+
entries = readdirSync(d);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const e of entries) {
|
|
21
|
+
if (files.length >= max)
|
|
22
|
+
return;
|
|
23
|
+
if (e.startsWith(".") || e === "node_modules" || e === "dist" || e === "build")
|
|
24
|
+
continue;
|
|
25
|
+
const full = join(d, e);
|
|
26
|
+
try {
|
|
27
|
+
if (statSync(full).isDirectory())
|
|
28
|
+
walk(full);
|
|
29
|
+
else if (CODE_EXTS.has(extname(full)))
|
|
30
|
+
files.push(full);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* skip */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
walk(dir);
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
// ─── Analysis ───────────────────────────────────────────────────────────────
|
|
41
|
+
function analyzeFile(filepath) {
|
|
42
|
+
const issues = [];
|
|
43
|
+
let content;
|
|
44
|
+
try {
|
|
45
|
+
content = readFileSync(filepath, "utf-8");
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return issues;
|
|
49
|
+
}
|
|
50
|
+
const lines = content.split("\n");
|
|
51
|
+
for (let i = 0; i < lines.length; i++) {
|
|
52
|
+
const line = lines[i];
|
|
53
|
+
const trimmed = line.trim();
|
|
54
|
+
if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*"))
|
|
55
|
+
continue;
|
|
56
|
+
// Weak password hashing
|
|
57
|
+
if (/(?:createHash|hashlib\.)\s*\(\s*['"](?:md5|sha1)['"]\s*\)/.test(line) &&
|
|
58
|
+
/password|passwd|pwd/i.test(lines.slice(Math.max(0, i - 3), i + 3).join(" "))) {
|
|
59
|
+
issues.push({
|
|
60
|
+
file: filepath,
|
|
61
|
+
line: i + 1,
|
|
62
|
+
issue: "Weak password hashing (MD5/SHA1)",
|
|
63
|
+
severity: "high",
|
|
64
|
+
detail: "MD5/SHA1 are not appropriate for password hashing — use bcrypt, scrypt, or argon2",
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// Hardcoded encryption keys/IVs
|
|
68
|
+
if (/(?:key|iv|secret|password)\s*[:=]\s*['"][A-Za-z0-9+/=]{8,}['"]/.test(line) &&
|
|
69
|
+
/(?:cipher|encrypt|decrypt|crypto|aes|des)/i.test(lines.slice(Math.max(0, i - 5), i + 5).join(" "))) {
|
|
70
|
+
issues.push({
|
|
71
|
+
file: filepath,
|
|
72
|
+
line: i + 1,
|
|
73
|
+
issue: "Hardcoded encryption key or IV",
|
|
74
|
+
severity: "high",
|
|
75
|
+
detail: "Encryption keys/IVs must not be hardcoded — use environment variables or key management services",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
// Wildcard CORS with auth
|
|
79
|
+
if (/['"]Access-Control-Allow-Origin['"]\s*[:,]\s*['"]\s*[*]\s*['"]/.test(line)) {
|
|
80
|
+
const nearby = lines.slice(i, Math.min(i + 10, lines.length)).join(" ");
|
|
81
|
+
if (/(?:authorization|cookie|credentials|auth)/i.test(nearby)) {
|
|
82
|
+
issues.push({
|
|
83
|
+
file: filepath,
|
|
84
|
+
line: i + 1,
|
|
85
|
+
issue: "CORS wildcard (*) with authentication",
|
|
86
|
+
severity: "high",
|
|
87
|
+
detail: "Access-Control-Allow-Origin: * combined with authentication bypasses same-origin policy protections",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
issues.push({
|
|
92
|
+
file: filepath,
|
|
93
|
+
line: i + 1,
|
|
94
|
+
issue: "CORS wildcard (*)",
|
|
95
|
+
severity: "medium",
|
|
96
|
+
detail: "CORS wildcard allows any origin — restrict to trusted domains unless truly public",
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// CSRF token generated but never verified
|
|
101
|
+
if (/csrf[_-]?token|csrfToken|_csrf/i.test(line) && /generate|create|set|assign/i.test(line)) {
|
|
102
|
+
const fileContent = content;
|
|
103
|
+
if (!/csrf.*verif|verify.*csrf|csrf.*valid|csrfProtection|csurf/i.test(fileContent)) {
|
|
104
|
+
issues.push({
|
|
105
|
+
file: filepath,
|
|
106
|
+
line: i + 1,
|
|
107
|
+
issue: "CSRF token generated but never verified",
|
|
108
|
+
severity: "high",
|
|
109
|
+
detail: "CSRF tokens must be verified on the server side — generation alone provides no protection",
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
// Rate limiting that is too lenient
|
|
114
|
+
if (/rateLimit|rate[_-]?limit/i.test(line)) {
|
|
115
|
+
const context = lines.slice(i, Math.min(i + 5, lines.length)).join(" ");
|
|
116
|
+
const limitMatch = context.match(/(?:max|limit|windowMs|window)\s*[:=]\s*(\d+)/);
|
|
117
|
+
if (limitMatch) {
|
|
118
|
+
const val = parseInt(limitMatch[1], 10);
|
|
119
|
+
if (/max|limit/i.test(limitMatch[0]) && val >= 10000) {
|
|
120
|
+
issues.push({
|
|
121
|
+
file: filepath,
|
|
122
|
+
line: i + 1,
|
|
123
|
+
issue: "Ineffective rate limiting (limit too high)",
|
|
124
|
+
severity: "medium",
|
|
125
|
+
detail: `Rate limit of ${val} requests is too permissive to be protective`,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Validation without authorization
|
|
131
|
+
if (/(?:validate|sanitize|check)\s*\(\s*(?:req|request)/.test(line) || /(?:joi|yup|zod)\s*\./.test(line)) {
|
|
132
|
+
if (/(?:body|params|query)/.test(line)) {
|
|
133
|
+
const nearby = lines.slice(Math.max(0, i - 10), Math.min(i + 10, lines.length)).join(" ");
|
|
134
|
+
if (!/(?:auth|authorize|isAuthenticated|requireAuth|passport|jwt|token|session)/.test(nearby)) {
|
|
135
|
+
issues.push({
|
|
136
|
+
file: filepath,
|
|
137
|
+
line: i + 1,
|
|
138
|
+
issue: "Input validation without authorization check",
|
|
139
|
+
severity: "medium",
|
|
140
|
+
detail: "Validating input without checking authorization — an unauthenticated user could send valid-looking data",
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// Client-side only validation
|
|
146
|
+
if (/(?:disabled|readonly|hidden)\s*[=:]\s*(?:true|['"]true['"])/.test(line) &&
|
|
147
|
+
/(?:submit|form|action)/i.test(lines.slice(Math.max(0, i - 5), i + 5).join(" "))) {
|
|
148
|
+
issues.push({
|
|
149
|
+
file: filepath,
|
|
150
|
+
line: i + 1,
|
|
151
|
+
issue: "Client-side-only form restriction",
|
|
152
|
+
severity: "medium",
|
|
153
|
+
detail: "disabled/readonly/hidden form attributes can be bypassed — enforce restrictions server-side",
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
// Base64 used as encryption
|
|
157
|
+
if (/(?:btoa|atob|Buffer\.from\([^)]*,\s*['"]base64['"]|base64[_-]?encode|base64[_-]?decode)/i.test(line)) {
|
|
158
|
+
const nearby = lines.slice(Math.max(0, i - 3), i + 3).join(" ");
|
|
159
|
+
if (/(?:encrypt|secret|password|secure|protect|hide)/i.test(nearby)) {
|
|
160
|
+
issues.push({
|
|
161
|
+
file: filepath,
|
|
162
|
+
line: i + 1,
|
|
163
|
+
issue: "Base64 used as encryption",
|
|
164
|
+
severity: "high",
|
|
165
|
+
detail: "Base64 is encoding, not encryption — it provides zero confidentiality",
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// SQL partial parameterization
|
|
170
|
+
if (/(?:query|execute|exec|raw)\s*\(/.test(line)) {
|
|
171
|
+
const context = lines.slice(i, Math.min(i + 3, lines.length)).join(" ");
|
|
172
|
+
if (/\$\{|\+\s*['"]/.test(context) && /[?$]/.test(context)) {
|
|
173
|
+
issues.push({
|
|
174
|
+
file: filepath,
|
|
175
|
+
line: i + 1,
|
|
176
|
+
issue: "Partially parameterized SQL query",
|
|
177
|
+
severity: "high",
|
|
178
|
+
detail: "Query mixes parameterized values with string concatenation — fully parameterize all inputs",
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Commented-out security controls
|
|
183
|
+
if (/^\s*\/\/\s*(?:app\.use\s*\(\s*(?:helmet|csrf|cors|rateLimit)|requireAuth|isAuthenticated|authorize)/.test(line)) {
|
|
184
|
+
issues.push({
|
|
185
|
+
file: filepath,
|
|
186
|
+
line: i + 1,
|
|
187
|
+
issue: "Commented-out security middleware",
|
|
188
|
+
severity: "high",
|
|
189
|
+
detail: "Security middleware is commented out — likely left disabled from debugging",
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
// JWT with 'none' algorithm
|
|
193
|
+
if (/algorithm[s]?\s*[:=]\s*\[?\s*['"]none['"]/i.test(line)) {
|
|
194
|
+
issues.push({
|
|
195
|
+
file: filepath,
|
|
196
|
+
line: i + 1,
|
|
197
|
+
issue: "JWT 'none' algorithm allowed",
|
|
198
|
+
severity: "high",
|
|
199
|
+
detail: "Allowing 'none' algorithm in JWT verification completely disables signature checking",
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
// Overly long JWT expiration
|
|
203
|
+
if (/expiresIn\s*[:=]\s*['"](\d+)([dh])['"]/.test(line)) {
|
|
204
|
+
const match = line.match(/expiresIn\s*[:=]\s*['"](\d+)([dh])['"]/);
|
|
205
|
+
if (match) {
|
|
206
|
+
const val = parseInt(match[1], 10);
|
|
207
|
+
const unit = match[2];
|
|
208
|
+
if ((unit === "d" && val > 30) || (unit === "h" && val > 720)) {
|
|
209
|
+
issues.push({
|
|
210
|
+
file: filepath,
|
|
211
|
+
line: i + 1,
|
|
212
|
+
issue: "JWT expiration too long",
|
|
213
|
+
severity: "medium",
|
|
214
|
+
detail: `Token expiration of ${val}${unit} is excessively long — shorter-lived tokens reduce blast radius of theft`,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return issues;
|
|
221
|
+
}
|
|
222
|
+
// ─── CLI ────────────────────────────────────────────────────────────────────
|
|
223
|
+
export function runSecurityTheater(argv) {
|
|
224
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
225
|
+
console.log(`
|
|
226
|
+
judges security-theater — Detect security-looking code that provides no protection
|
|
227
|
+
|
|
228
|
+
Usage:
|
|
229
|
+
judges security-theater [dir]
|
|
230
|
+
judges security-theater src/ --format json
|
|
231
|
+
|
|
232
|
+
Options:
|
|
233
|
+
[dir] Directory to scan (default: .)
|
|
234
|
+
--format json JSON output
|
|
235
|
+
--help, -h Show this help
|
|
236
|
+
|
|
237
|
+
Checks: weak password hashing, hardcoded keys/IVs, wildcard CORS with auth,
|
|
238
|
+
unverified CSRF tokens, ineffective rate limiting, validation without auth,
|
|
239
|
+
base64-as-encryption, partial SQL parameterization, commented-out security
|
|
240
|
+
middleware, JWT 'none' algorithm, overly long JWT expiration.
|
|
241
|
+
`);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
245
|
+
const dir = argv.find((a) => !a.startsWith("-") && argv.indexOf(a) > 0) || ".";
|
|
246
|
+
const files = collectFiles(dir);
|
|
247
|
+
const allIssues = [];
|
|
248
|
+
for (const f of files)
|
|
249
|
+
allIssues.push(...analyzeFile(f));
|
|
250
|
+
const highCount = allIssues.filter((i) => i.severity === "high").length;
|
|
251
|
+
const medCount = allIssues.filter((i) => i.severity === "medium").length;
|
|
252
|
+
const score = Math.max(0, 100 - highCount * 15 - medCount * 7 - allIssues.filter((i) => i.severity === "low").length * 3);
|
|
253
|
+
if (format === "json") {
|
|
254
|
+
console.log(JSON.stringify({
|
|
255
|
+
issues: allIssues,
|
|
256
|
+
score,
|
|
257
|
+
summary: { high: highCount, medium: medCount, total: allIssues.length },
|
|
258
|
+
timestamp: new Date().toISOString(),
|
|
259
|
+
}, null, 2));
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
const badge = score >= 80 ? "✅ GENUINE SECURITY" : score >= 50 ? "⚠️ THEATER DETECTED" : "❌ SECURITY THEATER";
|
|
263
|
+
console.log(`\n Security-Theater: ${badge} (${score}/100)\n ─────────────────────────────`);
|
|
264
|
+
if (allIssues.length === 0) {
|
|
265
|
+
console.log(" No security theater detected.\n");
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
for (const issue of allIssues.slice(0, 25)) {
|
|
269
|
+
const icon = issue.severity === "high" ? "🔴" : issue.severity === "medium" ? "🟡" : "🔵";
|
|
270
|
+
console.log(` ${icon} ${issue.issue}`);
|
|
271
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
272
|
+
console.log(` ${issue.detail}`);
|
|
273
|
+
}
|
|
274
|
+
if (allIssues.length > 25)
|
|
275
|
+
console.log(` ... and ${allIssues.length - 25} more`);
|
|
276
|
+
console.log(`\n Total: ${allIssues.length} | High: ${highCount} | Medium: ${medCount} | Score: ${score}/100\n`);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
//# sourceMappingURL=security-theater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-theater.js","sourceRoot":"","sources":["../../src/commands/security-theater.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACzD,OAAO,EAAE,IAA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CAAC;QACpF,OAAO,CAAC,GAAG,CAAC,gBAAgB,SAAS,CAAC,MAAM,YAAY,SAAS,cAAc,QAAQ,aAAa,KAAK,QAAQ,CAAC,CAAC;IACrH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-pattern.d.ts","sourceRoot":"","sources":["../../src/commands/stale-pattern.ts"],"names":[],"mappings":"AAAA;;GAEG;AA6QH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAiEpD"}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stale-pattern — identify outdated idioms when modern alternatives exist.
|
|
3
|
+
*/
|
|
4
|
+
import { readFileSync, readdirSync, statSync } from "fs";
|
|
5
|
+
import { join, extname } from "path";
|
|
6
|
+
// ─── File Collection ────────────────────────────────────────────────────────
|
|
7
|
+
const CODE_EXTS = new Set([".ts", ".tsx", ".js", ".jsx"]);
|
|
8
|
+
function collectFiles(dir, max = 300) {
|
|
9
|
+
const files = [];
|
|
10
|
+
function walk(d) {
|
|
11
|
+
if (files.length >= max)
|
|
12
|
+
return;
|
|
13
|
+
let entries;
|
|
14
|
+
try {
|
|
15
|
+
entries = readdirSync(d);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
for (const e of entries) {
|
|
21
|
+
if (files.length >= max)
|
|
22
|
+
return;
|
|
23
|
+
if (e.startsWith(".") || e === "node_modules" || e === "dist" || e === "build")
|
|
24
|
+
continue;
|
|
25
|
+
const full = join(d, e);
|
|
26
|
+
try {
|
|
27
|
+
if (statSync(full).isDirectory())
|
|
28
|
+
walk(full);
|
|
29
|
+
else if (CODE_EXTS.has(extname(full)))
|
|
30
|
+
files.push(full);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* skip */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
walk(dir);
|
|
38
|
+
return files;
|
|
39
|
+
}
|
|
40
|
+
const STALE_PATTERNS = [
|
|
41
|
+
// Node.js deprecated APIs
|
|
42
|
+
{
|
|
43
|
+
regex: /new\s+Buffer\s*\(/,
|
|
44
|
+
name: "new Buffer()",
|
|
45
|
+
severity: "high",
|
|
46
|
+
modern: "Buffer.from() / Buffer.alloc()",
|
|
47
|
+
detail: "new Buffer() is deprecated due to security issues (uninitialized memory)",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
regex: /url\.parse\s*\(/,
|
|
51
|
+
name: "url.parse()",
|
|
52
|
+
severity: "medium",
|
|
53
|
+
modern: "new URL()",
|
|
54
|
+
detail: "url.parse() is deprecated — use the WHATWG URL API",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
regex: /require\s*\(\s*['"]domain['"]/,
|
|
58
|
+
name: "domain module",
|
|
59
|
+
severity: "medium",
|
|
60
|
+
modern: "AsyncLocalStorage or structured error handling",
|
|
61
|
+
detail: "The domain module is deprecated and should not be used for error handling",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
regex: /require\s*\(\s*['"]punycode['"]/,
|
|
65
|
+
name: "punycode module",
|
|
66
|
+
severity: "low",
|
|
67
|
+
modern: "url.domainToASCII() / url.domainToUnicode()",
|
|
68
|
+
detail: "Built-in punycode module is deprecated",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
regex: /fs\.exists\s*\(/,
|
|
72
|
+
name: "fs.exists()",
|
|
73
|
+
severity: "medium",
|
|
74
|
+
modern: "fs.access() or fs.stat()",
|
|
75
|
+
detail: "fs.exists() is deprecated — use fs.access() for existence checks",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
regex: /path\._makeLong\s*\(/,
|
|
79
|
+
name: "path._makeLong()",
|
|
80
|
+
severity: "low",
|
|
81
|
+
modern: "path.toNamespacedPath()",
|
|
82
|
+
detail: "path._makeLong() is an internal API — use toNamespacedPath()",
|
|
83
|
+
},
|
|
84
|
+
// Callback patterns vs async/await
|
|
85
|
+
{
|
|
86
|
+
regex: /(\w+)\s*\(\s*(?:function\s*\(|[(]\s*)\s*(?:err|error)\s*,\s*(?:data|result|res|body|response)/,
|
|
87
|
+
name: "Error-first callback",
|
|
88
|
+
severity: "medium",
|
|
89
|
+
modern: "async/await with promises",
|
|
90
|
+
detail: "Error-first callbacks should be replaced with async/await for readability and error handling",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
regex: /\.then\s*\(\s*(?:function|[(])\s*\w*\s*[)]*\s*\{[^}]*\.then\s*\(/,
|
|
94
|
+
name: "Nested .then() chains",
|
|
95
|
+
severity: "medium",
|
|
96
|
+
modern: "async/await",
|
|
97
|
+
detail: "Nested promise chains are hard to read — use async/await",
|
|
98
|
+
},
|
|
99
|
+
// Old JavaScript patterns
|
|
100
|
+
{
|
|
101
|
+
regex: /var\s+\w+\s*=/,
|
|
102
|
+
name: "var declaration",
|
|
103
|
+
severity: "low",
|
|
104
|
+
modern: "const / let",
|
|
105
|
+
detail: "var has function scoping issues — use const or let for block scoping",
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
regex: /typeof\s+\w+\s*[!=]==?\s*['"]undefined['"]/,
|
|
109
|
+
name: "typeof undefined check",
|
|
110
|
+
severity: "low",
|
|
111
|
+
modern: "Optional chaining (?.) or nullish coalescing (??)",
|
|
112
|
+
detail: "typeof undefined checks can often be replaced with optional chaining",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
regex: /\.apply\s*\(\s*(?:null|this)\s*,\s*arguments\s*\)/,
|
|
116
|
+
name: ".apply(null, arguments)",
|
|
117
|
+
severity: "low",
|
|
118
|
+
modern: "...rest parameters and spread",
|
|
119
|
+
detail: "Use rest parameters and spread syntax instead of arguments object",
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
regex: /arguments\s*\[\s*\d+\s*\]/,
|
|
123
|
+
name: "arguments[] indexing",
|
|
124
|
+
severity: "low",
|
|
125
|
+
modern: "Named parameters or rest (...args)",
|
|
126
|
+
detail: "The arguments object is a legacy feature — use named or rest parameters",
|
|
127
|
+
},
|
|
128
|
+
// Old testing patterns
|
|
129
|
+
{
|
|
130
|
+
regex: /(?:it|test)\s*\(\s*['"][^'"]+['"]\s*,\s*function\s*\(\s*done\s*\)/,
|
|
131
|
+
name: "done() callback test",
|
|
132
|
+
severity: "medium",
|
|
133
|
+
modern: "async test functions",
|
|
134
|
+
detail: "Test done() callbacks are error-prone — use async/await in tests",
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
regex: /\.should\.\w+/,
|
|
138
|
+
name: "should-style assertions",
|
|
139
|
+
severity: "low",
|
|
140
|
+
modern: "expect() or assert()",
|
|
141
|
+
detail: "Should-style assertions modify Object.prototype — use expect() or assert()",
|
|
142
|
+
},
|
|
143
|
+
// React class components
|
|
144
|
+
{
|
|
145
|
+
regex: /class\s+\w+\s+extends\s+(?:React\.)?(?:Component|PureComponent)\s*[<{]/,
|
|
146
|
+
name: "React class component",
|
|
147
|
+
severity: "medium",
|
|
148
|
+
modern: "Function components with hooks",
|
|
149
|
+
detail: "React class components are legacy — prefer function components with hooks",
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
regex: /componentWillMount\s*\(/,
|
|
153
|
+
name: "componentWillMount",
|
|
154
|
+
severity: "high",
|
|
155
|
+
modern: "useEffect hook",
|
|
156
|
+
detail: "componentWillMount is removed in React 18 — use useEffect",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
regex: /componentWillReceiveProps\s*\(/,
|
|
160
|
+
name: "componentWillReceiveProps",
|
|
161
|
+
severity: "high",
|
|
162
|
+
modern: "getDerivedStateFromProps or useEffect",
|
|
163
|
+
detail: "componentWillReceiveProps is removed in React 18",
|
|
164
|
+
},
|
|
165
|
+
// Promise constructor anti-pattern
|
|
166
|
+
{
|
|
167
|
+
regex: /new\s+Promise\s*\(\s*(?:async|[(]\s*(?:resolve|reject))/,
|
|
168
|
+
name: "Async executor in Promise",
|
|
169
|
+
severity: "medium",
|
|
170
|
+
modern: "Direct async function",
|
|
171
|
+
detail: "async function inside Promise executor is an anti-pattern — errors won't reject the promise",
|
|
172
|
+
},
|
|
173
|
+
// Old module patterns
|
|
174
|
+
{
|
|
175
|
+
regex: /module\.exports\s*=/,
|
|
176
|
+
name: "CommonJS module.exports",
|
|
177
|
+
severity: "low",
|
|
178
|
+
modern: "ES module export",
|
|
179
|
+
detail: "CommonJS is legacy in TypeScript — use ES module exports",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
regex: /exports\.\w+\s*=/,
|
|
183
|
+
name: "CommonJS exports.x",
|
|
184
|
+
severity: "low",
|
|
185
|
+
modern: "ES module named export",
|
|
186
|
+
detail: "CommonJS exports are legacy in TypeScript — use ES module named exports",
|
|
187
|
+
},
|
|
188
|
+
// Deprecated string methods
|
|
189
|
+
{
|
|
190
|
+
regex: /\.substr\s*\(/,
|
|
191
|
+
name: ".substr()",
|
|
192
|
+
severity: "low",
|
|
193
|
+
modern: ".substring() or .slice()",
|
|
194
|
+
detail: ".substr() is deprecated in favor of .substring() or .slice()",
|
|
195
|
+
},
|
|
196
|
+
// Old error handling
|
|
197
|
+
{
|
|
198
|
+
regex: /process\.on\s*\(\s*['"]uncaughtException['"]/,
|
|
199
|
+
name: "uncaughtException handler",
|
|
200
|
+
severity: "medium",
|
|
201
|
+
modern: "Structured error handling or process.on('unhandledRejection')",
|
|
202
|
+
detail: "Catching uncaughtException and continuing is dangerous — fix the root cause or exit",
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
// ─── Analysis ───────────────────────────────────────────────────────────────
|
|
206
|
+
function analyzeFile(filepath) {
|
|
207
|
+
const issues = [];
|
|
208
|
+
let content;
|
|
209
|
+
try {
|
|
210
|
+
content = readFileSync(filepath, "utf-8");
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return issues;
|
|
214
|
+
}
|
|
215
|
+
const lines = content.split("\n");
|
|
216
|
+
for (let i = 0; i < lines.length; i++) {
|
|
217
|
+
const line = lines[i];
|
|
218
|
+
// Skip comments
|
|
219
|
+
const trimmed = line.trim();
|
|
220
|
+
if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*"))
|
|
221
|
+
continue;
|
|
222
|
+
for (const pattern of STALE_PATTERNS) {
|
|
223
|
+
if (pattern.regex.test(line)) {
|
|
224
|
+
issues.push({
|
|
225
|
+
file: filepath,
|
|
226
|
+
line: i + 1,
|
|
227
|
+
pattern: pattern.name,
|
|
228
|
+
severity: pattern.severity,
|
|
229
|
+
detail: pattern.detail,
|
|
230
|
+
modernAlternative: pattern.modern,
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
return issues;
|
|
236
|
+
}
|
|
237
|
+
// ─── CLI ────────────────────────────────────────────────────────────────────
|
|
238
|
+
export function runStalePattern(argv) {
|
|
239
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
240
|
+
console.log(`
|
|
241
|
+
judges stale-pattern — Identify outdated idioms when modern alternatives exist
|
|
242
|
+
|
|
243
|
+
Usage:
|
|
244
|
+
judges stale-pattern [dir]
|
|
245
|
+
judges stale-pattern src/ --format json
|
|
246
|
+
|
|
247
|
+
Options:
|
|
248
|
+
[dir] Directory to scan (default: .)
|
|
249
|
+
--format json JSON output
|
|
250
|
+
--help, -h Show this help
|
|
251
|
+
|
|
252
|
+
Checks: deprecated Node APIs (new Buffer, url.parse, fs.exists), callback patterns,
|
|
253
|
+
var declarations, old testing patterns, React class components, Promise anti-patterns,
|
|
254
|
+
CommonJS modules, deprecated string methods, old error handling.
|
|
255
|
+
`);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const format = argv.find((_a, i) => argv[i - 1] === "--format") || "text";
|
|
259
|
+
const dir = argv.find((a) => !a.startsWith("-") && argv.indexOf(a) > 0) || ".";
|
|
260
|
+
const files = collectFiles(dir);
|
|
261
|
+
const allIssues = [];
|
|
262
|
+
for (const f of files)
|
|
263
|
+
allIssues.push(...analyzeFile(f));
|
|
264
|
+
const highCount = allIssues.filter((i) => i.severity === "high").length;
|
|
265
|
+
const medCount = allIssues.filter((i) => i.severity === "medium").length;
|
|
266
|
+
const score = Math.max(0, 100 - highCount * 10 - medCount * 5 - allIssues.filter((i) => i.severity === "low").length * 2);
|
|
267
|
+
if (format === "json") {
|
|
268
|
+
console.log(JSON.stringify({
|
|
269
|
+
issues: allIssues,
|
|
270
|
+
score,
|
|
271
|
+
summary: { high: highCount, medium: medCount, total: allIssues.length },
|
|
272
|
+
timestamp: new Date().toISOString(),
|
|
273
|
+
}, null, 2));
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
const badge = score >= 80 ? "✅ MODERN" : score >= 50 ? "⚠️ DATED" : "❌ STALE";
|
|
277
|
+
console.log(`\n Stale-Pattern: ${badge} (${score}/100)\n ─────────────────────────────`);
|
|
278
|
+
if (allIssues.length === 0) {
|
|
279
|
+
console.log(" No stale patterns detected.\n");
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
for (const issue of allIssues.slice(0, 25)) {
|
|
283
|
+
const icon = issue.severity === "high" ? "🔴" : issue.severity === "medium" ? "🟡" : "🔵";
|
|
284
|
+
console.log(` ${icon} ${issue.pattern}`);
|
|
285
|
+
console.log(` ${issue.file}:${issue.line}`);
|
|
286
|
+
console.log(` ${issue.detail}`);
|
|
287
|
+
console.log(` ↳ Use: ${issue.modernAlternative}`);
|
|
288
|
+
}
|
|
289
|
+
if (allIssues.length > 25)
|
|
290
|
+
console.log(` ... and ${allIssues.length - 25} more`);
|
|
291
|
+
console.log(`\n Total: ${allIssues.length} | High: ${highCount} | Medium: ${medCount} | Score: ${score}/100\n`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
//# sourceMappingURL=stale-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stale-pattern.js","s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AK,QAAQ,CAAC,CAAC;IACrH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"url": "https://github.com/kevinrabun/judges",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "3.
|
|
10
|
+
"version": "3.60.0",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "@kevinrabun/judges",
|
|
15
|
-
"version": "3.
|
|
15
|
+
"version": "3.60.0",
|
|
16
16
|
"transport": {
|
|
17
17
|
"type": "stdio"
|
|
18
18
|
}
|