mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-08 03:08:13 +00:00
fix: address CI failures — unused import, Dirent types, null comparison, lint, formatting
Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/f4b6e20d-8d56-4834-8296-db82af27f8e1 Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
This commit is contained in:
parent
7eec92fe13
commit
48be1286ac
3 changed files with 13 additions and 13 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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<string> {
|
|||
}
|
||||
|
||||
function walk(dir: string, root: string, out: Set<string>): void {
|
||||
let entries: ReturnType<typeof readdirSync>;
|
||||
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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue