Commit Graph

16 Commits

Author SHA1 Message Date
Utsav Chokshi
4e3a49c565
Expose GetLanguageType (#2) 2022-03-02 10:32:57 +05:30
Utsav Chokshi
821f01cdde
Expose IsTest Method (#1) 2022-03-01 14:28:53 +05:30
Utsav Chokshi
81f5d81b7b
Correct Test cases 2022-02-18 15:33:15 +05:30
Miguel Molina
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
Lauris Bukšis-Haberkorns
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
Alexander
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
Alexander Bezzubov
5147de90b8
java: retrofit bindings for JNA generated from Cgo 1.10
Go 1.10 improved the way of passing strings between C and Go
with https://go-review.googlesource.com/c/go/+/70890

This change adapts API/helpers to a new convention,
without changing existing API surface and without benefiting
from a new way of passing strings.

Another, perferable on my readind of `go doc cgo`, but
more invasive approach would be to change ALL enry C API to
always return *C.char \w C.CString()

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2018-10-21 16:03:33 +02:00
Alfredo Beaumont
b268fad92d enry-java: Tentative fix for the enry crashes in enry-java.
Signed-off-by: Alfredo Beaumont <alfredo.beaumont@gmail.com>
2018-01-12 12:17:30 +01:00
Miguel Molina
9a36e8f398 enry-java: allow empty file contents
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-09-22 19:00:19 +03:00
Alexander Bezzubov
b020f78841
Add test for empty file content 2017-09-22 17:39:02 +02:00
Manuel Carmona
1d7b975743 fix getLanguage when arguments are null 2017-09-07 14:17:56 +02:00
Alexander Bezzubov
0a6ed07591 Convenience: Enry.unknownLanguage and Guess.toString/.equals/.hashCode 2017-08-11 15:29:18 +02:00
Miguel Molina
5bde175c91
add a test for getLanguageByFilename
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-11 12:27:51 +02:00
Miguel Molina
4da1c5605c
rename result and sure in Guess to language and safe
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-09 11:29:45 +02:00
Miguel Molina
2825eb22e6
get jnaerator from a jitpack jar
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-08 18:20:16 +02:00
Miguel Molina
d8fc4fe92f
java implementation of enry
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-08 18:01:54 +02:00