ds-sfcoe-ailabs
Version:
AI-powered code review tool with static analysis integration for comprehensive code quality assessment.
46 lines (45 loc) • 1.66 kB
TypeScript
import { Log } from 'sarif';
import SCATProvider from './scatProvider.js';
/**
* Salesforce Code Analyzer implementation extending SCATProvider
* Provides Salesforce-specific static code analysis using the Salesforce CLI scanner
*/
export default class SFCodeAnalyzer extends SCATProvider {
/**
* Creates a new Salesforce Code Analyzer instance
*
* @param scanDirectory - The directory to scan for Salesforce code
* @param configFile - Optional configuration file path for the analyzer
* @throws Error if scanDirectory is invalid
* @example
* ```typescript
* const analyzer = new SFCodeAnalyzer('/path/to/salesforce/code', 'sf-config.yml');
* ```
*/
constructor(scanDirectory: string, configFile?: string);
/**
* Runs the Salesforce Code Analyzer on the specified directory
*
* @param scanDirectory - Optional override for the scan directory
* @returns Promise that resolves to the SARIF analysis results
* @throws Error if Salesforce Code Analyzer execution fails or SARIF file cannot be read
* @example
* ```typescript
* const results = await analyzer.run('/custom/scan/path');
* console.log(results.runs);
* ```
*/
run(scanDirectory?: string): Promise<Log>;
/**
* Ensures the log directory exists.
* Creates the directory if it doesn't exist.
*
* @returns Promise that resolves when directory is ensured to exist
* @throws Warning logged if directory creation fails
* @example
* ```typescript
* await this.ensureLogDirectoryExists();
* ```
*/
private ensureLogDirectoryExists;
}