Sourcegraph Powers Up Your Code Repository
Written by Nikos Vaggalis   
Wednesday, 17 October 2018

Sourcegraph is a code navigation engine that non-destructively rearranges your repository's structure to organize it, as well as powering it up with code intelligence and advanced search capabilities.

Best of all Sourcegraph has just gone open source which means that you can deploy it on your own servers to power up your private repositories.

With Docker already set up, deployment is as easy as :

docker run
--publish 7080:7080 --rm
--volume ~/.sourcegraph/config:/etc/sourcegraph
--volume ~/.sourcegraph/data:/var/opt/sourcegraph
--volume /var/run/docker.sock:/var/run/docker.sock sourcegraph/server:2.11.2

making Sourcegraph accessible by default at http://localhost:7080

The next step is to configure it to point at your repositories. IOn addition to Github, Sourcegraph supports repositories from other popular code hosts such as Gitlab, Bitbucket, AWS CodeCommit or even those already cloned to disk.

As for repositories available on the public web, powering them up doesn't require much more than having to install the Sourcegraph bookmarklet/browser plugin available for Chrome and Firefox, which when clicked transforms the UI in a snap. Alternatively, you can get the same functionality by appending your repo's path to https://sourcegraph.com/github.com/, for example turning
https://github.com/PerlDancer/Dancer2

into 

https://sourcegraph.com/github.com/PerlDancer/Dancer2

The magic here is that either by the bookmarklet or by the special Sourcegraph url, the scheme works for all repo's big and small, even for my own little personal one:

https://sourcegraph.com/github.com/nikosvaggalis/Udacity-Advanced-Developer-Nanodegree-Baking-App-2017

Code intelligence
Just like Android Studio, say, you can find the definitions, implementations and references to functions, hover tooltips that reveal documentation and type signatures, and search by symbol, an action that brings up a left-side menu alike JetBrains Dotpeek's de-obfuscator bearing all classes, interfaces, methods and such comprising the entire application.Code intelligence is however enabled only for the languages supported which are :
Go, Javascript, Typescript, Python, Java, PHP, Swift and experimentally Bash, Clojure, C++, C#, CSS, Dockerfile, Elixir, HTML, Lua, OCaml, R, Ruby, and Rust.

Repos in languages not supported

can still take advantage of the code organizing, symbols tab, and the advanced Code search capabilities, which include:

  • type:diff to check how your codebase has changed over time

  • type:commit to search in commit messages as in looking for a commit with the keyword "hook" inside
    repo:^github\.com/PerlDancer/Dancer2$ type:commit hook

  • type:symbol to filter to search for symbol results

which support the use of regular expressions and exact queries for full-text searches.

sourcegraphsq

 

More Information

Sourcegraph 

Related Articles

Insight.io - Code Intelligence on GitHub

Grimoire Lab-GitHub - Stats On Steroids

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Advent Of Code 2024 Now Underway
01/12/2024

December 1st is much anticipated among those who like programming puzzles. It is time to start solving small but tricky puzzles on the Advent of Code website with the goal of amassing 50 stars by Chri [ ... ]



Amazon Adds Agents To Q Developer
05/12/2024

Amazon has announced enhancements to Amazon Q Developer, including agents that automate unit testing, documentation generation, code reviews, and a capability to help users "address operational issues [ ... ]


More News

 

espbook

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Wednesday, 17 October 2018 )