pi-lens 2.2.9 → 2.2.10

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/commands/rate.js CHANGED
@@ -69,7 +69,7 @@ export async function gatherScores(targetPath, clients) {
69
69
  let securityScore = 100;
70
70
  const securityIssues = [];
71
71
  let secretsFound = 0;
72
- // Check for secrets in source files
72
+ // Check for secrets in source files (skip test files)
73
73
  const secretPatterns = [
74
74
  { name: "API Key (sk-)", pattern: /sk-[a-zA-Z0-9]{20,}/ },
75
75
  { name: "GitHub Token", pattern: /ghp_[a-zA-Z0-9]{36}/ },
@@ -81,7 +81,22 @@ export async function gatherScores(targetPath, clients) {
81
81
  pattern: /-----BEGIN (?:RSA |EC |DSA )?PRIVATE KEY-----/,
82
82
  },
83
83
  ];
84
+ function isTestFile(filePath) {
85
+ const normalized = filePath.replace(/\\/g, "/");
86
+ return (normalized.includes(".test.") ||
87
+ normalized.includes(".spec.") ||
88
+ normalized.includes("/test/") ||
89
+ normalized.includes("/tests/") ||
90
+ normalized.includes("__tests__/") ||
91
+ normalized.includes("test-utils") ||
92
+ normalized.startsWith("test-") ||
93
+ normalized.includes(".fixture.") ||
94
+ normalized.includes(".mock."));
95
+ }
84
96
  for (const file of files.slice(0, 100)) {
97
+ // Skip test files
98
+ if (isTestFile(file))
99
+ continue;
85
100
  try {
86
101
  const content = nodeFs.readFileSync(file, "utf-8");
87
102
  for (const line of content.split("\n")) {
package/commands/rate.ts CHANGED
@@ -105,7 +105,7 @@ export async function gatherScores(
105
105
  const securityIssues: string[] = [];
106
106
  let secretsFound = 0;
107
107
 
108
- // Check for secrets in source files
108
+ // Check for secrets in source files (skip test files)
109
109
  const secretPatterns = [
110
110
  { name: "API Key (sk-)", pattern: /sk-[a-zA-Z0-9]{20,}/ },
111
111
  { name: "GitHub Token", pattern: /ghp_[a-zA-Z0-9]{36}/ },
@@ -118,7 +118,24 @@ export async function gatherScores(
118
118
  },
119
119
  ];
120
120
 
121
+ function isTestFile(filePath: string): boolean {
122
+ const normalized = filePath.replace(/\\/g, "/");
123
+ return (
124
+ normalized.includes(".test.") ||
125
+ normalized.includes(".spec.") ||
126
+ normalized.includes("/test/") ||
127
+ normalized.includes("/tests/") ||
128
+ normalized.includes("__tests__/") ||
129
+ normalized.includes("test-utils") ||
130
+ normalized.startsWith("test-") ||
131
+ normalized.includes(".fixture.") ||
132
+ normalized.includes(".mock.")
133
+ );
134
+ }
135
+
121
136
  for (const file of files.slice(0, 100)) {
137
+ // Skip test files
138
+ if (isTestFile(file)) continue;
122
139
  try {
123
140
  const content = nodeFs.readFileSync(file, "utf-8");
124
141
  for (const line of content.split("\n")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-lens",
3
- "version": "2.2.9",
3
+ "version": "2.2.10",
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": {