chore(autofix): apply prettier + eslint fixes via /autofix command

This commit is contained in:
github-actions[bot] 2026-05-10 17:32:39 +00:00
parent dd5746b9ee
commit 7d8f885177
4 changed files with 32 additions and 34 deletions

View file

@ -1,5 +1,10 @@
import type { Capture, CaptureMatch } from 'gitnexus-shared';
import { findNodeAtRange, nodeToCapture, syntheticCapture, type SyntaxNode } from '../../utils/ast-helpers.js';
import {
findNodeAtRange,
nodeToCapture,
syntheticCapture,
type SyntaxNode,
} from '../../utils/ast-helpers.js';
import { getCParser, getCScopeQuery } from './query.js';
import { getTreeSitterBufferSize } from '../../constants.js';
import { parseSourceSafe } from '../../../tree-sitter/safe-parse.js';

View file

@ -8,4 +8,9 @@ export { cArityCompatibility } from './arity.js';
export { cMergeBindings } from './merge-bindings.js';
export { cBindingScopeFor, cImportOwningScope, cReceiverBinding } from './simple-hooks.js';
export { resolveCImportTarget } from './import-target.js';
export { markStaticName, isStaticName, clearStaticNames, expandCWildcardNames } from './static-linkage.js';
export {
markStaticName,
isStaticName,
clearStaticNames,
expandCWildcardNames,
} from './static-linkage.js';

View file

@ -8,7 +8,10 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { emitCScopeCaptures } from '../../../../src/core/ingestion/languages/c/captures.js';
import { clearStaticNames, isStaticName } from '../../../../src/core/ingestion/languages/c/static-linkage.js';
import {
clearStaticNames,
isStaticName,
} from '../../../../src/core/ingestion/languages/c/static-linkage.js';
function tagsFor(src: string, filePath = 'test.c'): string[][] {
const matches = emitCScopeCaptures(src, filePath);
@ -71,9 +74,8 @@ describe('emitCScopeCaptures — struct declarations', () => {
});
it('captures typedef struct with @declaration.struct (not typedef)', () => {
const m = findMatch(
'typedef struct { int age; } User;',
(t) => t.includes('@declaration.struct'),
const m = findMatch('typedef struct { int age; } User;', (t) =>
t.includes('@declaration.struct'),
);
expect(m).toBeDefined();
expect(m!['@declaration.name'].text).toBe('User');
@ -88,18 +90,14 @@ describe('emitCScopeCaptures — struct declarations', () => {
describe('emitCScopeCaptures — union declarations', () => {
it('captures named union with @declaration.union', () => {
const m = findMatch(
'union Data { int i; float f; };',
(t) => t.includes('@declaration.union'),
);
const m = findMatch('union Data { int i; float f; };', (t) => t.includes('@declaration.union'));
expect(m).toBeDefined();
expect(m!['@declaration.name'].text).toBe('Data');
});
it('captures typedef union with @declaration.union', () => {
const m = findMatch(
'typedef union { int i; float f; } Value;',
(t) => t.includes('@declaration.union'),
const m = findMatch('typedef union { int i; float f; } Value;', (t) =>
t.includes('@declaration.union'),
);
expect(m).toBeDefined();
expect(m!['@declaration.name'].text).toBe('Value');
@ -108,18 +106,14 @@ describe('emitCScopeCaptures — union declarations', () => {
describe('emitCScopeCaptures — enum declarations', () => {
it('captures enum with @declaration.enum', () => {
const m = findMatch(
'enum Color { RED, GREEN, BLUE };',
(t) => t.includes('@declaration.enum'),
);
const m = findMatch('enum Color { RED, GREEN, BLUE };', (t) => t.includes('@declaration.enum'));
expect(m).toBeDefined();
expect(m!['@declaration.name'].text).toBe('Color');
});
it('captures enum constants as @declaration.const', () => {
const matches = allMatches(
'enum Color { RED, GREEN, BLUE };',
(t) => t.includes('@declaration.const'),
const matches = allMatches('enum Color { RED, GREEN, BLUE };', (t) =>
t.includes('@declaration.const'),
);
const names = matches.map((m) => m['@declaration.name'].text);
expect(names).toContain('RED');
@ -301,16 +295,18 @@ describe('emitCScopeCaptures — arity metadata', () => {
});
it('synthesizes arity on call references', () => {
const m = findMatch('void f(void) { add(1, 2); }', (t) =>
t.includes('@reference.call.free') && t.includes('@reference.arity'),
const m = findMatch(
'void f(void) { add(1, 2); }',
(t) => t.includes('@reference.call.free') && t.includes('@reference.arity'),
);
expect(m).toBeDefined();
expect(m!['@reference.arity'].text).toBe('2');
});
it('zero-argument call has arity 0', () => {
const m = findMatch('void f(void) { init(); }', (t) =>
t.includes('@reference.call.free') && t.includes('@reference.arity'),
const m = findMatch(
'void f(void) { init(); }',
(t) => t.includes('@reference.call.free') && t.includes('@reference.arity'),
);
expect(m).toBeDefined();
expect(m!['@reference.arity'].text).toBe('0');

View file

@ -120,20 +120,12 @@ describe('C import target resolution (resolveCImportTarget)', () => {
});
it('prefers shallower path over lexicographic order', () => {
const result = resolveCImportTarget(
'foo.h',
'main.c',
new Set(['a/b/c/foo.h', 'z/foo.h']),
);
const result = resolveCImportTarget('foo.h', 'main.c', new Set(['a/b/c/foo.h', 'z/foo.h']));
expect(result).toBe('z/foo.h');
});
it('handles backslash paths (Windows)', () => {
const result = resolveCImportTarget(
'foo.h',
'main.c',
new Set(['include\\foo.h']),
);
const result = resolveCImportTarget('foo.h', 'main.c', new Set(['include\\foo.h']));
expect(result).toBe('include\\foo.h');
});
});