HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
github-linguist
linguist
Ruby2011–2026
github-linguist / linguist

linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!

79Distinct people
94Mentions
0Explicit recommenders
13.8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 8–Nov 15 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/15/2026, 3:30:57 AM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year94 dated mentions

Observed mentions: 2011-12-19 08:04:13 UTC to 2026-08-16 01:46:32 UTC.

051015202011-01-01 00:00:00 UTC to 2012-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20112012-01-01 00:00:00 UTC to 2013-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 8 mentions; 0 submissions, 8 comments2014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 20 mentions; 2 submissions, 18 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 9 mentions; 0 submissions, 9 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 6 mentions; 2 submissions, 4 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 6 mentions; 1 submissions, 5 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 7 mentions; 3 submissions, 4 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 7 mentions; 0 submissions, 7 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 7 mentions; 2 submissions, 5 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20112011-01-01 00:00:00 UTC2012-01-01 00:00:00 UTC101
20122012-01-01 00:00:00 UTC2013-01-01 00:00:00 UTC505
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC808
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC20218
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC909
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC202
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC615
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC303
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC624
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC615
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC734
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC707
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC101
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC725
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC514
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC101

From the project README

An excerpt from the repository, fetched Nov 13, 2026.

Read the project’s introduction
Linguist This library is used on GitHub.com to detect blob languages, ignore binary or vendored files, suppress generated files in diffs, and generate language breakdown graphs. Documentation How Linguist works Change Linguist's behaviour with overrides Troubleshooting Contributing guidelines Installation Install the gem: gem install github-linguist Dependencies Linguist is a Ruby library so you will need a recent version of Ruby installed. There are known problems with the macOS/Xcode supplied version of Ruby that causes problems installing some of the dependencies. Accordingly, we highly recommend you install a version of Ruby using Homebrew, rbenv, rvm, ruby-build, asdf or other packaging system, before attempting to install Linguist and the dependencies. Linguist uses charlock_holmes for character encoding and rugged for libgit2 bindings for Ruby. These components have their own dependencies. charlock_holmes cmake pkg-config ICU zlib rugged libcurl OpenSSL You may need to install missing dependencies before you can install Linguist. For example, on macOS with Homebrew: brew install cmake pkg-config icu4c On Ubuntu: sudo apt-get install build-essential cmake pkg-config libicu-dev zlib1g-dev libcurl4-openssl-dev libssl-dev ruby-dev Usage Application usage Linguist can be used in your application as follows: require 'rugged' require 'linguist' repo = Rugged::Repository.new('.') project = Linguist::Repository.new(repo, repo.head.target_id) project.language #=> "Ruby" project.languages #=> { "Ruby" => 119387 } Command line usage The github-linguist executable operates in two distinct modes: Git Repository mode - Analyzes an entire Git repository (when given a directory path or no path) Single file mode - Analyzes a specific file (when given a file path) Git Repository A repository's languages stats can be assessed from the command line using the github-linguist executable. Without any options, github-linguist will output the language breakdown by percentage and file size. cd /path-to-repository github-linguist You can try running github-linguist on the root directory in this repository itself: $ github-linguist 66.84% 264519 Ruby 24.68% 97685 C 6.57% 25999 Go 1.29% 5098 Lex 0.32% 1257 Shell 0.31% 1212 Dockerfile Additional options --rev REV The --rev REV flag will change the git revision being analyzed to any gitrevisions(1) compatible revision you specify. This is useful to analyze the makeup of a repo as of a certain tag, or in a certain branch. For example, here is the popular Jekyll open source project. $ github-linguist jekyll 70.64% 709959 Ruby 23.04% 231555 Gherkin 3.80% 38178 JavaScript 1.19% 11943 HTML 0.79% 7900 Shell 0.23% 2279 Dockerfile 0.13% 1344 Earthly 0.10% 1019 CSS 0.06% 606 SCSS 0.02% 234 CoffeeScript 0.01% 90 Hack And here is Jekyll's published website, from the gh-pages branch inside their repository. $ github-linguist jekyll --rev origin/gh-pages 100.00% 2568354 HTML --breakdown The --breakdown or -b flag will additionally show the breakdown of files by language. You can try running github-linguist on the root directory in this repository itself: $ github-linguist --breakdown 66.84% 264519 Ruby 24.68% 97685 C 6.57% 25999 Go 1.29% 5098 Lex 0.32% 1257 Shell 0.31% 1212 Dockerfile Ruby: Gemfile Rakefile bin/git-linguist bin/github-linguist ext/linguist/extconf.rb github-linguist.gemspec lib/linguist.rb … --strategies The --strategies or -s flag will show the language detection strategy used for each file. This is useful for understanding how Linguist determined the language of specific files. Note that unless the --json flag is specified, this flag will set the --breakdown flag implicitly. You can try running github-linguist on the root directory in this repository itself with the strategies flag: $ github-linguist --breakdown --strategies 66.84% 264519 Ruby 24.68% 97685 C 6.57% 25999 Go 1.29% 5098 Lex 0.32% 1257 Shell 0.31% 1212 Dockerfile Ruby: Gemfile [Filename] Rakefile [Filename] bin/git-linguist [Extension] bin/github-linguist [Extension] lib/linguist.rb [Extension] … If a file's language is affected by .gitattributes, the strategy will show the original detection method along with a note indicating whether the gitattributes setting changed the result or confirmed it. For instance, if you had the following .gitattributes overrides in your repo: *.ts linguist-language=JavaScript *.js linguist-language=JavaScript the output of Linguist would be something like this: 100.00% 217 JavaScript JavaScript: demo.ts [Heuristics (overridden by .gitattributes)] demo.js [Extension (confirmed by .gitattributes)] --json The --json or -j flag output the data into JSON format. $ github-linguist --json {"Dockerfile":{"size":1212,"percentage":"0.31"},"Ruby":{"size":264519,"percentage":"66.84"},"C":{"size":97685,"percentage":"24.68"},"Lex":{"size":5098,"percentage":"1.29"},"Shell":{"size":1257,"percentage":"0.32"},"Go":{"size":25999,"percentage":"6.57"}} This option can be used in conjunction with --breakdown to get a full list of files along with the size and percentage data. $ github-linguist --breakdown --json {"Dockerfile":{"size":1212,"percentage":"0.31","files":["Dockerfile","tools/grammars/Dockerfile"]},"Ruby":{"size":264519,"percentage":"66.84","files":["Gemfile","Rakefile","bin/git-linguist","bin/github-linguist","ext/linguist/extconf.rb","github-linguist.gemspec","lib/linguist.rb",...]}} NB. The --strategies flag has no effect, when the --json flag is present. Single file Alternatively you can find stats for a single file using the github-linguist executable. You can try running github-linguist on files in this repository itself: $ github-linguist grammars.yml grammars.yml: 884 lines (884 sloc) type: Text
Read the full README on GitHub

