forked from go-enry/go-enry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rewrite GetLanguages to work like Linguist.detect
Prior to this change, GetLanguages collected all candidate languages from each strategy to pass to the next strategy (without de-duplicating them). Linguist only uses the previous strategy's candidates for the next strategy. Also, it would overwrite languages with nil if a strategy returned that, so you could get into a situation where you go from multiple languages to no language. See the Ruby code for details: https://github.com/github/linguist/blob/aad49acc0624c70d654a8dce447887dbbc713c7a/lib/linguist.rb#L14-L49 This addresses src-d/enry#207 because GetLanguages should not return all candidates detected, otherwise it would work differently than Linguist.
Showing
2 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters