Sourcegraph is a code search and code intelligence tool that semantically indexes and analyzes large codebases so that they can be searched across commercial, open-source, local, and cloud-based repositories. Sourcegraph supports all major programming languages.

History

Sourcegraph was developed by Stanford graduates Quinn Slack and Beyang Liu and was first released in 2013. Partly inspired by Liu's experience using Google Code Search while he was a Google intern, Sourcegraph was designed to "tackle the big code problem" by enabling developers to manage large codebases that span multiple repositories, programming languages, file formats, and projects.

Sourcegraph

Sourcegraph can be used to search and analyze all of an organization's code. During search indexing, the platform builds a global reference graph, that maps an entire codebase and enables functionality such as "go to definition".

Sourcegraph

Sourcegraph software was initially self-hosted by each customer on their own infrastructure. Early customers included Uber, Dropbox, and Lyft.

Sourcegraph

In 2016, Sourcegraph was criticized for being provided with a Fair Source License with the developers explaining that "all of Sourcegraph’s source code is publicly available and hackable" and was intended to "help open sourcers strike a balance between getting paid and preserving their values". In 2018, Sourcegraph was licensed under the Apache License 2.0, and Sourcegraph OSS has since been released under the Apache License 2.0. The commercial version, Sourcegraph Enterprise, has been released under its own license. In 2023, Sourcegraph was criticized for dropping the Apache license for most of its code, leaving it public but only available under its Enterprise license.

In 2019, Sourcegraph was integrated into the GitLab codebase, giving GitLab users access to a browser-based developer platform.

In 2021, a browser-based portal became available, allowing users to browse open-source projects and personal private code for free. In 2022, Sourcegraph Cloud, a commercial single-tenant cloud solution for organizations with more than 100 developers, was launched.

Applications

In research, Sourcegraph has been used to develop data mining methods for downstream dependencies and to assist in refactoring and translating a program into its equivalent in another programming language.

Sourcegraph is used in the CERN Accelerator Control software community to index, quickly search, and generate statistics on code.

In cybersecurity, Sourcegraph has been used to gain better insight into source code during penetration testing.

As of July 2021, Sourcegraph customers include Adidas, Lyft, Uber, Yelp, Plaid, GE, Atlassian, Amazon, PayPal, Qualtrics, and Cloudflare.

Core features

Code can be searched and navigated through the Sourcegraph web interface or through browser and IDE extensions and text editor plugins. Sourcegraph supports over 30 programming languages and integrates with GitHub and GitLab for code hosting, Codecov for code coverage, and Jira Software for project management.

Code Search

Sourcegraph's "universal code search" tool is used to search, explore, and understand code. The search can be implemented across multiple repositories and code hosting platforms. Searches can be literal, regular expression, or structural. The structural search syntax is language-aware and handles nested expressions and multi-line statements better than regular expressions. Sourcegraph's Code Search uses a variant of Google's PageRank algorithm to rank results by relevance.

Code Navigation

Sourcegraph's Code Navigation feature can be used to jump to the definition of a variable or function, or find all references to it in a codebase.

Batch Changes

Sourcegraph's Batch Changes feature enables developers and companies to automate and track large-scale code refactoring, security fixes, and migrations across repositories and code hosts.

Code Insights

Sourcegraph's Code Insights feature extracts data from a codebase to provide detailed analytics and visualizations to track the health and progress of a code project.

Ownership

The software is developed by a company of the same name and has raised a total of nearly $225 million in funding to date.

See also

SaaS

Code review software

References

Database management systems

Code search engines