Sourcegraph is a code search and intelligence tool for developers. It lets you search and explore all of your organization's code on the web, with integrations into your existing tools. See the Sourcegraph overview for more general information.
Let's take a tour around Sourcegraph to see how it helps with common developer tasks.
As a developer who is reviewing a pull request or diff, I need to understand the changed code to see whether it'll have unexpected negative impacts or if there are other necessary changes that were accidentally omitted.
Using Sourcegraph makes you a more effective code reviewer because code intelligence makes it much easier to drill down into the implementation (to verify correctness of the change) and enumerate call sites (to verify completeness of the change).
Requirements:
Workflow:
To try this on an open-source pull request, install the browser extension and visit gorilla/websocket#342. Use Find references to see all of the cases in which the newly added AllowClientContextTakeover
is used.
As a developer who's adding a new feature, I need to know how I should call a particular function.
Viewing cross-references (internal and external) on Sourcegraph is a great way to learn how to use a function or library, because it shows you how it's actually being used, not just what the (possibly outdated or incomplete) documentation might suggest.
Requirements:
Workflow:
To try this on an open-source repository, start by searching for repo:dgrijalva/jwt-go parsewithclaims and follow the steps above to view internal and external references for the ParseWithClaims
function.
As a new developer on a project, I need to understand the implementation details of a certain part of the code.
Navigating your code with code intelligence on Sourcegraph is a great way to understand code better, because it works across all of your repositories (and all versions) without additional configuration, and it lets you share links with teammates if you need to ask specific questions about pieces of code.
Requirements:
Workflow:
To try this on an open-source repository, start by searching for repo:Microsoft/node-jsonc-parser getLocation and follow the steps above to navigate to the implementation of the getLocation
function. From there, keep drilling down until you get to the createScanner
function.
As a developer responsible for a service that's running in production, I need to respond to a crash report with a stack trace by quickly identifying and fixing the problem.
Diff search on Sourcegraph is a great starting point for your investigation into what broke, because it shows you all recent changes that match your query.
Requirements:
Workflow:
type:diff myCrashingFunctionName
. If you've installed any integrations, use those to initiate the search; otherwise use the search box on the homepage of your organization's internal Sourcegraph instance.