Commit Graph

22 Commits

Author SHA1 Message Date
d2d4c32d4d Extend & simplify the test for IsVendor (#45) 2021-04-22 22:24:27 +02:00
8ff885a3a8 implement IsGenerated helper to filter out generated files
Closes #17

Implements the IsGenerated helper function to filter out generated
files using the rules and matchers in:
- https://github.com/github/linguist/blob/master/lib/linguist/generated.rb

Since the vast majority of matchers have very different logic, it cannot
be autogenerated directly from linguist like other logics in enry, so it's
translated by hand.

There are three different types of matchers in this implementation:
- By extension, which mark as generated based only in the extension. These
  are the fastest matchers, so they're done first.
- By file name, which matches patterns against the filename. These
  are performed in second place. Unlike linguist, we try to use string
  functions instead of regexps as much as possible.
- Finally, the rest of the matchers, which go into the content and try
  to identify if they're generated or not based on the content. Unlike
  linguist, we try to only read the content we need and not split it
  all unless it's necessary and use byte functions instead of regexps
  as much as possible.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2020-05-28 08:55:13 +02:00
b851ee83ad IsTest function for top 10 languages 2020-04-06 16:23:48 +02:00
97a26011a9 Return group color if language has none 2020-03-31 09:30:27 +03:00
25b29ebdc4 Implement getting color code for languages
Signed-off-by: Lauris Bukšis-Haberkorns <lauris@nix.lv>
2019-07-19 23:59:46 +03:00
13d3d66d37 refactoring: remove un-used code, add go doc, fix ci (#199)
Refactoring, consisting of
 - remove unused method `isAuxiliaryLanguage` and `FileCountList`
   in order to reduce public API surfaces (go/java)
 - add GoDoc to public APIs
 - ci: java profile use latest go src
  It also now mimics https://docs.travis-ci.com/user/languages/go/#go-import-path
  for non-go build image, as code relies on internal imports.

TEST PLAN:
 - make test
2019-02-05 22:54:14 +01:00
ef50154395 Maintenance: batch of minor changes (#183)
* exclude build artifacts from git
* build: simplify building by using src-d/ci
* bench: simplify&fix shell runners
* build: simplify benchmarks* targets
* test: remove dependency on single test suite
* doc: rel image link + linguist cli difference highlight
* suggestions from code review
* bench: add fail fast to all shell runners

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2018-12-27 11:55:34 +01:00
66fda9af16 add TestGetMimeType
Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
2018-10-03 22:12:00 +03:00
f9c6cbabb1 add TestIsImage
Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
2018-10-03 22:12:00 +03:00
039c4b9628 add TestIsAuxiliaryLanguage
Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
2018-10-03 22:12:00 +03:00
887bc6a4be make IsDotFile do not treat '.' as true
Signed-off-by: Huitse Tai <geb.1989@gmail.com>
2017-10-18 12:18:52 +08:00
b84e338f9e cli: sort the results
Adds `FileCount` and `FileCountList` types for storing language file and
their count which can be sorted based on the value of count.

Signed-off-by: Sunny <me@darkowlzz.space>
2017-09-30 18:52:30 +05:30
8d91dc7be8 added benchmarks and scripts to run, parse and plot them
moved benchmark/run-slow-benchmarks.sh's content to Makefile
2017-07-13 08:21:09 +02:00
b7d4be5fdd commit against tests run is fixed
renamed tmpLinguist to repoLinguist and SimpleLinguistTestSuite to EnryTestSuit in common_test.go

changed receiver's name for TestSuites to 's'

fixed comments
2017-06-26 15:35:53 +02:00
beda5b73e7 changed signatures for strategies 2017-06-15 10:07:23 +02:00
ba53e10c7b renamed package and cli to enry 2017-06-13 14:18:23 +02:00
5b304524d1 Rearranged code 2017-06-02 09:33:55 +02:00
5d61ca93d8 changed langs.go to unmarshal on a languageInfo struct 2017-04-17 11:55:29 +02:00
ca3ae587f3 added documentation_matchers.go generation 2017-04-17 11:52:11 +02:00
ef19999fe8 removed vendorRegexp and benchmarks 2017-04-10 12:40:52 +02:00
5e13b984c9 changed TestIsVendor 2017-04-06 18:04:47 +02:00
bead3a606f tests 2016-07-13 22:21:18 +02:00