From 48be1286ac0daa8d116084378562483884cafd51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 10 May 2026 16:25:51 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20address=20CI=20failures=20=E2=80=94=20un?= =?UTF-8?q?used=20import,=20Dirent=20types,=20null=20comparison,=20lint,?= =?UTF-8?q?=20formatting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/f4b6e20d-8d56-4834-8296-db82af27f8e1 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com> --- .../core/ingestion/languages/c/arity-metadata.ts | 10 +++++----- gitnexus/src/core/ingestion/languages/c/captures.ts | 3 +-- .../src/core/ingestion/languages/c/header-scan.ts | 13 +++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/gitnexus/src/core/ingestion/languages/c/arity-metadata.ts b/gitnexus/src/core/ingestion/languages/c/arity-metadata.ts index b6d6a7345..0a06d3dfb 100644 --- a/gitnexus/src/core/ingestion/languages/c/arity-metadata.ts +++ b/gitnexus/src/core/ingestion/languages/c/arity-metadata.ts @@ -11,7 +11,7 @@ export interface CArityInfo { */ export function computeCDeclarationArity(node: SyntaxNode): CArityInfo { // Find the function_declarator child (may be wrapped in pointer_declarator) - let funcDecl = findFuncDeclarator(node); + const funcDecl = findFuncDeclarator(node); if (funcDecl === null) return {}; const paramList = funcDecl.childForFieldName?.('parameters'); @@ -60,7 +60,7 @@ export function computeCDeclarationArity(node: SyntaxNode): CArityInfo { */ export function computeCCallArity(node: SyntaxNode): number { const argList = node.childForFieldName?.('arguments'); - if (argList === null || argList === undefined) return 0; + if (argList == null) return 0; let count = 0; for (let i = 0; i < argList.childCount; i++) { @@ -77,7 +77,7 @@ export function computeCCallArity(node: SyntaxNode): number { function findFuncDeclarator(node: SyntaxNode): SyntaxNode | null { // Direct child let decl = node.childForFieldName?.('declarator'); - if (decl === null || decl === undefined) { + if (decl == null) { for (let i = 0; i < node.childCount; i++) { const c = node.child(i); if (c?.type === 'function_declarator') return c; @@ -85,9 +85,9 @@ function findFuncDeclarator(node: SyntaxNode): SyntaxNode | null { return null; } // Unwrap pointer_declarator - while (decl !== null && decl.type === 'pointer_declarator') { + while (decl != null && decl.type === 'pointer_declarator') { const next = decl.childForFieldName?.('declarator'); - if (next === null || next === undefined) break; + if (next == null) break; decl = next; } if (decl?.type === 'function_declarator') return decl; diff --git a/gitnexus/src/core/ingestion/languages/c/captures.ts b/gitnexus/src/core/ingestion/languages/c/captures.ts index c29417366..1ee52030f 100644 --- a/gitnexus/src/core/ingestion/languages/c/captures.ts +++ b/gitnexus/src/core/ingestion/languages/c/captures.ts @@ -95,8 +95,7 @@ export function emitCScopeCaptures( } // Enrich call references with arity - const callAnchor = - grouped['@reference.call.free'] ?? grouped['@reference.call.member']; + const callAnchor = grouped['@reference.call.free'] ?? grouped['@reference.call.member']; if (callAnchor !== undefined && grouped['@reference.arity'] === undefined) { const callNode = findNodeAtRange(tree.rootNode, callAnchor.range, 'call_expression'); if (callNode !== null) { diff --git a/gitnexus/src/core/ingestion/languages/c/header-scan.ts b/gitnexus/src/core/ingestion/languages/c/header-scan.ts index 6dc7d3903..f74d3fa89 100644 --- a/gitnexus/src/core/ingestion/languages/c/header-scan.ts +++ b/gitnexus/src/core/ingestion/languages/c/header-scan.ts @@ -1,4 +1,4 @@ -import { readdirSync, statSync } from 'fs'; +import { readdirSync, type Dirent } from 'fs'; import { join, relative } from 'path'; /** C header extensions to scan for in the workspace. */ @@ -17,22 +17,23 @@ export function scanHeaderFiles(repoPath: string): ReadonlySet { } function walk(dir: string, root: string, out: Set): void { - let entries: ReturnType; + let entries: Dirent[]; try { - entries = readdirSync(dir, { withFileTypes: true }); + entries = readdirSync(dir, { withFileTypes: true, encoding: 'utf8' }); } catch { return; // permission denied, etc. } for (const entry of entries) { - const full = join(dir, entry.name); + const name = entry.name; + const full = join(dir, name); if (entry.isDirectory()) { // Skip common non-source directories - if (entry.name === 'node_modules' || entry.name === '.git' || entry.name === 'vendor') { + if (name === 'node_modules' || name === '.git' || name === 'vendor') { continue; } walk(full, root, out); } else if (entry.isFile()) { - const ext = entry.name.slice(entry.name.lastIndexOf('.')); + const ext = name.slice(name.lastIndexOf('.')); if (HEADER_EXTENSIONS.has(ext)) { out.add(relative(root, full)); }