mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-09-14 23:22:54 +00:00
style: fix Prettier formatting in heritage-types, go config, and test file
Addresses CI format check failure: npx prettier --check flagged 3 files with code style issues. Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/ff7b0282-ec10-433d-8286-a47c152fa66c
This commit is contained in:
parent
5533254421
commit
e30f1a7fab
3 changed files with 13 additions and 40 deletions
|
|
@ -19,9 +19,6 @@ export const goHeritageConfig: HeritageExtractionConfig = {
|
|||
|
||||
shouldSkipExtends(extendsNode) {
|
||||
const fieldDecl = extendsNode.parent;
|
||||
return (
|
||||
fieldDecl?.type === 'field_declaration' &&
|
||||
fieldDecl.childForFieldName?.('name') != null
|
||||
);
|
||||
return fieldDecl?.type === 'field_declaration' && fieldDecl.childForFieldName?.('name') != null;
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -99,10 +99,6 @@ export interface HeritageExtractionConfig {
|
|||
*/
|
||||
callBasedHeritage?: {
|
||||
readonly callNames: ReadonlySet<string>;
|
||||
extract(
|
||||
calledName: string,
|
||||
callNode: SyntaxNode,
|
||||
filePath: string,
|
||||
): HeritageInfo[];
|
||||
extract(calledName: string, callNode: SyntaxNode, filePath: string): HeritageInfo[];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,10 +62,7 @@ function buildCaptureMap(entries: Record<string, MockNode | undefined>): Capture
|
|||
}
|
||||
|
||||
/** Default context for testing. */
|
||||
function ctx(
|
||||
filePath = 'Test.java',
|
||||
language = SupportedLanguages.Java,
|
||||
): HeritageExtractorContext {
|
||||
function ctx(filePath = 'Test.java', language = SupportedLanguages.Java): HeritageExtractorContext {
|
||||
return { filePath, language };
|
||||
}
|
||||
|
||||
|
|
@ -143,9 +140,7 @@ describe('HeritageExtractor.extract', () => {
|
|||
'heritage.extends': makeNode('Parent'),
|
||||
});
|
||||
const result = extractor.extract(captures, ctx());
|
||||
expect(result).toEqual([
|
||||
{ className: 'Child', parentName: 'Parent', kind: 'extends' },
|
||||
]);
|
||||
expect(result).toEqual([{ className: 'Child', parentName: 'Parent', kind: 'extends' }]);
|
||||
});
|
||||
|
||||
it('extracts implements heritage', () => {
|
||||
|
|
@ -166,9 +161,7 @@ describe('HeritageExtractor.extract', () => {
|
|||
'heritage.trait': makeNode('Display'),
|
||||
});
|
||||
const result = rustExtractor.extract(captures, ctx('main.rs', SupportedLanguages.Rust));
|
||||
expect(result).toEqual([
|
||||
{ className: 'MyStruct', parentName: 'Display', kind: 'trait-impl' },
|
||||
]);
|
||||
expect(result).toEqual([{ className: 'MyStruct', parentName: 'Display', kind: 'trait-impl' }]);
|
||||
});
|
||||
|
||||
it('extracts both extends and implements from same match', () => {
|
||||
|
|
@ -214,9 +207,7 @@ describe('Go HeritageExtractor — shouldSkipExtends', () => {
|
|||
'heritage.extends': typeNode as unknown as CaptureMap[string],
|
||||
});
|
||||
const result = extractor.extract(captures, ctx('main.go', SupportedLanguages.Go));
|
||||
expect(result).toEqual([
|
||||
{ className: 'Dog', parentName: 'Animal', kind: 'extends' },
|
||||
]);
|
||||
expect(result).toEqual([{ className: 'Dog', parentName: 'Animal', kind: 'extends' }]);
|
||||
});
|
||||
|
||||
it('skips named struct fields (Breed string)', () => {
|
||||
|
|
@ -237,9 +228,7 @@ describe('Go HeritageExtractor — shouldSkipExtends', () => {
|
|||
'heritage.extends': orphanNode as unknown as CaptureMap[string],
|
||||
});
|
||||
const result = extractor.extract(captures, ctx('main.go', SupportedLanguages.Go));
|
||||
expect(result).toEqual([
|
||||
{ className: 'Foo', parentName: 'Embedded', kind: 'extends' },
|
||||
]);
|
||||
expect(result).toEqual([{ className: 'Foo', parentName: 'Embedded', kind: 'extends' }]);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -268,8 +257,7 @@ describe('Ruby HeritageExtractor — call-based heritage', () => {
|
|||
type: enclosingType,
|
||||
text: '',
|
||||
parent: null,
|
||||
childForFieldName: (name: string) =>
|
||||
name === 'name' ? classNameNode : undefined,
|
||||
childForFieldName: (name: string) => (name === 'name' ? classNameNode : undefined),
|
||||
}
|
||||
: null;
|
||||
|
||||
|
|
@ -284,8 +272,7 @@ describe('Ruby HeritageExtractor — call-based heritage', () => {
|
|||
type: 'call',
|
||||
text: '',
|
||||
parent: bodyNode,
|
||||
childForFieldName: (name: string) =>
|
||||
name === 'arguments' ? argList : undefined,
|
||||
childForFieldName: (name: string) => (name === 'arguments' ? argList : undefined),
|
||||
};
|
||||
return callNode;
|
||||
}
|
||||
|
|
@ -308,9 +295,7 @@ describe('Ruby HeritageExtractor — call-based heritage', () => {
|
|||
it('extracts include heritage with single constant arg', () => {
|
||||
const callNode = makeCallNode([makeConstantArg('Serializable')], 'class', 'User');
|
||||
const result = extractor.extractFromCall!('include', callNode as any, rubyCtx);
|
||||
expect(result).toEqual([
|
||||
{ className: 'User', parentName: 'Serializable', kind: 'include' },
|
||||
]);
|
||||
expect(result).toEqual([{ className: 'User', parentName: 'Serializable', kind: 'include' }]);
|
||||
});
|
||||
|
||||
it('extracts extend heritage with scope_resolution arg', () => {
|
||||
|
|
@ -328,17 +313,13 @@ describe('Ruby HeritageExtractor — call-based heritage', () => {
|
|||
it('extracts prepend heritage', () => {
|
||||
const callNode = makeCallNode([makeConstantArg('Instrumented')], 'class', 'Service');
|
||||
const result = extractor.extractFromCall!('prepend', callNode as any, rubyCtx);
|
||||
expect(result).toEqual([
|
||||
{ className: 'Service', parentName: 'Instrumented', kind: 'prepend' },
|
||||
]);
|
||||
expect(result).toEqual([{ className: 'Service', parentName: 'Instrumented', kind: 'prepend' }]);
|
||||
});
|
||||
|
||||
it('extracts include inside a module', () => {
|
||||
const callNode = makeCallNode([makeConstantArg('Helpers')], 'module', 'AppHelper');
|
||||
const result = extractor.extractFromCall!('include', callNode as any, rubyCtx);
|
||||
expect(result).toEqual([
|
||||
{ className: 'AppHelper', parentName: 'Helpers', kind: 'include' },
|
||||
]);
|
||||
expect(result).toEqual([{ className: 'AppHelper', parentName: 'Helpers', kind: 'include' }]);
|
||||
});
|
||||
|
||||
it('extracts multiple constant args as separate heritage items', () => {
|
||||
|
|
@ -362,8 +343,7 @@ describe('Ruby HeritageExtractor — call-based heritage', () => {
|
|||
type: 'call',
|
||||
text: '',
|
||||
parent: null,
|
||||
childForFieldName: (name: string) =>
|
||||
name === 'arguments' ? argList : undefined,
|
||||
childForFieldName: (name: string) => (name === 'arguments' ? argList : undefined),
|
||||
};
|
||||
const result = extractor.extractFromCall!('include', callNode as any, rubyCtx);
|
||||
expect(result).toEqual([]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue