Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ def search(self, query: str) -> tuple[bool, list[Document]]:
f"-------------------------------------------\n{function_method.page_content}\n"
logger.debug(content_of_files_in_path)
logger.debug(content_of_files_in_path, extra=MULTI_LINE_MESSAGE_TRUE)
return found_path, call_hierarchy_list
return found_path, call_hierarchy_list
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def set_input_for_next_run(git_repository: str, git_ref: str, included_extension


async def get_transitive_code_runner_function():
transitive_code_search = transitive_search(config=TransitiveCodeSearchToolConfig(), builder=None)
transitive_code_search = transitive_search(config=TransitiveCodeSearchToolConfig(), builder=None, verbose_mode=True)
async for function in transitive_code_search.gen:
return function.single_fn

Expand Down
14 changes: 12 additions & 2 deletions src/vuln_analysis/tools/transitive_code_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def get_transitive_code_searcher(query: str):

@register_function(config_type=TransitiveCodeSearchToolConfig, framework_wrappers=[LLMFrameworkEnum.LANGCHAIN])
async def transitive_search(config: TransitiveCodeSearchToolConfig,
builder: Builder): # pylint: disable=unused-argument
builder: Builder, verbose_mode: bool = False): # pylint: disable=unused-argument
"""
Call Chain Analyzer tool used to search source code function reachability.
"""
Expand All @@ -117,7 +117,17 @@ async def _arun(query: str) -> tuple:
transitive_code_searcher: TransitiveCodeSearcher
transitive_code_searcher = get_transitive_code_searcher(query)
result = transitive_code_searcher.search(query)
return result
(answer, docs) = result
call_hierarchy_list_strings: list
if verbose_mode:
return result
else:
call_hierarchy_list_strings = list(map(lambda doc:
transitive_code_searcher
.chain_of_calls_retriever
.language_parser.get_function_name(doc)
,docs))
return answer, call_hierarchy_list_strings

yield FunctionInfo.from_fn(
_arun,
Expand Down