Skip to content

Commit 1915e5e

Browse files
committed
chore(lint): fix unused import and formatting in cpp/cuda extractors and test
Remove unused TypeMapEntry import from cpp.ts and cuda.ts, reformat primitive-type Set literals and test expect() calls to satisfy biome line-length rules.
1 parent f93d0cb commit 1915e5e

3 files changed

Lines changed: 60 additions & 13 deletions

File tree

src/extractors/cpp.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type {
44
SubDeclaration,
55
TreeSitterNode,
66
TreeSitterTree,
7-
TypeMapEntry,
87
} from '../types.js';
98
import { extractModifierVisibility, findChild, nodeEndLine } from './helpers.js';
109

@@ -363,10 +362,30 @@ function extractCppClassFields(classNode: TreeSitterNode): SubDeclaration[] {
363362
* into typeMap would cause spurious receiver edges (e.g. `int x` → `int`).
364363
*/
365364
const CPP_PRIMITIVE_TYPES = new Set([
366-
'int', 'long', 'short', 'unsigned', 'signed', 'float', 'double',
367-
'char', 'bool', 'void', 'wchar_t', 'auto', 'size_t', 'uint8_t',
368-
'uint16_t', 'uint32_t', 'uint64_t', 'int8_t', 'int16_t', 'int32_t',
369-
'int64_t', 'ptrdiff_t', 'intptr_t', 'uintptr_t',
365+
'int',
366+
'long',
367+
'short',
368+
'unsigned',
369+
'signed',
370+
'float',
371+
'double',
372+
'char',
373+
'bool',
374+
'void',
375+
'wchar_t',
376+
'auto',
377+
'size_t',
378+
'uint8_t',
379+
'uint16_t',
380+
'uint32_t',
381+
'uint64_t',
382+
'int8_t',
383+
'int16_t',
384+
'int32_t',
385+
'int64_t',
386+
'ptrdiff_t',
387+
'intptr_t',
388+
'uintptr_t',
370389
]);
371390

372391
function isPrimitiveCppType(typeName: string): boolean {

src/extractors/cuda.ts

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import type {
44
SubDeclaration,
55
TreeSitterNode,
66
TreeSitterTree,
7-
TypeMapEntry,
87
} from '../types.js';
98
import { extractModifierVisibility, findChild, nodeEndLine } from './helpers.js';
109

@@ -413,10 +412,30 @@ function innerCudaDeclarator(node: TreeSitterNode): TreeSitterNode | null {
413412
* these into typeMap would produce spurious receiver edges (e.g. `int x` → `int`).
414413
*/
415414
const CUDA_PRIMITIVE_TYPES = new Set([
416-
'int', 'long', 'short', 'unsigned', 'signed', 'float', 'double',
417-
'char', 'bool', 'void', 'wchar_t', 'auto', 'size_t', 'uint8_t',
418-
'uint16_t', 'uint32_t', 'uint64_t', 'int8_t', 'int16_t', 'int32_t',
419-
'int64_t', 'ptrdiff_t', 'intptr_t', 'uintptr_t',
415+
'int',
416+
'long',
417+
'short',
418+
'unsigned',
419+
'signed',
420+
'float',
421+
'double',
422+
'char',
423+
'bool',
424+
'void',
425+
'wchar_t',
426+
'auto',
427+
'size_t',
428+
'uint8_t',
429+
'uint16_t',
430+
'uint32_t',
431+
'uint64_t',
432+
'int8_t',
433+
'int16_t',
434+
'int32_t',
435+
'int64_t',
436+
'ptrdiff_t',
437+
'intptr_t',
438+
'uintptr_t',
420439
]);
421440

422441
function isCudaPrimitiveType(typeName: string): boolean {

tests/parsers/javascript.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,10 @@ describe('JavaScript parser', () => {
225225
}
226226
`);
227227
// Primary: class-scoped key at 0.9 — prevents cross-class collision.
228-
expect(symbols.typeMap.get('UserService.repo')).toEqual({ type: 'Repository', confidence: 0.9 });
228+
expect(symbols.typeMap.get('UserService.repo')).toEqual({
229+
type: 'Repository',
230+
confidence: 0.9,
231+
});
229232
// Fallback bare keys at lower confidence for single-class files.
230233
expect(symbols.typeMap.get('repo')).toEqual({ type: 'Repository', confidence: 0.6 });
231234
expect(symbols.typeMap.get('this.repo')).toEqual({ type: 'Repository', confidence: 0.6 });
@@ -241,8 +244,14 @@ describe('JavaScript parser', () => {
241244
}
242245
`);
243246
// Each class gets its own scoped key — no collision.
244-
expect(symbols.typeMap.get('OrderService.repo')).toEqual({ type: 'OrderRepository', confidence: 0.9 });
245-
expect(symbols.typeMap.get('UserService.repo')).toEqual({ type: 'UserRepository', confidence: 0.9 });
247+
expect(symbols.typeMap.get('OrderService.repo')).toEqual({
248+
type: 'OrderRepository',
249+
confidence: 0.9,
250+
});
251+
expect(symbols.typeMap.get('UserService.repo')).toEqual({
252+
type: 'UserRepository',
253+
confidence: 0.9,
254+
});
246255
// Bare "repo" key should hold the first class's type at 0.6 (second write is same confidence, no overwrite).
247256
expect(symbols.typeMap.get('repo')?.confidence).toBe(0.6);
248257
});

0 commit comments

Comments
 (0)