How to use the similar code tool
Manual usage
Comment on the PR:
COMPONENT_NAME is the name of a code component in the PR (class, method, function).
You can set a specific class or file where the component will be taken from:
analyze tool. On a PR, comment:
similar checkbox.


Search results
Each search result includes:extracted keywords: Keywords identified in your code. Clicking the link to view the keywords and adjust the search if needed.search context: The context in which the tool looks for similar code, either inside your organization’s repositories or across public open-source projects (Global).similar code: Matching code snippets found in the selected search context. Click the link to open the code component in the relevant file.relevant repositories: Open-source repos that contain code related to your component and its keywords.
Configuration options
Configure thesimilar code tool by setting configurations under the pr_find_similar_component part in your configuration file.
| Possible configurations | Default value | What they do |
|---|---|---|
search_from_org | false | If set to true, the tool will search for similar code in the organization’s codebase |
number_of_keywords | 5 | Number of keywords to use for the search. |
number_of_results | 5 | The maximum number of results to present |
Example usage
Global Search for a method calledchat_completion:


