sfcoe-ailabs
Version:
AI-powered code review tool with static analysis integration for comprehensive code quality assessment.
55 lines (54 loc) • 2.23 kB
TypeScript
import { TableEntry } from './index.js';
/**
* Utility class for analyzing code content and detecting patterns
*/
export declare class CodeAnalysisUtils {
/**
* Check if content contains any JavaScript anti-patterns
*
* @param fileName - The name of the file being analyzed
* @param content - The file content to analyze for JavaScript patterns
* @param addedEntries - Set of already processed entry keys to avoid duplicates
* @returns Array of table entries for JavaScript anti-patterns found
*/
static analyzeJavaScriptContent(fileName: string, content: string, addedEntries: Set<string>): TableEntry[];
/**
* Check if file uses old test framework patterns
*
* @param content - The file content to analyze
* @returns True if the file uses old test framework (no new framework patterns found)
*/
static hasOldTestFramework(content: string): boolean;
/**
* Check if content contains specific pattern
*
* @param content - The content to search in
* @param pattern - The pattern to search for
* @returns True if the pattern is found in the content
*/
static containsPattern(content: string, pattern: string): boolean;
/**
* Extract class name from file path or content
*
* @param filePath - The file path to extract class name from
* @returns The class name extracted from the file path (without extension)
*/
static extractClassName(filePath: string): string;
/**
* Check if file is a test file based on filename or content
*
* @param filePath - The file path to check
* @param content - Optional file content to check for test annotations
* @returns True if the file is identified as a test file
*/
static isTestFile(filePath: string, content?: string): boolean;
/**
* Create entry key for deduplication
*
* @param fileName - The name of the file
* @param ruleId - The rule identifier
* @param lineNumber - Optional line number where the issue occurs
* @returns A unique key string for deduplication purposes
*/
static createEntryKey(fileName: string, ruleId: string, lineNumber?: number): string;
}