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>
A PoC that exposes single function
`enry.language_by_extension()` and a small
number of helpers to deal with string
coversion between Go<->C<->Python.
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
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
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>
Otherwise JNAetor enry.jar binding generation on
CI using `make all` results in
```
/home/travis/build/bzz/enry/java/shared/libenry.h:8:0:
error: File not found: stddef.h in
. /usr/include /usr/local/include /usr/include/c++/4.8.4 /usr/include/c++/4.8.4/tr1
```
Signed-off-by: Alexander Bezzubov <bzz@apache.org>