Search almost all ROS Code on Sourcegraph

I recently heard about Sourcegraph code search from a news story, and while that’s not a great introduction it does seem like a useful tool.

Github search is great for searching one repo, or searching all repos in an organization, but what if you want to search all ROS repos no matter what org they’re in? Sourcegraph lets you do that. I created some SearchContexts on the public instance that let you search almost all released ROS source code.


Query syntax reference: Search query syntax - Sourcegraph docs


These search the repos at the branch given in the source entry of each repository on rosdistro. Not every repository has a source entry, and those that do sometimes have the wrong branch. For example, a maintainer might release a package in ROS Iron from their main branch, but later create an iron branch and forget to update it. For repos that don’t have a source entry I made the SearchContexts search the latest release branch in the release repository for each released package.

A lot of repositories are not indexed on the public Sourcegraph instance, though the core ones mostly are. I don’t know how frequently these are reindexed.

  • ROS Noetic: 516 out of 754 repos are indexed
  • ROS Humble: 347 out of 519 repos are indexed
  • ROS Iron: 318 out of 446 repos are indexed
  • ROS Rolling: 309 out of 439 repos are indexed

These SearchContexts will need to be periodically updated as repos are added and updated in rosdistro. They reflect the repos and branches as of this morning, or of whenever I get around to updating them in the future.

I also have only been playing with these contexts today, so let me know if you find issues. I’ll do my best to fix them.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.