Skip to content
This repository has been archived by the owner on May 11, 2020. It is now read-only.

Change URL #2

Merged
merged 1 commit into from
Mar 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.linguist
.linguist*
benchmarks/output
.ci
Makefile.main
Expand All @@ -9,3 +9,4 @@ build/
vendor/
java/lib/
.vscode/
.venv
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ jobs:
- sudo apt-get install -y --no-install-recommends clang g++ gcc gcc-multilib libc6-dev libc6-dev-i386 mingw-w64 patch xz-utils
- cd ${HOME}
- curl -sfSL ${OSXCROSS_URL} | tar -C ${HOME} -xzf -
- cd $GOPATH/src/github.com/src-d/enry
- cd $GOPATH/src/github.com/bzz/enry
script: make darwin-shared
deploy:
provider: releases
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# enry [![GoDoc](https://godoc.org/github.com/src-d/enry?status.svg)](https://godoc.org/github.com/src-d/enry) [![Build Status](https://travis-ci.com/src-d/enry.svg?branch=master)](https://travis-ci.com/src-d/enry) [![codecov](https://codecov.io/gh/src-d/enry/branch/master/graph/badge.svg)](https://codecov.io/gh/src-d/enry)
# enry [![GoDoc](https://godoc.org/github.com/bzz/enry?status.svg)](https://godoc.org/github.com/bzz/enry) [![Build Status](https://travis-ci.org/bzz/enry.svg?branch=master)](https://travis-ci.org/bzz/enry) [![codecov](https://codecov.io/gh/bzz/enry/branch/master/graph/badge.svg)](https://codecov.io/gh/bzz/enry)

