slopbrick 0.26.0 → 0.27.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/dist/engine/worker.cjs +10 -745
- package/dist/engine/worker.js +10 -745
- package/dist/index.cjs +16 -851
- package/dist/index.js +16 -851
- package/package.json +1 -1
package/dist/engine/worker.js
CHANGED
|
@@ -36962,512 +36962,6 @@ var goStructTagInconsistencyRule = createRule({
|
|
|
36962
36962
|
}
|
|
36963
36963
|
});
|
|
36964
36964
|
|
|
36965
|
-
// src/rules/java/arraylist-vs-linkedlist.ts
|
|
36966
|
-
var NEW_LINKED_LIST_REGEX = /new\s+LinkedList\s*</g;
|
|
36967
|
-
var javaArraylistVsLinkedlistRule = createRule({
|
|
36968
|
-
id: "java/arraylist-vs-linkedlist",
|
|
36969
|
-
category: "typo",
|
|
36970
|
-
severity: "low",
|
|
36971
|
-
aiSpecific: true,
|
|
36972
|
-
description: "new LinkedList<>() \u2014 use ArrayList (Effective Java, Item 28)",
|
|
36973
|
-
create(_context) {
|
|
36974
|
-
return {};
|
|
36975
|
-
},
|
|
36976
|
-
analyze(_context, facts) {
|
|
36977
|
-
const issues = [];
|
|
36978
|
-
const source = facts.v2?._source;
|
|
36979
|
-
if (!source) return issues;
|
|
36980
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
36981
|
-
let m;
|
|
36982
|
-
NEW_LINKED_LIST_REGEX.lastIndex = 0;
|
|
36983
|
-
while ((m = NEW_LINKED_LIST_REGEX.exec(source)) !== null) {
|
|
36984
|
-
const line = source.slice(0, m.index).split("\n").length;
|
|
36985
|
-
issues.push({
|
|
36986
|
-
ruleId: "java/arraylist-vs-linkedlist",
|
|
36987
|
-
category: "typo",
|
|
36988
|
-
severity: "low",
|
|
36989
|
-
aiSpecific: true,
|
|
36990
|
-
message: `new LinkedList at line ${line} \u2014 use ArrayList instead`,
|
|
36991
|
-
line,
|
|
36992
|
-
column: 1,
|
|
36993
|
-
advice: "Replace `new LinkedList<>()` with `new ArrayList<>()`. LinkedList is rarely the right choice (worse cache locality, 5x more memory per element, O(n) indexed access). Joshua Bloch (Effective Java, Item 28) recommends ArrayList unless you specifically need a Deque. AI agents default to LinkedList because of textbook examples. Reference: java/arraylist-vs-linkedlist v0.20."
|
|
36994
|
-
});
|
|
36995
|
-
}
|
|
36996
|
-
return issues;
|
|
36997
|
-
}
|
|
36998
|
-
});
|
|
36999
|
-
|
|
37000
|
-
// src/rules/java/builder-overuse.ts
|
|
37001
|
-
var BUILDER_ANNOTATION_REGEX = /@Builder\b/;
|
|
37002
|
-
var FIELD_DECL_REGEX = /(?:private|public|protected)\s+(?:final\s+)?[\w<>,\s]+\s+(\w+)\s*[=;]/g;
|
|
37003
|
-
var DEFAULT_FIELD_COUNT_CAP = 3;
|
|
37004
|
-
var javaBuilderOveruseRule = createRule({
|
|
37005
|
-
id: "java/builder-overuse",
|
|
37006
|
-
category: "typo",
|
|
37007
|
-
severity: "low",
|
|
37008
|
-
aiSpecific: true,
|
|
37009
|
-
description: "@Builder on a class with few fields \u2014 plain constructor is simpler",
|
|
37010
|
-
create(_context) {
|
|
37011
|
-
return { fieldCountCap: DEFAULT_FIELD_COUNT_CAP };
|
|
37012
|
-
},
|
|
37013
|
-
analyze(context, facts) {
|
|
37014
|
-
const issues = [];
|
|
37015
|
-
const source = facts.v2?._source;
|
|
37016
|
-
if (!source) return issues;
|
|
37017
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37018
|
-
BUILDER_ANNOTATION_REGEX.lastIndex = 0;
|
|
37019
|
-
const builderMatch = BUILDER_ANNOTATION_REGEX.exec(source);
|
|
37020
|
-
if (!builderMatch) return issues;
|
|
37021
|
-
const firstBuilderLine = source.slice(0, builderMatch.index).split("\n").length;
|
|
37022
|
-
FIELD_DECL_REGEX.lastIndex = 0;
|
|
37023
|
-
let fieldCount = 0;
|
|
37024
|
-
while (FIELD_DECL_REGEX.exec(source) !== null) {
|
|
37025
|
-
fieldCount++;
|
|
37026
|
-
}
|
|
37027
|
-
if (fieldCount > context.fieldCountCap) return issues;
|
|
37028
|
-
issues.push({
|
|
37029
|
-
ruleId: "java/builder-overuse",
|
|
37030
|
-
category: "typo",
|
|
37031
|
-
severity: "low",
|
|
37032
|
-
aiSpecific: true,
|
|
37033
|
-
message: `@Builder on a class with ${fieldCount} field(s) \u2014 plain constructor is simpler`,
|
|
37034
|
-
line: firstBuilderLine,
|
|
37035
|
-
column: 1,
|
|
37036
|
-
advice: "Use a plain constructor for classes with \u2264 3 fields. AI agents default to @Builder because their training data emphasizes the pattern. Builder adds Lombok dependency and a Builder inner class for every annotated class. Reference: java/builder-overuse v0.26.0."
|
|
37037
|
-
});
|
|
37038
|
-
return issues;
|
|
37039
|
-
}
|
|
37040
|
-
});
|
|
37041
|
-
|
|
37042
|
-
// src/rules/java/empty-catch-block.ts
|
|
37043
|
-
var SINGLE_LINE_EMPTY_CATCH_REGEX = /catch\s*\([^)]*\)\s*\{\s*\}/g;
|
|
37044
|
-
var javaEmptyCatchBlockRule = createRule({
|
|
37045
|
-
id: "java/empty-catch-block",
|
|
37046
|
-
category: "logic",
|
|
37047
|
-
severity: "medium",
|
|
37048
|
-
aiSpecific: true,
|
|
37049
|
-
description: "Empty catch block \u2014 silently swallows exceptions",
|
|
37050
|
-
create(_context) {
|
|
37051
|
-
return {};
|
|
37052
|
-
},
|
|
37053
|
-
analyze(_context, facts) {
|
|
37054
|
-
const issues = [];
|
|
37055
|
-
const source = facts.v2?._source;
|
|
37056
|
-
if (!source) return issues;
|
|
37057
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37058
|
-
let m;
|
|
37059
|
-
SINGLE_LINE_EMPTY_CATCH_REGEX.lastIndex = 0;
|
|
37060
|
-
while ((m = SINGLE_LINE_EMPTY_CATCH_REGEX.exec(source)) !== null) {
|
|
37061
|
-
const line = source.slice(0, m.index).split("\n").length;
|
|
37062
|
-
issues.push({
|
|
37063
|
-
ruleId: "java/empty-catch-block",
|
|
37064
|
-
category: "logic",
|
|
37065
|
-
severity: "medium",
|
|
37066
|
-
aiSpecific: true,
|
|
37067
|
-
message: `Empty catch block at line ${line} \u2014 exception is silently swallowed`,
|
|
37068
|
-
line,
|
|
37069
|
-
column: 1,
|
|
37070
|
-
advice: 'Log the exception (`log.error("...", e)`), re-throw it, or both. Empty catch blocks hide bugs. The pattern is common in AI-generated code that wants to look defensive. Reference: java/empty-catch-block v0.20.'
|
|
37071
|
-
});
|
|
37072
|
-
}
|
|
37073
|
-
return issues;
|
|
37074
|
-
}
|
|
37075
|
-
});
|
|
37076
|
-
|
|
37077
|
-
// src/rules/java/immutable-collection-preference.ts
|
|
37078
|
-
var IMMUTABLE_REGEX = /\b(List|Map|Set)\.of\s*\(/g;
|
|
37079
|
-
var MUTABLE_REGEX = /new\s+(ArrayList|HashMap|HashSet|LinkedList|TreeMap)\s*[<(]/g;
|
|
37080
|
-
var DEFAULT_IMMUTABLE_THRESHOLD = 5;
|
|
37081
|
-
var DEFAULT_MUTABLE_CAP = 1;
|
|
37082
|
-
var javaImmutableCollectionPreferenceRule = createRule({
|
|
37083
|
-
id: "java/immutable-collection-preference",
|
|
37084
|
-
category: "typo",
|
|
37085
|
-
severity: "low",
|
|
37086
|
-
aiSpecific: true,
|
|
37087
|
-
description: "Immutable factory method over-use \u2014 prefer mutable when collection will be modified",
|
|
37088
|
-
create(_context) {
|
|
37089
|
-
return {
|
|
37090
|
-
immutableThreshold: DEFAULT_IMMUTABLE_THRESHOLD,
|
|
37091
|
-
mutableCap: DEFAULT_MUTABLE_CAP
|
|
37092
|
-
};
|
|
37093
|
-
},
|
|
37094
|
-
analyze(context, facts) {
|
|
37095
|
-
const issues = [];
|
|
37096
|
-
const source = facts.v2?._source;
|
|
37097
|
-
if (!source) return issues;
|
|
37098
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37099
|
-
IMMUTABLE_REGEX.lastIndex = 0;
|
|
37100
|
-
let immutableCount = 0;
|
|
37101
|
-
let firstIdx = 0;
|
|
37102
|
-
let m;
|
|
37103
|
-
while ((m = IMMUTABLE_REGEX.exec(source)) !== null) {
|
|
37104
|
-
immutableCount++;
|
|
37105
|
-
if (firstIdx === 0) firstIdx = m.index;
|
|
37106
|
-
}
|
|
37107
|
-
if (immutableCount < context.immutableThreshold) return issues;
|
|
37108
|
-
MUTABLE_REGEX.lastIndex = 0;
|
|
37109
|
-
let mutableCount = 0;
|
|
37110
|
-
while ((m = MUTABLE_REGEX.exec(source)) !== null) {
|
|
37111
|
-
mutableCount++;
|
|
37112
|
-
}
|
|
37113
|
-
if (mutableCount > context.mutableCap) return issues;
|
|
37114
|
-
const line = source.slice(0, firstIdx).split("\n").length;
|
|
37115
|
-
issues.push({
|
|
37116
|
-
ruleId: "java/immutable-collection-preference",
|
|
37117
|
-
category: "typo",
|
|
37118
|
-
severity: "low",
|
|
37119
|
-
aiSpecific: true,
|
|
37120
|
-
message: `${immutableCount} immutable factory calls (List/Map/Set.of) with only ${mutableCount} mutable collection \u2014 likely over-preferring immutability`,
|
|
37121
|
-
line,
|
|
37122
|
-
column: 1,
|
|
37123
|
-
advice: "Prefer mutable collections (new ArrayList<>()) when the collection will be modified later. AI agents default to List.of/Map.of/Set.of because their training data emphasizes functional-style Java. Reference: java/immutable-collection-preference v0.26.0."
|
|
37124
|
-
});
|
|
37125
|
-
return issues;
|
|
37126
|
-
}
|
|
37127
|
-
});
|
|
37128
|
-
|
|
37129
|
-
// src/rules/java/legacy-date-api.ts
|
|
37130
|
-
var LEGACY_IMPORT_REGEX = /^import\s+(?:static\s+)?java\.(?:util|sql)\.(?:Date|Calendar|GregorianCalendar)\s*;/gm;
|
|
37131
|
-
var LEGACY_USAGE_REGEX = /\bnew\s+(?:Date|GregorianCalendar)\s*\(/g;
|
|
37132
|
-
var CALENDAR_GET_INSTANCE_REGEX = /Calendar\.getInstance\s*\(/g;
|
|
37133
|
-
var javaLegacyDateApiRule = createRule({
|
|
37134
|
-
id: "java/legacy-date-api",
|
|
37135
|
-
category: "typo",
|
|
37136
|
-
severity: "low",
|
|
37137
|
-
aiSpecific: true,
|
|
37138
|
-
description: "Legacy java.util.Date / Calendar \u2014 use java.time (JSR-310) from Java 8+",
|
|
37139
|
-
create(_context) {
|
|
37140
|
-
return {};
|
|
37141
|
-
},
|
|
37142
|
-
analyze(_context, facts) {
|
|
37143
|
-
const issues = [];
|
|
37144
|
-
const source = facts.v2?._source;
|
|
37145
|
-
if (!source) return issues;
|
|
37146
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37147
|
-
const flagged = /* @__PURE__ */ new Set();
|
|
37148
|
-
let m;
|
|
37149
|
-
LEGACY_IMPORT_REGEX.lastIndex = 0;
|
|
37150
|
-
while ((m = LEGACY_IMPORT_REGEX.exec(source)) !== null) {
|
|
37151
|
-
const line = source.slice(0, m.index).split("\n").length;
|
|
37152
|
-
flagged.add(line);
|
|
37153
|
-
issues.push({
|
|
37154
|
-
ruleId: "java/legacy-date-api",
|
|
37155
|
-
category: "typo",
|
|
37156
|
-
severity: "low",
|
|
37157
|
-
aiSpecific: true,
|
|
37158
|
-
message: `Legacy date import at line ${line} \u2014 use java.time (JSR-310) from Java 8+`,
|
|
37159
|
-
line,
|
|
37160
|
-
column: 1,
|
|
37161
|
-
advice: "Replace `java.util.Date` / `java.util.Calendar` with `java.time` (`LocalDate`, `LocalDateTime`, `Instant`, `ZonedDateTime`). java.time is immutable, thread-safe, and has a much better API. AI agents default to the legacy API because their training data predates Java 8 (2014). Reference: java/legacy-date-api v0.20."
|
|
37162
|
-
});
|
|
37163
|
-
}
|
|
37164
|
-
LEGACY_USAGE_REGEX.lastIndex = 0;
|
|
37165
|
-
while ((m = LEGACY_USAGE_REGEX.exec(source)) !== null) {
|
|
37166
|
-
const line = source.slice(0, m.index).split("\n").length;
|
|
37167
|
-
if (flagged.has(line)) continue;
|
|
37168
|
-
issues.push({
|
|
37169
|
-
ruleId: "java/legacy-date-api",
|
|
37170
|
-
category: "typo",
|
|
37171
|
-
severity: "low",
|
|
37172
|
-
aiSpecific: true,
|
|
37173
|
-
message: `new Date() / GregorianCalendar at line ${line} \u2014 use java.time`,
|
|
37174
|
-
line,
|
|
37175
|
-
column: 1,
|
|
37176
|
-
advice: "Replace with `LocalDate.now()`, `Instant.now()`, or `ZonedDateTime.now()`. Reference: java/legacy-date-api v0.20."
|
|
37177
|
-
});
|
|
37178
|
-
}
|
|
37179
|
-
CALENDAR_GET_INSTANCE_REGEX.lastIndex = 0;
|
|
37180
|
-
while ((m = CALENDAR_GET_INSTANCE_REGEX.exec(source)) !== null) {
|
|
37181
|
-
const line = source.slice(0, m.index).split("\n").length;
|
|
37182
|
-
if (flagged.has(line)) continue;
|
|
37183
|
-
issues.push({
|
|
37184
|
-
ruleId: "java/legacy-date-api",
|
|
37185
|
-
category: "typo",
|
|
37186
|
-
severity: "low",
|
|
37187
|
-
aiSpecific: true,
|
|
37188
|
-
message: `Calendar.getInstance() at line ${line} \u2014 use java.time`,
|
|
37189
|
-
line,
|
|
37190
|
-
column: 1,
|
|
37191
|
-
advice: "Replace with `LocalDate.now()` (date-only) or `ZonedDateTime.now()`. Reference: java/legacy-date-api v0.20."
|
|
37192
|
-
});
|
|
37193
|
-
}
|
|
37194
|
-
return issues;
|
|
37195
|
-
}
|
|
37196
|
-
});
|
|
37197
|
-
|
|
37198
|
-
// src/rules/java/optional-overuse.ts
|
|
37199
|
-
var OR_ELSE_THROW_REGEX = /\.orElseThrow\s*\(/g;
|
|
37200
|
-
var NULL_CHECK_REGEX = /Objects\.requireNonNull\s*\(|if\s*\([^)]*==\s*null\)\s*(?:throw|return)/g;
|
|
37201
|
-
var DEFAULT_THRESHOLD = 2;
|
|
37202
|
-
var javaOptionalOveruseRule = createRule({
|
|
37203
|
-
id: "java/optional-overuse",
|
|
37204
|
-
category: "typo",
|
|
37205
|
-
severity: "low",
|
|
37206
|
-
aiSpecific: true,
|
|
37207
|
-
description: "Optional chain over-use \u2014 null check or Objects.requireNonNull is faster",
|
|
37208
|
-
create(_context) {
|
|
37209
|
-
return { threshold: DEFAULT_THRESHOLD };
|
|
37210
|
-
},
|
|
37211
|
-
analyze(context, facts) {
|
|
37212
|
-
const issues = [];
|
|
37213
|
-
const source = facts.v2?._source;
|
|
37214
|
-
if (!source) return issues;
|
|
37215
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37216
|
-
OR_ELSE_THROW_REGEX.lastIndex = 0;
|
|
37217
|
-
let orElseThrowCount = 0;
|
|
37218
|
-
let firstIdx = 0;
|
|
37219
|
-
let m;
|
|
37220
|
-
while ((m = OR_ELSE_THROW_REGEX.exec(source)) !== null) {
|
|
37221
|
-
orElseThrowCount++;
|
|
37222
|
-
if (firstIdx === 0) firstIdx = m.index;
|
|
37223
|
-
}
|
|
37224
|
-
if (orElseThrowCount < context.threshold) return issues;
|
|
37225
|
-
NULL_CHECK_REGEX.lastIndex = 0;
|
|
37226
|
-
const nullCheckCount = (source.match(NULL_CHECK_REGEX) ?? []).length;
|
|
37227
|
-
const optionalRatio = orElseThrowCount / Math.max(orElseThrowCount + nullCheckCount, 1);
|
|
37228
|
-
if (optionalRatio < 0.6) return issues;
|
|
37229
|
-
const line = source.slice(0, firstIdx).split("\n").length;
|
|
37230
|
-
issues.push({
|
|
37231
|
-
ruleId: "java/optional-overuse",
|
|
37232
|
-
category: "typo",
|
|
37233
|
-
severity: "low",
|
|
37234
|
-
aiSpecific: true,
|
|
37235
|
-
message: `${orElseThrowCount} .orElseThrow() calls with ${nullCheckCount} null checks \u2014 Optional chain over-use`,
|
|
37236
|
-
line,
|
|
37237
|
-
column: 1,
|
|
37238
|
-
advice: 'Use Objects.requireNonNull(x, "msg") for null checks; reserve Optional for return values. AI agents default to Optional chains because their training data emphasizes null-safety. Real Java code uses null checks in hot paths. Reference: java/optional-overuse v0.26.0.'
|
|
37239
|
-
});
|
|
37240
|
-
return issues;
|
|
37241
|
-
}
|
|
37242
|
-
});
|
|
37243
|
-
|
|
37244
|
-
// src/rules/java/raw-type-overuse.ts
|
|
37245
|
-
var RAW_TYPE_REGEX = /\b(List|Map|Set|Collection|Iterable)\s+(?![<A-Z])(\w+)/g;
|
|
37246
|
-
var javaRawTypeOveruseRule = createRule({
|
|
37247
|
-
id: "java/raw-type-overuse",
|
|
37248
|
-
category: "typo",
|
|
37249
|
-
severity: "low",
|
|
37250
|
-
aiSpecific: true,
|
|
37251
|
-
description: "Raw type usage (List, Map, Set) \u2014 use generics (Effective Java, Item 23)",
|
|
37252
|
-
create(_context) {
|
|
37253
|
-
return {};
|
|
37254
|
-
},
|
|
37255
|
-
analyze(_context, facts) {
|
|
37256
|
-
const issues = [];
|
|
37257
|
-
const source = facts.v2?._source;
|
|
37258
|
-
if (!source) return issues;
|
|
37259
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37260
|
-
let m;
|
|
37261
|
-
RAW_TYPE_REGEX.lastIndex = 0;
|
|
37262
|
-
while ((m = RAW_TYPE_REGEX.exec(source)) !== null) {
|
|
37263
|
-
const typeName = m[1];
|
|
37264
|
-
const line = source.slice(0, m.index).split("\n").length;
|
|
37265
|
-
issues.push({
|
|
37266
|
-
ruleId: "java/raw-type-overuse",
|
|
37267
|
-
category: "typo",
|
|
37268
|
-
severity: "low",
|
|
37269
|
-
aiSpecific: true,
|
|
37270
|
-
message: `Raw type ${typeName} at line ${line} \u2014 add type parameters`,
|
|
37271
|
-
line,
|
|
37272
|
-
column: 1,
|
|
37273
|
-
advice: `Replace raw \`${typeName}\` with \`${typeName}<...>\`. Raw types disable generic type checking. Effective Java, Item 23: 'Don't use raw types in new code'. AI agents default to raw types when unsure of the correct generic parameters. Reference: java/raw-type-overuse v0.20.`
|
|
37274
|
-
});
|
|
37275
|
-
}
|
|
37276
|
-
return issues;
|
|
37277
|
-
}
|
|
37278
|
-
});
|
|
37279
|
-
|
|
37280
|
-
// src/rules/java/stream-overuse.ts
|
|
37281
|
-
var STREAM_OPS = [
|
|
37282
|
-
".map(",
|
|
37283
|
-
".filter(",
|
|
37284
|
-
".flatMap(",
|
|
37285
|
-
".collect(",
|
|
37286
|
-
".reduce(",
|
|
37287
|
-
".sorted(",
|
|
37288
|
-
".distinct(",
|
|
37289
|
-
".limit(",
|
|
37290
|
-
".skip(",
|
|
37291
|
-
".anyMatch(",
|
|
37292
|
-
".allMatch(",
|
|
37293
|
-
".noneMatch(",
|
|
37294
|
-
".findFirst(",
|
|
37295
|
-
".findAny("
|
|
37296
|
-
];
|
|
37297
|
-
var DEFAULT_CHAIN_THRESHOLD = 3;
|
|
37298
|
-
var javaStreamOveruseRule = createRule({
|
|
37299
|
-
id: "java/stream-overuse",
|
|
37300
|
-
category: "typo",
|
|
37301
|
-
severity: "low",
|
|
37302
|
-
aiSpecific: true,
|
|
37303
|
-
description: "Stream API chain over-use \u2014 for-loop is faster for simple transformations",
|
|
37304
|
-
create(_context) {
|
|
37305
|
-
return { chainThreshold: DEFAULT_CHAIN_THRESHOLD };
|
|
37306
|
-
},
|
|
37307
|
-
analyze(context, facts) {
|
|
37308
|
-
const issues = [];
|
|
37309
|
-
const source = facts.v2?._source;
|
|
37310
|
-
if (!source) return issues;
|
|
37311
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37312
|
-
const lines = source.split("\n");
|
|
37313
|
-
const streamOpPattern = new RegExp(STREAM_OPS.map((op) => op.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), "g");
|
|
37314
|
-
let firstOffendingLine = 0;
|
|
37315
|
-
let firstOffendingCount = 0;
|
|
37316
|
-
for (let i = 0; i < lines.length; i++) {
|
|
37317
|
-
const line = lines[i] ?? "";
|
|
37318
|
-
if (line.trim().startsWith("//") || line.trim().startsWith("*")) continue;
|
|
37319
|
-
const matches = line.match(streamOpPattern);
|
|
37320
|
-
if (matches && matches.length >= context.chainThreshold) {
|
|
37321
|
-
if (firstOffendingLine === 0) {
|
|
37322
|
-
firstOffendingLine = i + 1;
|
|
37323
|
-
firstOffendingCount = matches.length;
|
|
37324
|
-
}
|
|
37325
|
-
}
|
|
37326
|
-
}
|
|
37327
|
-
if (firstOffendingLine === 0) return issues;
|
|
37328
|
-
issues.push({
|
|
37329
|
-
ruleId: "java/stream-overuse",
|
|
37330
|
-
category: "typo",
|
|
37331
|
-
severity: "low",
|
|
37332
|
-
aiSpecific: true,
|
|
37333
|
-
message: `${firstOffendingCount} stream operations on a single line \u2014 for-loop is faster`,
|
|
37334
|
-
line: firstOffendingLine,
|
|
37335
|
-
column: 1,
|
|
37336
|
-
advice: "Prefer a for-loop for simple transformations. AI agents default to Stream API chains because their training data emphasizes functional-style Java. Stream chains allocate intermediate objects; for small collections, a for-loop is faster and more readable. Reference: java/stream-overuse v0.26.0."
|
|
37337
|
-
});
|
|
37338
|
-
return issues;
|
|
37339
|
-
}
|
|
37340
|
-
});
|
|
37341
|
-
|
|
37342
|
-
// src/rules/java/string-concat-loop.ts
|
|
37343
|
-
var STRING_CONCAT_REGEX = /(\b\w+)\s*=\s*\1\s*\+\s*[^;]+;|(\b\w+)\s*\+=\s*['"`]/g;
|
|
37344
|
-
var javaStringConcatLoopRule = createRule({
|
|
37345
|
-
id: "java/string-concat-loop",
|
|
37346
|
-
category: "perf",
|
|
37347
|
-
severity: "low",
|
|
37348
|
-
aiSpecific: true,
|
|
37349
|
-
description: "String concatenation in a loop \u2014 use StringBuilder",
|
|
37350
|
-
create(_context) {
|
|
37351
|
-
return {};
|
|
37352
|
-
},
|
|
37353
|
-
analyze(_context, facts) {
|
|
37354
|
-
const issues = [];
|
|
37355
|
-
const source = facts.v2?._source;
|
|
37356
|
-
if (!source) return issues;
|
|
37357
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37358
|
-
if (!/\b(for|while|do)\b/.test(source)) return issues;
|
|
37359
|
-
let m;
|
|
37360
|
-
STRING_CONCAT_REGEX.lastIndex = 0;
|
|
37361
|
-
while ((m = STRING_CONCAT_REGEX.exec(source)) !== null) {
|
|
37362
|
-
const line = source.slice(0, m.index).split("\n").length;
|
|
37363
|
-
issues.push({
|
|
37364
|
-
ruleId: "java/string-concat-loop",
|
|
37365
|
-
category: "perf",
|
|
37366
|
-
severity: "low",
|
|
37367
|
-
aiSpecific: true,
|
|
37368
|
-
message: `String concatenation in a loop at line ${line} \u2014 use StringBuilder`,
|
|
37369
|
-
line,
|
|
37370
|
-
column: 1,
|
|
37371
|
-
advice: "Declare a `StringBuilder` outside the loop: `StringBuilder sb = new StringBuilder(); sb.append(...);` then `return sb.toString();` after the loop. String concatenation in a loop is O(n\xB2) \u2014 each iteration copies the prior string. AI agents concatenate strings in loops because of training-data examples. Reference: java/string-concat-loop v0.20."
|
|
37372
|
-
});
|
|
37373
|
-
}
|
|
37374
|
-
return issues;
|
|
37375
|
-
}
|
|
37376
|
-
});
|
|
37377
|
-
|
|
37378
|
-
// src/rules/java/system-out-println.ts
|
|
37379
|
-
var PRINTLN_REGEX = /System\.out\.println\s*\(/g;
|
|
37380
|
-
var DEFAULT_THRESHOLD2 = 1;
|
|
37381
|
-
var javaSystemOutPrintlnRule = createRule({
|
|
37382
|
-
id: "java/system-out-println",
|
|
37383
|
-
category: "typo",
|
|
37384
|
-
severity: "low",
|
|
37385
|
-
aiSpecific: true,
|
|
37386
|
-
description: "System.out.println in production code \u2014 use a logger (SLF4J, Log4j, etc.)",
|
|
37387
|
-
create(_context) {
|
|
37388
|
-
return { threshold: DEFAULT_THRESHOLD2 };
|
|
37389
|
-
},
|
|
37390
|
-
analyze(context, facts) {
|
|
37391
|
-
const issues = [];
|
|
37392
|
-
const source = facts.v2?._source;
|
|
37393
|
-
if (!source) return issues;
|
|
37394
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37395
|
-
const matches = [];
|
|
37396
|
-
let m;
|
|
37397
|
-
PRINTLN_REGEX.lastIndex = 0;
|
|
37398
|
-
while ((m = PRINTLN_REGEX.exec(source)) !== null) {
|
|
37399
|
-
matches.push(m.index);
|
|
37400
|
-
}
|
|
37401
|
-
if (matches.length <= context.threshold) return issues;
|
|
37402
|
-
const cap = Math.min(matches.length, 10);
|
|
37403
|
-
for (let i = 0; i < cap; i++) {
|
|
37404
|
-
const idx = matches[i];
|
|
37405
|
-
const line = source.slice(0, idx).split("\n").length;
|
|
37406
|
-
issues.push({
|
|
37407
|
-
ruleId: "java/system-out-println",
|
|
37408
|
-
category: "typo",
|
|
37409
|
-
severity: "low",
|
|
37410
|
-
aiSpecific: true,
|
|
37411
|
-
message: `System.out.println at line ${line} \u2014 use a logger for production output`,
|
|
37412
|
-
line,
|
|
37413
|
-
column: 1,
|
|
37414
|
-
advice: "Replace with `private static final Logger log = LoggerFactory.getLogger(...);` then `log.info(...)`. AI agents default to println because their training data has countless textbook examples. Real Java code uses a logger. Reference: java/system-out-println v0.20."
|
|
37415
|
-
});
|
|
37416
|
-
}
|
|
37417
|
-
return issues;
|
|
37418
|
-
}
|
|
37419
|
-
});
|
|
37420
|
-
|
|
37421
|
-
// src/rules/java/verbose-javadoc.ts
|
|
37422
|
-
var TAG_REGEX = /@(param|return|throws)\b/g;
|
|
37423
|
-
var DEFAULT_TAG_THRESHOLD = 3;
|
|
37424
|
-
var DEFAULT_BODY_LENGTH_CAP = 5;
|
|
37425
|
-
var javaVerboseJavadocRule = createRule({
|
|
37426
|
-
id: "java/verbose-javadoc",
|
|
37427
|
-
category: "typo",
|
|
37428
|
-
severity: "low",
|
|
37429
|
-
aiSpecific: true,
|
|
37430
|
-
description: "Excessive Javadoc tags on trivial methods \u2014 over-documentation is an AI fingerprint",
|
|
37431
|
-
create(_context) {
|
|
37432
|
-
return {
|
|
37433
|
-
tagThreshold: DEFAULT_TAG_THRESHOLD,
|
|
37434
|
-
bodyLengthCap: DEFAULT_BODY_LENGTH_CAP
|
|
37435
|
-
};
|
|
37436
|
-
},
|
|
37437
|
-
analyze(context, facts) {
|
|
37438
|
-
const issues = [];
|
|
37439
|
-
const source = facts.v2?._source;
|
|
37440
|
-
if (!source) return issues;
|
|
37441
|
-
if (!/\.java$/i.test(facts.filePath)) return issues;
|
|
37442
|
-
TAG_REGEX.lastIndex = 0;
|
|
37443
|
-
let tagCount = 0;
|
|
37444
|
-
let firstTagLine = 0;
|
|
37445
|
-
let m;
|
|
37446
|
-
while ((m = TAG_REGEX.exec(source)) !== null) {
|
|
37447
|
-
tagCount++;
|
|
37448
|
-
if (firstTagLine === 0) {
|
|
37449
|
-
firstTagLine = source.slice(0, m.index).split("\n").length;
|
|
37450
|
-
}
|
|
37451
|
-
}
|
|
37452
|
-
if (tagCount < context.tagThreshold) return issues;
|
|
37453
|
-
const lineCount = source.split("\n").length;
|
|
37454
|
-
const tagDensity = tagCount / Math.max(lineCount, 1);
|
|
37455
|
-
if (tagDensity < 0.05) return issues;
|
|
37456
|
-
if (lineCount > 200) return issues;
|
|
37457
|
-
issues.push({
|
|
37458
|
-
ruleId: "java/verbose-javadoc",
|
|
37459
|
-
category: "typo",
|
|
37460
|
-
severity: "low",
|
|
37461
|
-
aiSpecific: true,
|
|
37462
|
-
message: `${tagCount} Javadoc tags in ${lineCount} lines (density ${(tagDensity * 100).toFixed(1)}%) \u2014 likely over-documented`,
|
|
37463
|
-
line: firstTagLine,
|
|
37464
|
-
column: 1,
|
|
37465
|
-
advice: "Skip Javadoc on trivial methods (getters, setters, builders). AI agents default to over-documentation because their training data has countless textbook Javadoc examples. Real Java code limits Javadoc to public API surface. Reference: java/verbose-javadoc v0.26.0."
|
|
37466
|
-
});
|
|
37467
|
-
return issues;
|
|
37468
|
-
}
|
|
37469
|
-
});
|
|
37470
|
-
|
|
37471
36965
|
// src/rules/kotlin/coroutine-global-scope.ts
|
|
37472
36966
|
var GLOBAL_SCOPE_REGEX = /GlobalScope\s*\.\s*(?:launch|async|runBlocking)\s*[({]/g;
|
|
37473
36967
|
var kotlinCoroutineGlobalScopeRule = createRule({
|
|
@@ -37611,8 +37105,8 @@ var kotlinObjectSingletonMisuseRule = createRule({
|
|
|
37611
37105
|
});
|
|
37612
37106
|
|
|
37613
37107
|
// src/rules/kotlin/println-debug.ts
|
|
37614
|
-
var
|
|
37615
|
-
var
|
|
37108
|
+
var PRINTLN_REGEX = /^\s*println\s*\(/gm;
|
|
37109
|
+
var DEFAULT_THRESHOLD = 1;
|
|
37616
37110
|
var kotlinPrintlnDebugRule = createRule({
|
|
37617
37111
|
id: "kotlin/println-debug",
|
|
37618
37112
|
category: "typo",
|
|
@@ -37620,7 +37114,7 @@ var kotlinPrintlnDebugRule = createRule({
|
|
|
37620
37114
|
aiSpecific: true,
|
|
37621
37115
|
description: "println(...) in production code \u2014 use Timber, android.util.Log, or an SLF4J facade",
|
|
37622
37116
|
create(_context) {
|
|
37623
|
-
return { threshold:
|
|
37117
|
+
return { threshold: DEFAULT_THRESHOLD };
|
|
37624
37118
|
},
|
|
37625
37119
|
analyze(context, facts) {
|
|
37626
37120
|
const issues = [];
|
|
@@ -37629,8 +37123,8 @@ var kotlinPrintlnDebugRule = createRule({
|
|
|
37629
37123
|
if (!/\.kt$/i.test(facts.filePath)) return issues;
|
|
37630
37124
|
const matches = [];
|
|
37631
37125
|
let m;
|
|
37632
|
-
|
|
37633
|
-
while ((m =
|
|
37126
|
+
PRINTLN_REGEX.lastIndex = 0;
|
|
37127
|
+
while ((m = PRINTLN_REGEX.exec(source)) !== null) {
|
|
37634
37128
|
matches.push(m.index);
|
|
37635
37129
|
}
|
|
37636
37130
|
if (matches.length <= context.threshold) return issues;
|
|
@@ -37654,7 +37148,7 @@ var kotlinPrintlnDebugRule = createRule({
|
|
|
37654
37148
|
});
|
|
37655
37149
|
|
|
37656
37150
|
// src/rules/kotlin/string-concat-loop.ts
|
|
37657
|
-
var
|
|
37151
|
+
var STRING_CONCAT_REGEX = /\b(\w+)\s*=\s*\1\s*\+\s*[^;}]+[;}\n]/g;
|
|
37658
37152
|
var kotlinStringConcatLoopRule = createRule({
|
|
37659
37153
|
id: "kotlin/string-concat-loop",
|
|
37660
37154
|
category: "perf",
|
|
@@ -37671,8 +37165,8 @@ var kotlinStringConcatLoopRule = createRule({
|
|
|
37671
37165
|
if (!/\.kt$/i.test(facts.filePath)) return issues;
|
|
37672
37166
|
if (!/\b(?:for|while|repeat|forEach)\b/.test(source)) return issues;
|
|
37673
37167
|
let m;
|
|
37674
|
-
|
|
37675
|
-
while ((m =
|
|
37168
|
+
STRING_CONCAT_REGEX.lastIndex = 0;
|
|
37169
|
+
while ((m = STRING_CONCAT_REGEX.exec(source)) !== null) {
|
|
37676
37170
|
const line = source.slice(0, m.index).split("\n").length;
|
|
37677
37171
|
const lineText = source.slice(0, m.index).split("\n").pop() ?? "";
|
|
37678
37172
|
if (/\.append\s*\(/.test(lineText)) continue;
|
|
@@ -40550,7 +40044,7 @@ var swiftImplicitlyUnwrappedOptionalRule = createRule({
|
|
|
40550
40044
|
|
|
40551
40045
|
// src/rules/swift/print-debug.ts
|
|
40552
40046
|
var PRINT_REGEX = /\bprint\s*\(/g;
|
|
40553
|
-
var
|
|
40047
|
+
var DEFAULT_THRESHOLD2 = 1;
|
|
40554
40048
|
var swiftPrintDebugRule = createRule({
|
|
40555
40049
|
id: "swift/print-debug",
|
|
40556
40050
|
category: "typo",
|
|
@@ -40558,7 +40052,7 @@ var swiftPrintDebugRule = createRule({
|
|
|
40558
40052
|
aiSpecific: true,
|
|
40559
40053
|
description: "print(...) in production Swift \u2014 use Logger (os.log) for level-controlled output",
|
|
40560
40054
|
create(_context) {
|
|
40561
|
-
return { threshold:
|
|
40055
|
+
return { threshold: DEFAULT_THRESHOLD2 };
|
|
40562
40056
|
},
|
|
40563
40057
|
analyze(context, facts) {
|
|
40564
40058
|
const issues = [];
|
|
@@ -43213,17 +42707,6 @@ var builtinRules = [
|
|
|
43213
42707
|
goErrorWrapWithoutContextRule,
|
|
43214
42708
|
goNilSliceVsEmptyRule,
|
|
43215
42709
|
goStructTagInconsistencyRule,
|
|
43216
|
-
javaArraylistVsLinkedlistRule,
|
|
43217
|
-
javaBuilderOveruseRule,
|
|
43218
|
-
javaEmptyCatchBlockRule,
|
|
43219
|
-
javaImmutableCollectionPreferenceRule,
|
|
43220
|
-
javaLegacyDateApiRule,
|
|
43221
|
-
javaOptionalOveruseRule,
|
|
43222
|
-
javaRawTypeOveruseRule,
|
|
43223
|
-
javaStreamOveruseRule,
|
|
43224
|
-
javaStringConcatLoopRule,
|
|
43225
|
-
javaSystemOutPrintlnRule,
|
|
43226
|
-
javaVerboseJavadocRule,
|
|
43227
42710
|
kotlinCoroutineGlobalScopeRule,
|
|
43228
42711
|
kotlinDataClassDefaultsOveruseRule,
|
|
43229
42712
|
kotlinObjectSingletonMisuseRule,
|
|
@@ -44088,224 +43571,6 @@ var signal_strength_default = {
|
|
|
44088
43571
|
_v8Lift: 1,
|
|
44089
43572
|
defaultOff: true
|
|
44090
43573
|
},
|
|
44091
|
-
"java/arraylist-vs-linkedlist": {
|
|
44092
|
-
recall: 35e-4,
|
|
44093
|
-
fpRate: 94e-4,
|
|
44094
|
-
ratio: 0.37,
|
|
44095
|
-
precision: 0.0446,
|
|
44096
|
-
lastCalibratedAt: "2026-07-02T19:34:00Z",
|
|
44097
|
-
verdict: "DORMANT",
|
|
44098
|
-
_calibrationNote: "v9 Java corpus calibration (v0.25.0, 2026-07-02): 81891 neg + 10305 pos Java files = 92196 total. v9 TP=36, FP=771, P=4.46%, FPR=0.94%, recall=0.35%, ratio=0.37, lift=P/FPR=4.74. Rule fires more on legacy enterprise Java (neg) than on AI/ML-integration Java (pos) because modern Java idiom defaults to ArrayList. v0.20: new rule (new LinkedList<>() \u2014 use ArrayList, Effective Java Item 28).",
|
|
44099
|
-
aiSpecific: true,
|
|
44100
|
-
_v7Verdict: "DORMANT",
|
|
44101
|
-
_v7Lift: 1,
|
|
44102
|
-
_v7Recall: 0,
|
|
44103
|
-
_v7FpRate: 0,
|
|
44104
|
-
_v7Precision: 0,
|
|
44105
|
-
_v8Verdict: "DORMANT",
|
|
44106
|
-
_v8Lift: 1,
|
|
44107
|
-
_v9Verdict: "DORMANT",
|
|
44108
|
-
_v9Lift: 4.74,
|
|
44109
|
-
_v9Recall: 35e-4,
|
|
44110
|
-
_v9FpRate: 94e-4,
|
|
44111
|
-
_v9Precision: 0.0446,
|
|
44112
|
-
defaultOff: true
|
|
44113
|
-
},
|
|
44114
|
-
"java/empty-catch-block": {
|
|
44115
|
-
recall: 8e-3,
|
|
44116
|
-
fpRate: 0.1118,
|
|
44117
|
-
ratio: 0.07,
|
|
44118
|
-
precision: 89e-4,
|
|
44119
|
-
lastCalibratedAt: "2026-07-02T19:34:00Z",
|
|
44120
|
-
verdict: "DORMANT",
|
|
44121
|
-
_calibrationNote: "v9 Java corpus calibration (v0.25.0, 2026-07-02): 81891 neg + 10305 pos Java files. v9 TP=82, FP=9159, P=0.89%, FPR=11.18%, recall=0.80%, ratio=0.07, lift=P/FPR=0.08. Strongly INVERTED: empty catch blocks are 14x more common in legacy enterprise Java than in AI/Java-modern pos repos. Heuristic likely needs to be tightened (e.g., require at least a comment) before it can serve as a meaningful discriminator. v0.20: new rule.",
|
|
44122
|
-
aiSpecific: true,
|
|
44123
|
-
_v7Verdict: "DORMANT",
|
|
44124
|
-
_v7Lift: 1,
|
|
44125
|
-
_v7Recall: 0,
|
|
44126
|
-
_v7FpRate: 0,
|
|
44127
|
-
_v7Precision: 0,
|
|
44128
|
-
_v8Verdict: "DORMANT",
|
|
44129
|
-
_v8Lift: 1,
|
|
44130
|
-
_v9Verdict: "DORMANT",
|
|
44131
|
-
_v9Lift: 0.08,
|
|
44132
|
-
_v9Recall: 8e-3,
|
|
44133
|
-
_v9FpRate: 0.1118,
|
|
44134
|
-
_v9Precision: 89e-4,
|
|
44135
|
-
defaultOff: true
|
|
44136
|
-
},
|
|
44137
|
-
"java/legacy-date-api": {
|
|
44138
|
-
recall: 0.0285,
|
|
44139
|
-
fpRate: 0.0511,
|
|
44140
|
-
ratio: 0.56,
|
|
44141
|
-
precision: 0.0657,
|
|
44142
|
-
lastCalibratedAt: "2026-07-02T19:34:00Z",
|
|
44143
|
-
verdict: "DORMANT",
|
|
44144
|
-
_calibrationNote: "v9 Java corpus calibration (v0.25.0, 2026-07-02): 81891 neg + 10305 pos Java files. v9 TP=294, FP=4181, P=6.57%, FPR=5.11%, recall=2.85%, ratio=0.56, lift=P/FPR=1.29. INVERTED-to-NOISY: legacy date API is more common in older enterprise Java (neg) than in modern AI/Java repos (pos). The heuristic correctly flags the legacy pattern, but the legacy pattern is over-represented in the neg baseline (older codebases). v0.20: new rule.",
|
|
44145
|
-
aiSpecific: true,
|
|
44146
|
-
_v7Verdict: "DORMANT",
|
|
44147
|
-
_v7Lift: 1,
|
|
44148
|
-
_v7Recall: 0,
|
|
44149
|
-
_v7FpRate: 0,
|
|
44150
|
-
_v7Precision: 0,
|
|
44151
|
-
_v8Verdict: "DORMANT",
|
|
44152
|
-
_v8Lift: 1,
|
|
44153
|
-
_v9Verdict: "DORMANT",
|
|
44154
|
-
_v9Lift: 1.29,
|
|
44155
|
-
_v9Recall: 0.0285,
|
|
44156
|
-
_v9FpRate: 0.0511,
|
|
44157
|
-
_v9Precision: 0.0657,
|
|
44158
|
-
defaultOff: true
|
|
44159
|
-
},
|
|
44160
|
-
"java/verbose-javadoc": {
|
|
44161
|
-
recall: 0,
|
|
44162
|
-
fpRate: 0,
|
|
44163
|
-
ratio: 1,
|
|
44164
|
-
precision: 0,
|
|
44165
|
-
lastCalibratedAt: "2026-07-03T00:00:00Z",
|
|
44166
|
-
verdict: "DORMANT",
|
|
44167
|
-
_calibrationNote: "v0.26.0: new positive AI-signal rule. Triggers when a small Java file (< 200 lines) has 3+ Javadoc tags with density >= 0.05. Calibration pending v9 Java corpus re-run; placeholder values until then. v0.20.0: anti-pattern design was wrong (humans write more Javadoc on trivial methods because their training data has it). v0.26.0: redesigned as positive signal (AI over-documents trivial methods). Reference: java/verbose-javadoc v0.26.0.",
|
|
44168
|
-
aiSpecific: true,
|
|
44169
|
-
_v9Verdict: "DORMANT",
|
|
44170
|
-
_v9Lift: 1,
|
|
44171
|
-
_v9Recall: 0,
|
|
44172
|
-
_v9FpRate: 0,
|
|
44173
|
-
_v9Precision: 0,
|
|
44174
|
-
defaultOff: true
|
|
44175
|
-
},
|
|
44176
|
-
"java/optional-overuse": {
|
|
44177
|
-
recall: 0,
|
|
44178
|
-
fpRate: 0,
|
|
44179
|
-
ratio: 1,
|
|
44180
|
-
precision: 0,
|
|
44181
|
-
lastCalibratedAt: "2026-07-03T00:00:00Z",
|
|
44182
|
-
verdict: "DORMANT",
|
|
44183
|
-
_calibrationNote: "v0.26.0: new positive AI-signal rule. Triggers when a Java file has 2+ .orElseThrow() calls AND 0 Objects.requireNonNull()/null checks (optionalRatio > 0.6). Calibration pending v9 Java corpus re-run; placeholder values until then. v0.26.0: redesigned as positive signal (AI chains Optional.ofNullable().orElseThrow() where null checks would be cleaner). Reference: java/optional-overuse v0.26.0.",
|
|
44184
|
-
aiSpecific: true,
|
|
44185
|
-
_v9Verdict: "DORMANT",
|
|
44186
|
-
_v9Lift: 1,
|
|
44187
|
-
_v9Recall: 0,
|
|
44188
|
-
_v9FpRate: 0,
|
|
44189
|
-
_v9Precision: 0,
|
|
44190
|
-
defaultOff: true
|
|
44191
|
-
},
|
|
44192
|
-
"java/immutable-collection-preference": {
|
|
44193
|
-
recall: 0,
|
|
44194
|
-
fpRate: 0,
|
|
44195
|
-
ratio: 1,
|
|
44196
|
-
precision: 0,
|
|
44197
|
-
lastCalibratedAt: "2026-07-03T00:00:00Z",
|
|
44198
|
-
verdict: "DORMANT",
|
|
44199
|
-
_calibrationNote: "v0.26.0: new positive AI-signal rule. Triggers when a Java file has 5+ List.of/Map.of/Set.of calls AND < 1 new ArrayList/HashMap/HashSet/LinkedList/TreeMap calls. Calibration pending v9 Java corpus re-run; placeholder values until then. v0.26.0: redesigned as positive signal (AI defaults to immutable factory methods). Reference: java/immutable-collection-preference v0.26.0.",
|
|
44200
|
-
aiSpecific: true,
|
|
44201
|
-
_v9Verdict: "DORMANT",
|
|
44202
|
-
_v9Lift: 1,
|
|
44203
|
-
_v9Recall: 0,
|
|
44204
|
-
_v9FpRate: 0,
|
|
44205
|
-
_v9Precision: 0,
|
|
44206
|
-
defaultOff: true
|
|
44207
|
-
},
|
|
44208
|
-
"java/builder-overuse": {
|
|
44209
|
-
recall: 0,
|
|
44210
|
-
fpRate: 0,
|
|
44211
|
-
ratio: 1,
|
|
44212
|
-
precision: 0,
|
|
44213
|
-
lastCalibratedAt: "2026-07-03T00:00:00Z",
|
|
44214
|
-
verdict: "DORMANT",
|
|
44215
|
-
_calibrationNote: "v0.26.0: new positive AI-signal rule. Triggers when @Builder annotation (Lombok) is used on a class with <= 3 fields. Calibration pending v9 Java corpus re-run; placeholder values until then. v0.26.0: redesigned as positive signal (AI defaults to Builder pattern even for simple data classes). Reference: java/builder-overuse v0.26.0.",
|
|
44216
|
-
aiSpecific: true,
|
|
44217
|
-
_v9Verdict: "DORMANT",
|
|
44218
|
-
_v9Lift: 1,
|
|
44219
|
-
_v9Recall: 0,
|
|
44220
|
-
_v9FpRate: 0,
|
|
44221
|
-
_v9Precision: 0,
|
|
44222
|
-
defaultOff: true
|
|
44223
|
-
},
|
|
44224
|
-
"java/stream-overuse": {
|
|
44225
|
-
recall: 0,
|
|
44226
|
-
fpRate: 0,
|
|
44227
|
-
ratio: 1,
|
|
44228
|
-
precision: 0,
|
|
44229
|
-
lastCalibratedAt: "2026-07-03T00:00:00Z",
|
|
44230
|
-
verdict: "DORMANT",
|
|
44231
|
-
_calibrationNote: "v0.26.0: new positive AI-signal rule. Triggers when a single line has 3+ Stream API operations (.map, .filter, .flatMap, .collect, .reduce, .sorted, .distinct, .limit, .skip, .anyMatch, .allMatch, .noneMatch, .findFirst, .findAny). Calibration pending v9 Java corpus re-run; placeholder values until then. v0.26.0: redesigned as positive signal (AI chains Stream API for everything). Reference: java/stream-overuse v0.26.0.",
|
|
44232
|
-
aiSpecific: true,
|
|
44233
|
-
_v9Verdict: "DORMANT",
|
|
44234
|
-
_v9Lift: 1,
|
|
44235
|
-
_v9Recall: 0,
|
|
44236
|
-
_v9FpRate: 0,
|
|
44237
|
-
_v9Precision: 0,
|
|
44238
|
-
defaultOff: true
|
|
44239
|
-
},
|
|
44240
|
-
"java/raw-type-overuse": {
|
|
44241
|
-
recall: 0.1093,
|
|
44242
|
-
fpRate: 0.2041,
|
|
44243
|
-
ratio: 0.54,
|
|
44244
|
-
precision: 0.0632,
|
|
44245
|
-
lastCalibratedAt: "2026-07-02T19:34:00Z",
|
|
44246
|
-
verdict: "DORMANT",
|
|
44247
|
-
_calibrationNote: "v9 Java corpus calibration (v0.25.0, 2026-07-02): 81891 neg + 10305 pos Java files. v9 TP=1126, FP=16712, P=6.32%, FPR=20.41%, recall=10.93%, ratio=0.54, lift=P/FPR=0.31. Strongly INVERTED: raw types (no generics) are 2x more common in legacy enterprise Java (neg) than in modern Java repos (pos). Heuristic is correctly identifying the legacy anti-pattern, but it's an age marker more than an AI-fingerprint. v0.20: new rule.",
|
|
44248
|
-
aiSpecific: true,
|
|
44249
|
-
_v7Verdict: "DORMANT",
|
|
44250
|
-
_v7Lift: 1,
|
|
44251
|
-
_v7Recall: 0,
|
|
44252
|
-
_v7FpRate: 0,
|
|
44253
|
-
_v7Precision: 0,
|
|
44254
|
-
_v8Verdict: "DORMANT",
|
|
44255
|
-
_v8Lift: 1,
|
|
44256
|
-
_v9Verdict: "DORMANT",
|
|
44257
|
-
_v9Lift: 0.31,
|
|
44258
|
-
_v9Recall: 0.1093,
|
|
44259
|
-
_v9FpRate: 0.2041,
|
|
44260
|
-
_v9Precision: 0.0632,
|
|
44261
|
-
defaultOff: true
|
|
44262
|
-
},
|
|
44263
|
-
"java/string-concat-loop": {
|
|
44264
|
-
recall: 46e-4,
|
|
44265
|
-
fpRate: 0.0358,
|
|
44266
|
-
ratio: 0.13,
|
|
44267
|
-
precision: 0.0158,
|
|
44268
|
-
lastCalibratedAt: "2026-07-02T19:34:00Z",
|
|
44269
|
-
verdict: "DORMANT",
|
|
44270
|
-
_calibrationNote: "v9 Java corpus calibration (v0.25.0, 2026-07-02): 81891 neg + 10305 pos Java files. v9 TP=47, FP=2933, P=1.58%, FPR=3.58%, recall=0.46%, ratio=0.13, lift=P/FPR=0.44. Strongly INVERTED: string concatenation in a loop is 8x more common in legacy enterprise Java (neg) than in AI/ML/Java-modern pos repos. Modern Java training data and modern IDE warnings discourage the pattern. v0.20: new rule.",
|
|
44271
|
-
aiSpecific: true,
|
|
44272
|
-
_v7Verdict: "DORMANT",
|
|
44273
|
-
_v7Lift: 1,
|
|
44274
|
-
_v7Recall: 0,
|
|
44275
|
-
_v7FpRate: 0,
|
|
44276
|
-
_v7Precision: 0,
|
|
44277
|
-
_v8Verdict: "DORMANT",
|
|
44278
|
-
_v8Lift: 1,
|
|
44279
|
-
_v9Verdict: "DORMANT",
|
|
44280
|
-
_v9Lift: 0.44,
|
|
44281
|
-
_v9Recall: 46e-4,
|
|
44282
|
-
_v9FpRate: 0.0358,
|
|
44283
|
-
_v9Precision: 0.0158,
|
|
44284
|
-
defaultOff: true
|
|
44285
|
-
},
|
|
44286
|
-
"java/system-out-println": {
|
|
44287
|
-
recall: 0.1503,
|
|
44288
|
-
fpRate: 0.2533,
|
|
44289
|
-
ratio: 0.59,
|
|
44290
|
-
precision: 0.0695,
|
|
44291
|
-
lastCalibratedAt: "2026-07-02T19:34:00Z",
|
|
44292
|
-
verdict: "DORMANT",
|
|
44293
|
-
_calibrationNote: "v9 Java corpus calibration (v0.25.0, 2026-07-02): 81891 neg + 10305 pos Java files. v9 TP=1549, FP=20737, P=6.95%, FPR=25.32%, recall=15.03%, ratio=0.59, lift=P/FPR=0.27. INVERTED: System.out.println is more common in legacy enterprise Java (neg) than in modern AI/Java repos (pos). Modern Java defaults to SLF4J/Log4j, AI-generated Java starts with a logger import. The pattern is the opposite of the v0.20 design intent (which assumed println was the AI-fingerprint signal). v0.25.x: consider gating this rule by Java era (recent file mtime) or making it an age-fingerprint rather than AI-fingerprint. v0.20: new rule.",
|
|
44294
|
-
aiSpecific: true,
|
|
44295
|
-
_v7Verdict: "DORMANT",
|
|
44296
|
-
_v7Lift: 1,
|
|
44297
|
-
_v7Recall: 0,
|
|
44298
|
-
_v7FpRate: 0,
|
|
44299
|
-
_v7Precision: 0,
|
|
44300
|
-
_v8Verdict: "DORMANT",
|
|
44301
|
-
_v8Lift: 1,
|
|
44302
|
-
_v9Verdict: "DORMANT",
|
|
44303
|
-
_v9Lift: 0.27,
|
|
44304
|
-
_v9Recall: 0.1503,
|
|
44305
|
-
_v9FpRate: 0.2533,
|
|
44306
|
-
_v9Precision: 0.0695,
|
|
44307
|
-
defaultOff: true
|
|
44308
|
-
},
|
|
44309
43574
|
"layout/forced-layout": {
|
|
44310
43575
|
recall: 0,
|
|
44311
43576
|
fpRate: 0,
|