* Analyze a file using the best available analyzer
(
filePath: string,
content: string,
options?: AnalyzerSelectionOptions
)
| 104 | * Analyze a file using the best available analyzer |
| 105 | */ |
| 106 | async analyzeFile( |
| 107 | filePath: string, |
| 108 | content: string, |
| 109 | options?: AnalyzerSelectionOptions |
| 110 | ): Promise<AnalysisResult | null> { |
| 111 | const analyzer = this.findAnalyzer(filePath, content, options); |
| 112 | |
| 113 | if (!analyzer) { |
| 114 | if (process.env.CODEBASE_CONTEXT_DEBUG) { |
| 115 | console.error(`[DEBUG] No analyzer found for file: ${filePath}`); |
| 116 | } |
| 117 | return null; |
| 118 | } |
| 119 | |
| 120 | try { |
| 121 | return await analyzer.analyze(filePath, content); |
| 122 | } catch (error) { |
| 123 | console.error(`Error analyzing ${filePath} with ${analyzer.name}:`, error); |
| 124 | return null; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Get analyzer statistics |
no test coverage detected