Language Detection Functions now Available

AskGit now supports SQL functions for detecting languages and file types leveraging the open-source enry project

The enry project describes itself as a

Programming language detector and toolbox to ignore binary or vendored files. enry, started as a port to Go of the original Linguist Ruby library, that has an improved 2x performance.

The AskGit v0.4.1 release integrates enry capability as SQL scalar functions, so for example:

SELECT path, enry_detect_language(path, contents) AS lang FROM files

will list every file in a repo’s HEAD and report back the detected language (according to enry). You can find a full list of the implemented enry functionality in our README, copied in summary below:

  • enry_detect_language

  • enry_is_binary

  • enry_is_configuration

  • enry_is_documentation

  • enry_is_dot_file

  • enry_is_generated

  • enry_is_image

  • enry_is_test

  • enry_is_vendor

As usual, check out the demo site to try queries in your browser 🎉