sicua
Version:
A tool for analyzing project structure and dependencies
93 lines (92 loc) • 3.07 kB
TypeScript
import ts from "typescript";
import { FunctionClassification } from "../types/function.types";
import { ErrorHandler } from "./errorHandler";
/**
* Enhanced classifies functions based on their characteristics and usage patterns
*/
export declare class FunctionClassifier {
private errorHandler;
private typeChecker?;
constructor(errorHandler: ErrorHandler, typeChecker?: ts.TypeChecker);
/**
* Classifies a function node with enhanced error handling
* @param node The function node to classify
* @param filePath Optional file path for error context
* @param functionName Optional function name for error context
* @returns Function classification result
*/
classifyFunction(node: ts.Node, filePath?: string, functionName?: string): FunctionClassification;
/**
* Enhanced React component classification with better type checking
*/
private classifyReactComponent;
/**
* Type-aware React component classification
*/
private classifyReactComponentWithTypes;
/**
* Enhanced reducer/state management classification
*/
private classifyReducerOrStateManagement;
/**
* Checks for additional state management patterns
*/
private hasAdditionalStatePatterns;
/**
* Checks if node represents an action creator pattern
*/
private isActionCreatorPattern;
/**
* Checks if node represents a Zustand store pattern
*/
private isZustandStorePattern;
/**
* Checks if node represents a Context provider pattern
*/
private isContextProviderPattern;
/**
* Checks if node represents a state update pattern
*/
private isStateUpdatePattern;
/**
* Checks if return type is React-related
*/
private isReactReturnType;
/**
* Checks if function has React component naming pattern
*/
private hasReactComponentNamePattern;
/**
* Checks if function body contains JSX
*/
private hasJSXInBody;
/**
* Type guard for function-like nodes
*/
private isFunctionLikeNode;
/**
* Determines if a function should be included in the analysis
* based on its classification (enhanced version)
*/
shouldIncludeBasedOnClassification(classification: FunctionClassification, filePath?: string, functionName?: string): boolean;
/**
* Gets classification confidence score
*/
getClassificationConfidence(node: ts.Node, classification: FunctionClassification): number;
/**
* Checks for patterns that might be ambiguous
*/
private hasAmbiguousPatterns;
/**
* Helper to get function name from any function-like node
*/
private getFunctionName;
}
/**
* Backward compatibility function - creates a classifier and uses it
*/
export declare function classifyFunction(node: ts.Node): FunctionClassification;
/**
* Backward compatibility function for inclusion checking
*/
export declare function shouldIncludeBasedOnClassification(classification: FunctionClassification): boolean;