What Hacker News says

20 sources
We should not have to presume. Since Github is soliciting contributions to linguist [0], they've created an obligation to engage with outside contributors and explain their decisions. When the author wrote his blog post, there were over a hundred PRs and apparently no acknowledgement of many of them from Github. In his "How to destroy your community" talk [1], Josh Gruber refers to silence as "the most effective community destroyer of them all". I'm not actually trying to call out Github, by the way. It's great that they've written up guidelines for contributing [0], and a glance at the PRs shows much more engagement now. [0] https://github.com/github/linguist/blob/master/CONTRIBUTING.... [1] https://lwn.net/Articles/370157/
In Ignoring pull requests discourages open-source contributions
See github's bad language detection if I put jquery in git. Well, actually, no [0]. Just use the standard name and Linguist ignores it. But your larger point is still valid: popularity does not imply utility. Unless I'm assuming I'll use the exact same employees for both You really should be. If your devs only understand a siloed part of your codebase you're doing it wrong. that they only know JS and that they're so worthless they can't pick up a second language Holy private demons, Batman! I don't know how you've been hurt in the past but please don't bring it here. There are plenty of valid reasons to intentionally avoid introducing a second language on a project. In fact, I'd argue that the burden of proof is on showing why it's worth introducing the additional complexity. [0]: https://github.com/github/linguist/blob/master/lib/l
Read the rest
In Business Case for JavaScript and Node.js / JXcore
Github uses linguist to identify the codes programming language and unfortunately it's far from perfect - https://github.com/github/linguist There are known issues with distinguishing code between certain languages. For eg. There are issues between Perl & Prolog (and sometimes even Puppet). And up to very recently [1] most Rebol code was identified as R :) [1] That is until this patch was merged in (although the repos language stats only get updated after a new push happens) - https://github.com/github/linguist/pull/1005
In Programming Language Popularity on GitHub and Stack Overflow
Until December 2013, if you included non-minified Bootstrap Javascript files in your project, Linguist (the library Github uses to detect languages) would count them towards the Javascript LOC count for your project[0]. I had a number of small web server projects that were incorrectly classified as >95% Javascript for this reason. Fortunately this was fixed, but I imagine there are a number of other low-hanging fruit that are causing projects to be misclassified as well. [0] https://github.com/github/linguist/pull/856
In GitHub Language Trends
I'm looking at more of this, and jesus christ, this is completely wrong: https://github.com/github/linguist/blob/master/lib/linguist/... Code that commonly resides in .asp files is completely different from code that commonly resides in .aspx files. They are not synonyms for each other. Also, I would wager that C# aspx files are a tad more common than VB.NET aspx files. It's even worse than lumping together .c and .cpp. You at least have some chance of getting .c files to compile in a C++ compiler. There is no chance of running ASP code through the ASP.NET engine. This is why "ASPX" as a term exists, to differentiate from ASP.
In GitHub's language detection is broken
It's the other way around: the extension check is ran before the classifier. And given the limitations of file extensions, an extension collision is so likely of an occurrence (not most likely, but likely enough) as to not bother with primary_extension and just use the collection of extensions as a culling system to minimize the work for classification. In other words, it seems like the overall design wouldn't be hurt too much by just extricating primary_extension completely. Best-case scenario, primary_extension is equivalent to always having at least one item in extensions. It does nothing else. Also, this looks like a bug: "if possible_languages.length > 1 ... else possible_languages.first" What if length is 0? That's not greater than 1. I'm not familiar with Ruby, does first return null on an empty array, or does it error? LINQ in .NE
Read the rest
T has separate First<T> and FirstOrDefault<T> methods: one errors, the other returns default(T) (which is null in the case of reference types). Or is there a default match in the index that occurs when no other language is found? https://github.com/github/linguist/blob/master/lib/linguist/... Not instilling a lot of confidence that someone really thought through this bit of code. I'm not saying I very strictly think through everything I write, but I also don't write software for thousands of users, and I acknowledge that I've grown rather complacent in terms of time spent per unit code.
In GitHub's language detection is broken

Showing the 15 most recent of 20 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.