pi-lens 2.2.3 → 2.2.5
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.
|
@@ -41,17 +41,31 @@ export function registerRunner(runner) {
|
|
|
41
41
|
export function getRunner(id) {
|
|
42
42
|
return globalRegistry.get(id);
|
|
43
43
|
}
|
|
44
|
-
export function getRunnersForKind(kind) {
|
|
44
|
+
export function getRunnersForKind(kind, filePath) {
|
|
45
45
|
if (!kind)
|
|
46
46
|
return [];
|
|
47
47
|
const runners = [];
|
|
48
|
+
const isTestFile = filePath ? isTest(filePath) : false;
|
|
48
49
|
for (const runner of globalRegistry.values()) {
|
|
50
|
+
// Skip runners that shouldn't run on test files
|
|
51
|
+
if (isTestFile && runner.skipTestFiles)
|
|
52
|
+
continue;
|
|
49
53
|
if (runner.appliesTo.includes(kind) || runner.appliesTo.length === 0) {
|
|
50
54
|
runners.push(runner);
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
return runners.sort((a, b) => a.priority - b.priority);
|
|
54
58
|
}
|
|
59
|
+
function isTest(filePath) {
|
|
60
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
61
|
+
return (normalized.includes(".test.") ||
|
|
62
|
+
normalized.includes(".spec.") ||
|
|
63
|
+
normalized.includes("/test/") ||
|
|
64
|
+
normalized.includes("/tests/") ||
|
|
65
|
+
normalized.includes("__tests__/") ||
|
|
66
|
+
normalized.includes("test-utils") ||
|
|
67
|
+
normalized.startsWith("test-"));
|
|
68
|
+
}
|
|
55
69
|
export function listRunners() {
|
|
56
70
|
return Array.from(globalRegistry.values());
|
|
57
71
|
}
|
|
@@ -65,10 +65,16 @@ export function getRunner(id: string): RunnerDefinition | undefined {
|
|
|
65
65
|
|
|
66
66
|
export function getRunnersForKind(
|
|
67
67
|
kind: FileKind | undefined,
|
|
68
|
+
filePath?: string,
|
|
68
69
|
): RunnerDefinition[] {
|
|
69
70
|
if (!kind) return [];
|
|
70
71
|
const runners: RunnerDefinition[] = [];
|
|
72
|
+
const isTestFile = filePath ? isTest(filePath) : false;
|
|
73
|
+
|
|
71
74
|
for (const runner of globalRegistry.values()) {
|
|
75
|
+
// Skip runners that shouldn't run on test files
|
|
76
|
+
if (isTestFile && runner.skipTestFiles) continue;
|
|
77
|
+
|
|
72
78
|
if (runner.appliesTo.includes(kind) || runner.appliesTo.length === 0) {
|
|
73
79
|
runners.push(runner);
|
|
74
80
|
}
|
|
@@ -76,6 +82,19 @@ export function getRunnersForKind(
|
|
|
76
82
|
return runners.sort((a, b) => a.priority - b.priority);
|
|
77
83
|
}
|
|
78
84
|
|
|
85
|
+
function isTest(filePath: string): boolean {
|
|
86
|
+
const normalized = filePath.replace(/\\/g, "/");
|
|
87
|
+
return (
|
|
88
|
+
normalized.includes(".test.") ||
|
|
89
|
+
normalized.includes(".spec.") ||
|
|
90
|
+
normalized.includes("/test/") ||
|
|
91
|
+
normalized.includes("/tests/") ||
|
|
92
|
+
normalized.includes("__tests__/") ||
|
|
93
|
+
normalized.includes("test-utils") ||
|
|
94
|
+
normalized.startsWith("test-")
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
79
98
|
export function listRunners(): RunnerDefinition[] {
|
|
80
99
|
return Array.from(globalRegistry.values());
|
|
81
100
|
}
|
|
@@ -13,6 +13,7 @@ const astGrepRunner = {
|
|
|
13
13
|
appliesTo: ["jsts", "python", "go", "rust", "cxx"],
|
|
14
14
|
priority: 30,
|
|
15
15
|
enabledByDefault: false,
|
|
16
|
+
skipTestFiles: true, // Many rules are noisy in tests
|
|
16
17
|
async run(ctx) {
|
|
17
18
|
// Check if ast-grep is available
|
|
18
19
|
const check = spawnSync("sg", ["--version"], {
|
|
@@ -21,6 +21,7 @@ const astGrepRunner: RunnerDefinition = {
|
|
|
21
21
|
appliesTo: ["jsts", "python", "go", "rust", "cxx"],
|
|
22
22
|
priority: 30,
|
|
23
23
|
enabledByDefault: false,
|
|
24
|
+
skipTestFiles: true, // Many rules are noisy in tests
|
|
24
25
|
|
|
25
26
|
async run(ctx: DispatchContext): Promise<RunnerResult> {
|
|
26
27
|
// Check if ast-grep is available
|
|
@@ -96,6 +96,8 @@ export interface RunnerDefinition {
|
|
|
96
96
|
appliesTo: readonly FileKind[];
|
|
97
97
|
priority: number;
|
|
98
98
|
enabledByDefault: boolean;
|
|
99
|
+
/** Skip this runner for test files (false positive reduction) */
|
|
100
|
+
skipTestFiles?: boolean;
|
|
99
101
|
/** Check if runner should run */
|
|
100
102
|
when?: (ctx: DispatchContext) => Promise<boolean> | boolean;
|
|
101
103
|
/** Execute the runner */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-lens",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Real-time code quality feedback for pi — TypeScript LSP, Biome, ast-grep, Ruff, complexity metrics, duplicate detection. Includes automated fix loop (/lens-booboo-fix) and interactive architectural refactoring (/lens-booboo-refactor) with browser-based interviews.",
|
|
6
6
|
"repository": {
|