@emeryld/manager 1.4.2 → 1.4.3

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.
@@ -205,26 +205,33 @@ function formatOccurrenceDetail(info) {
205
205
  }
206
206
  export function collectDuplicateViolations(duplicates, limits, fileSnapshots) {
207
207
  const violations = [];
208
+ const seenDuplicateKeys = new Set();
208
209
  for (const tracker of duplicates.values()) {
209
210
  if (tracker.count <= limits.maxDuplicateLineOccurrences)
210
211
  continue;
211
212
  if (tracker.occurrences.length === 0)
212
213
  continue;
213
214
  const expanded = expandDuplicateTracker(tracker, fileSnapshots);
215
+ const defaultDetail = tracker.occurrences
216
+ .map((occurrence) => {
217
+ const relativePath = path.relative(process.cwd(), occurrence.file);
218
+ return `${relativePath}:${occurrence.line}:${occurrence.startColumn}/${occurrence.endLine}:${occurrence.endColumn}`;
219
+ })
220
+ .join('\n');
221
+ const detailText = expanded?.detail ?? defaultDetail;
222
+ const snippetText = expanded?.snippet ?? tracker.snippet;
223
+ const dedupKey = `${snippetText}::${detailText}`;
224
+ if (seenDuplicateKeys.has(dedupKey))
225
+ continue;
226
+ seenDuplicateKeys.add(dedupKey);
214
227
  violations.push({
215
228
  type: 'duplicateLine',
216
229
  file: tracker.occurrences[0].file,
217
230
  line: tracker.occurrences[0].line,
218
231
  severity: tracker.count - limits.maxDuplicateLineOccurrences,
219
232
  message: `Repeated ${tracker.count} times (max ${limits.maxDuplicateLineOccurrences})`,
220
- detail: expanded?.detail ??
221
- tracker.occurrences
222
- .map((occurrence) => {
223
- const relativePath = path.relative(process.cwd(), occurrence.file);
224
- return `${relativePath}:${occurrence.line}:${occurrence.startColumn}/${occurrence.endLine}:${occurrence.endColumn}`;
225
- })
226
- .join('\n'),
227
- snippet: expanded?.snippet ?? tracker.snippet,
233
+ detail: detailText,
234
+ snippet: snippetText,
228
235
  repeatCount: tracker.count,
229
236
  requiredVariables: expanded?.requiredVariables ?? tracker.requiredVariables,
230
237
  });
@@ -4,9 +4,9 @@ export function normalizeLine(line) {
4
4
  const trimmed = line.trim();
5
5
  if (!trimmed)
6
6
  return undefined;
7
+ if (/^[};()]+$/.test(trimmed))
8
+ return undefined;
7
9
  const collapse = trimmed.replace(/\s+/g, ' ');
8
- const letterCount = (collapse.match(/[A-Za-z]/g) ?? []).length;
9
- // if (collapse.length < 12 && letterCount < 3) return undefined
10
10
  const noNumbers = collapse.replace(/\d+/g, '#');
11
11
  return noNumbers.toLowerCase();
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emeryld/manager",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Interactive manager for pnpm monorepos (update/test/build/publish).",
5
5
  "license": "MIT",
6
6
  "type": "module",