@safetnsr/vet 1.10.0 → 1.10.1
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/checks/debt.js +5 -3
- package/dist/util.js +1 -1
- package/package.json +1 -1
package/dist/checks/debt.js
CHANGED
|
@@ -175,13 +175,15 @@ function findDuplicates(allFuncs) {
|
|
|
175
175
|
fixHint: 'extract shared logic into a single function',
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
// Similarity check for non-exact matches
|
|
178
|
+
// Similarity check for non-exact matches (capped to avoid O(n²) explosion on large repos)
|
|
179
179
|
const singles = allFuncs.filter(fn => {
|
|
180
180
|
const g = groups.get(fn.hash);
|
|
181
181
|
return !g || g.length < 2;
|
|
182
182
|
});
|
|
183
|
-
for (
|
|
184
|
-
|
|
183
|
+
// Cap at 500 functions for similarity — O(n²) with levenshtein is too expensive above that
|
|
184
|
+
const singlesCapped = singles.length > 500 ? singles.slice(0, 500) : singles;
|
|
185
|
+
for (let i = 0; i < singlesCapped.length; i++) {
|
|
186
|
+
for (let j = i + 1; j < singlesCapped.length; j++) {
|
|
185
187
|
const a = singles[i];
|
|
186
188
|
const b = singles[j];
|
|
187
189
|
// Skip very short normalized bodies
|
package/dist/util.js
CHANGED
|
@@ -41,7 +41,7 @@ export function readFile(path) {
|
|
|
41
41
|
export function fileExists(path) {
|
|
42
42
|
return existsSync(path);
|
|
43
43
|
}
|
|
44
|
-
export function walkFiles(dir, ignore = [], maxFiles) {
|
|
44
|
+
export function walkFiles(dir, ignore = [], maxFiles = 2000) {
|
|
45
45
|
const results = [];
|
|
46
46
|
const defaultIgnore = ['node_modules', '.git', 'dist', 'build', '.next', 'coverage', 'vendor', '__pycache__', '.venv', 'venv'];
|
|
47
47
|
const allIgnore = [...defaultIgnore, ...ignore];
|