code-auditor-mcp
Version:
Multi-language code quality auditor with MCP server - Analyze TypeScript, JavaScript, and Go code for SOLID principles, DRY violations, security patterns, and more
69 lines • 2.72 kB
TypeScript
/**
* Functional utilities for analyzer development
* These replace the BaseAnalyzer class with composable functions
*/
import * as ts from 'typescript';
import { Violation, AnalyzerResult, SeverityLevel } from '../types.js';
export { parseTypeScriptFile } from '../utils/astParser.js';
export { getLineAndColumn, getNodeText, getImports, findNodesByKind } from '../utils/astUtils.js';
/**
* File analyzer function - processes a single file
*/
export type FileAnalyzerFunction = (filePath: string, sourceFile: ts.SourceFile, config: any) => Promise<Violation[]> | Violation[];
/**
* Progress reporter function
*/
export type ProgressReporter = (current: number, total: number, file: string) => void;
/**
* Standard file processing function
* Handles file reading, parsing, error handling, and progress reporting
*/
export declare function processFiles(files: string[], analyzeFile: FileAnalyzerFunction, analyzerName: string, config?: any, progressReporter?: ProgressReporter): Promise<AnalyzerResult>;
/**
* Create a violation object with defaults
*/
export declare function createViolation(data: Violation): Violation;
/**
* Get line and column from a TypeScript node
*/
export declare function getNodePosition(sourceFile: ts.SourceFile, node: ts.Node): {
line: number;
column: number;
};
/**
* Check if a node is exported
*/
export declare function isNodeExported(node: ts.Node): boolean;
/**
* Get the name of a node if it has one
*/
export declare function getNodeName(node: ts.Node): string | undefined;
/**
* Count specific node types in a subtree
*/
export declare function countNodesOfType<T extends ts.Node>(node: ts.Node, predicate: (node: ts.Node) => node is T): number;
/**
* Find all nodes of a specific type
*/
export declare function findNodesOfType<T extends ts.Node>(node: ts.Node, predicate: (node: ts.Node) => node is T): T[];
/**
* Traverse AST with a visitor function
*/
export declare function traverseAST(node: ts.Node, visitor: (node: ts.Node) => void): void;
/**
* Filter violations by severity
*/
export declare function filterViolationsBySeverity(violations: Violation[], minSeverity?: SeverityLevel): Violation[];
/**
* Sort violations by severity, file, and line
*/
export declare function sortViolations(violations: Violation[]): Violation[];
/**
* Calculate cyclomatic complexity of a function
*/
export declare function calculateComplexity(node: ts.FunctionLikeDeclaration): number;
/**
* Create a standard analyzer function
*/
export declare function createAnalyzer(name: string, fileAnalyzer: FileAnalyzerFunction, defaultConfig?: any): (files: any, config: any, options: any) => Promise<AnalyzerResult>;
//# sourceMappingURL=analyzerUtils.d.ts.map