Repository Code Analyzer¶
osa_tool.operations.analysis.repository_validation.code_analyzer
¶
CodeAnalyzer
¶
Analyzes code files in a repository using a language model.
This class handles the retrieval and processing of code files from a repository, including conversion of Jupyter notebooks to Python scripts, filtering ignored files, and sending code content to a model for analysis.
__init__(config_manager)
¶
Initialize the CodeAnalyzer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config_manager
|
ConfigManager
|
A unified configuration manager that provides task-specific LLM settings, repository information, and workflow preferences. |
required |
get_code_files()
¶
Retrieve a list of code files from the repository.
Converts Jupyter notebooks to Python scripts and filters out ignored files.
Returns:
| Type | Description |
|---|---|
Iterator[str]
|
list[str]: List of absolute paths to code files. |
process_code_files(code_files)
async
¶
Analyze the content of code files using the language model asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code_files
|
Iterable[str]
|
List of code file paths. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Aggregated analysis results for all code files. |