Programming language detector and toolbox to ignore binary or vendored files. *enry*, started as a port to _Go_ of the original [linguist](https://github.com/github/linguist) _Ruby_ library, that has an improved *2x performance*.

Expand All @@ -18,10 +18,10 @@ Programming language detector and toolbox to ignore binary or vendored files. *e
# CLI

The recommended way to install the `enry` command-line tool is to either
[download a release](https://github.com/src-d/enry/releases) or run:
[download a release](https://github.com/bzz/enry/releases) or run:

```
(cd "$(mktemp -d)" && go mod init enry && go get github.com/src-d/enry/v2/cmd/enry)
(cd "$(mktemp -d)" && go mod init enry && go get github.com/bzz/enry/v2/cmd/enry)
```

*enry* CLI accepts similar flags (`--breakdown/--json`) and produce an output, similar to *linguist*:
Expand Down Expand Up @@ -50,15 +50,15 @@ In a [Go module](https://github.com/golang/go/wiki/Modules),
import `enry` to the module by running:

```go
go get github.com/src-d/enry/v2
go get github.com/bzz/enry/v2
```

The rest of the examples will assume you have either done this or fetched the
library into your `GOPATH`.

```go
// The examples here and below assume you have imported the library.
import "github.com/src-d/enry/v2"
import "github.com/bzz/enry/v2"

lang, safe := enry.GetLanguageByExtension("foo.go")
fmt.Println(lang, safe)
Expand Down Expand Up @@ -94,7 +94,7 @@ langs := enry.GetLanguagesByFilename("Gemfile", []byte("<content>"), []string{})

## Java bindings

Generated Java bindings using a C shared library and JNI are available under [`java`](https://github.com/src-d/enry/blob/master/java).
Generated Java bindings using a C shared library and JNI are available under [`java`](https://github.com/bzz/enry/blob/master/java).

A library is published on Maven as [tech.sourced:enry-java](https://mvnrepository.com/artifact/tech.sourced/enry-java) for macOS and linux platforms. Windows support is planned under [src-d/enry#150](https://github.com/src-d/enry/issues/150).

Expand Down Expand Up @@ -182,7 +182,7 @@ $ git clone https://github.com/github/linguist.git .linguist
$ cd .linguist; git checkout <release-tag>; cd ..

# put the new release's commit sha in the generator_test.go (to re-generate .gold test fixtures)
# https://github.com/src-d/enry/blob/13d3d66d37a87f23a013246a1b0678c9ee3d524b/internal/code-generator/generator/generator_test.go#L18
# https://github.com/bzz/enry/blob/13d3d66d37a87f23a013246a1b0678c9ee3d524b/internal/code-generator/generator/generator_test.go#L18

$ make code-generate
```
Expand All @@ -197,7 +197,7 @@ To stay in sync, enry needs to be updated when a new release of the linguist inc
There is no automation for detecting the changes in the linguist project, so this process above has to be done manually from time to time.

When submitting a pull request syncing up to a new release, please make sure it only contains the changes in
the generated files (in [data](https://github.com/src-d/enry/blob/master/data) subdirectory).
the generated files (in [data](https://github.com/bzz/enry/blob/master/data) subdirectory).

Separating all the necessary "manual" code changes to a different PR that includes some background description and an update to the documentation on ["divergences from linguist"](##divergences-from-linguist) is very much appreciated as it simplifies the maintenance (review/release notes/etc).

Expand All @@ -210,7 +210,7 @@ Separating all the necessary "manual" code changes to a different PR that includ

### Benchmark

All benchmark scripts are in [*benchmarks*](https://github.com/src-d/enry/blob/master/benchmarks) directory.
All benchmark scripts are in [*benchmarks*](https://github.com/bzz/enry/blob/master/benchmarks) directory.


#### Dependencies
Expand Down
2 changes: 1 addition & 1 deletion benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"path/filepath"
"testing"

"github.com/src-d/enry/v2/data"
"github.com/bzz/enry/v2/data"
)

type sample struct {
Expand Down
2 changes: 1 addition & 1 deletion classifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"math"
"sort"

"github.com/src-d/enry/v2/internal/tokenizer"
"github.com/bzz/enry/v2/internal/tokenizer"
)

// classifier is the interface in charge to detect the possible languages of the given content based on a set of
Expand Down
4 changes: 2 additions & 2 deletions cmd/enry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"sort"
"strings"

"github.com/src-d/enry/v2"
"github.com/src-d/enry/v2/data"
"github.com/bzz/enry/v2"
"github.com/bzz/enry/v2/data"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"path/filepath"
"strings"

"github.com/src-d/enry/v2/data"
"github.com/src-d/enry/v2/regex"
"github.com/bzz/enry/v2/data"
"github.com/bzz/enry/v2/regex"
)

// OtherLanguage is used as a zero value when a function can not return a specific language.
Expand Down
2 changes: 1 addition & 1 deletion common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"path/filepath"
"testing"

"github.com/src-d/enry/v2/data"
"github.com/bzz/enry/v2/data"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down
2 changes: 1 addition & 1 deletion data/alias.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/colors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/commit.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions data/content.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/documentation.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/extension.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/filename.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/frequencies.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
2 changes: 1 addition & 1 deletion data/heuristics.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package data

import "github.com/src-d/enry/v2/data/rule"
import "github.com/bzz/enry/v2/data/rule"

// Heuristics implements a rule-based content matching engine.

Expand Down
2 changes: 1 addition & 1 deletion data/heuristics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"regexp"
"testing"

"github.com/src-d/enry/v2/data/rule"
"github.com/bzz/enry/v2/data/rule"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion data/interpreter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/mimeType.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/type.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data/vendor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion enry.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
Upstream Linguist YAML files are used to generate datastructures for data
package.
*/
package enry // import "github.com/src-d/enry/v2"
package enry // import "github.com/bzz/enry/v2"

//go:generate make code-generate
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/src-d/enry/v2
module github.com/bzz/enry/v2

go 1.12

Expand Down
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/src-d/go-oniguruma v1.1.0 h1:EG+Nm5n2JqWUaCjtM0NtutPxU7ZN5Tp50GWrrV8bTww=
github.com/src-d/go-oniguruma v1.1.0/go.mod h1:chVbff8kcVtmrhxtZ3yBVLLquXbzCS6DrxQaAK/CeqM=
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/assets/content.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package data
import (
"regexp"

"github.com/src-d/enry/v2/data/rule"
"github.com/bzz/enry/v2/data/rule"
)

var ContentHeuristics = map[string]*Heuristics{
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/assets/header.go.tmpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: {{ getCommit }}

2 changes: 1 addition & 1 deletion internal/code-generator/generator/samplesfreq.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"strconv"
"text/template"

"github.com/src-d/enry/v2/internal/tokenizer"
"github.com/bzz/enry/v2/internal/tokenizer"
)

type samplesFrequencies struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/generator/test_files/alias.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/generator/test_files/colors.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/generator/test_files/commit.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
4 changes: 2 additions & 2 deletions internal/code-generator/generator/test_files/content.gold
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data

import (
"regexp"

"github.com/src-d/enry/v2/data/rule"
"github.com/bzz/enry/v2/data/rule"
)

var ContentHeuristics = map[string]*Heuristics{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/generator/test_files/filename.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/generator/test_files/mimeType.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/generator/test_files/type.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/generator/test_files/vendor.gold
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Code generated by github.com/src-d/enry/v2/internal/code-generator DO NOT EDIT.
// Code generated by github.com/bzz/enry/v2/internal/code-generator DO NOT EDIT.
// Extracted from github/linguist commit: 3a1bd3c3d3e741a8aaec4704f782e06f5cd2a00d

package data
Expand Down
2 changes: 1 addition & 1 deletion internal/code-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"io/ioutil"
"log"

"github.com/src-d/enry/v2/internal/code-generator/generator"
"github.com/bzz/enry/v2/internal/code-generator/generator"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion internal/tokenizer/tokenize.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package tokenizer
import (
"bytes"

"github.com/src-d/enry/v2/regex"
"github.com/bzz/enry/v2/regex"
)

// Tokenize returns lexical tokens from content. The tokens returned match what
Expand Down
2 changes: 1 addition & 1 deletion internal/tokenizer/tokenize_c.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package tokenizer

import "github.com/src-d/enry/v2/internal/tokenizer/flex"
import "github.com/bzz/enry/v2/internal/tokenizer/flex"

// Tokenize returns lexical tokens from content. The tokens returned match what
// the Linguist library returns. At most the first ByteLimit bytes of content are tokenized.
Expand Down
Loading