mirror of
https://github.com/ralsina/tartrazine.git
synced 2024-11-12 22:42:23 +00:00
Merge branch 'master' into spelling
This commit is contained in:
commit
2059129b5e
8
.github/workflows/goTest.yml
vendored
8
.github/workflows/goTest.yml
vendored
@ -4,12 +4,12 @@ jobs:
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.16.x, 1.17.x]
|
||||
go-version: [1.18.x, 1.19.x]
|
||||
platform: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Set git on win to use LF
|
||||
@ -26,7 +26,7 @@ jobs:
|
||||
test-oniguruma:
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: [1.16.x, 1.17.x]
|
||||
go-version: [1.18.x, 1.19.x]
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ONIGURUMA_VERSION: 6.9.4
|
||||
@ -39,7 +39,7 @@ jobs:
|
||||
sudo dpkg -i "libonig-dev_${ONIGURUMA_VERSION}-1_amd64.deb"
|
||||
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v1
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
|
2
.github/workflows/pyTest.yml
vendored
2
.github/workflows/pyTest.yml
vendored
@ -4,7 +4,7 @@ jobs:
|
||||
test:
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8]
|
||||
python-version: [3.7, 3.8, 3.9]
|
||||
platform: [ubuntu-latest, macos-latest]
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
|
14
README.md
14
README.md
@ -61,7 +61,7 @@ To make a guess only based on the content of the file or a text snippet, use
|
||||
|
||||
### By file
|
||||
|
||||
The most accurate guess would be one when both, the file name and the content are available:
|
||||
The most accurate guess would be when both, a file name and it's content are available:
|
||||
|
||||
- `GetLanguagesByContent` only uses file extension and a set of regexp-based content heuristics.
|
||||
- `GetLanguages` uses the full set of matching strategies and is expected to be most accurate.
|
||||
@ -156,7 +156,7 @@ Generated Rust bindings using a C static library are available at https://github
|
||||
|
||||
## Divergences from Linguist
|
||||
|
||||
The `enry` library is based on the data from `github/linguist` version **v7.20.0**.
|
||||
The `enry` library is based on the data from `github/linguist` version **v7.21.0**.
|
||||
|
||||
Parsing [linguist/samples](https://github.com/github/linguist/tree/master/samples) the following `enry` results are different from the Linguist:
|
||||
|
||||
@ -212,8 +212,8 @@ To run the tests use:
|
||||
|
||||
go test ./...
|
||||
|
||||
Setting `ENRY_TEST_REPO` to the path to existing checkout of Linguist will avoid cloning it and sepeed tests up.
|
||||
Setting `ENRY_DEBUG=1` will provide insight in the Bayesian classifier building done by `make code-generate`.
|
||||
Setting `ENRY_TEST_REPO` to a path to the existing checkout of the Linguist will avoid cloning it and speeds tests up.
|
||||
Setting `ENRY_DEBUG=1` will provide insight into the Bayesian classifier built during `make code-generate`.
|
||||
|
||||
### Sync with github/linguist upstream
|
||||
|
||||
@ -237,12 +237,12 @@ To stay in sync, enry needs to be updated when a new release of the linguist inc
|
||||
- [vendor.yml](https://github.com/github/linguist/blob/master/lib/linguist/vendor.yml)
|
||||
- [documentation.yml](https://github.com/github/linguist/blob/master/lib/linguist/documentation.yml)
|
||||
|
||||
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.
|
||||
There now is automation for detecting the changes in the upstream Linguist project: every day Github CI runs [a job](.github/workflows/sync-linguist.yml) that will create a PR to this repo for each new Linguist release. It will include all the steps from the above.
|
||||
|
||||
When submitting a pull request syncing up to a new release, please make sure it only contains the changes in
|
||||
When submitting a pull request syncing up to a new release manually, please make sure it only contains the changes in
|
||||
the generated files (in [data](https://github.com/go-enry/go-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).
|
||||
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 encouraged and very much appreciated, as it simplifies the maintenance (review/release notes/etc).
|
||||
|
||||
## Misc
|
||||
|
||||
|
@ -6,11 +6,8 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/go-enry/go-enry/v2/data"
|
||||
)
|
||||
|
||||
type sample struct {
|
||||
@ -23,22 +20,21 @@ var (
|
||||
overcomeLanguage string
|
||||
overcomeLanguages []string
|
||||
samples []*sample
|
||||
samplesDir string
|
||||
cloned bool
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
flag.BoolVar(&slow, "slow", false, "run benchmarks per sample for strategies too")
|
||||
flag.Parse()
|
||||
|
||||
if err := cloneLinguist(linguistURL); err != nil {
|
||||
tmpLinguistDir, cleanupNeeded, err := maybeCloneLinguist()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if cloned {
|
||||
defer os.RemoveAll(filepath.Dir(samplesDir))
|
||||
if cleanupNeeded {
|
||||
defer os.RemoveAll(tmpLinguistDir)
|
||||
}
|
||||
|
||||
var err error
|
||||
samplesDir := filepath.Join(tmpLinguistDir, "samples")
|
||||
samples, err = getSamples(samplesDir)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@ -47,47 +43,6 @@ func TestMain(m *testing.M) {
|
||||
os.Exit(m.Run())
|
||||
}
|
||||
|
||||
func cloneLinguist(linguistURL string) error {
|
||||
repoLinguist := os.Getenv(linguistClonedEnvVar)
|
||||
cloned = repoLinguist == ""
|
||||
if cloned {
|
||||
var err error
|
||||
repoLinguist, err = ioutil.TempDir("", "linguist-")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
samplesDir = filepath.Join(repoLinguist, "samples")
|
||||
|
||||
if cloned {
|
||||
cmd := exec.Command("git", "clone", linguistURL, repoLinguist)
|
||||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = os.Chdir(repoLinguist); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd := exec.Command("git", "checkout", data.LinguistCommit)
|
||||
if err := cmd.Run(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err = os.Chdir(cwd); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func getSamples(dir string) ([]*sample, error) {
|
||||
samples := make([]*sample, 0, 2000)
|
||||
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
|
||||
|
48
common.go
48
common.go
@ -38,7 +38,7 @@ var defaultClassifier classifier = &naiveBayes{
|
||||
}
|
||||
|
||||
// GetLanguage applies a sequence of strategies based on the given filename and content
|
||||
// to find out the most probably language to return.
|
||||
// to find out the most probable language to return.
|
||||
func GetLanguage(filename string, content []byte) (language string) {
|
||||
languages := GetLanguages(filename, content)
|
||||
return firstLanguage(languages)
|
||||
@ -508,28 +508,6 @@ func GetLanguageExtensions(language string) []string {
|
||||
return data.ExtensionsByLanguage[language]
|
||||
}
|
||||
|
||||
// GetLanguageID returns the ID for the language. IDs are assigned by GitHub.
|
||||
// The input must be the canonical language name. Aliases are not supported.
|
||||
//
|
||||
// NOTE: The zero value (0) is a valid language ID, so this API mimics the Go
|
||||
// map API. Use the second return value to check if the language was found.
|
||||
func GetLanguageID(language string) (int, bool) {
|
||||
id, ok := data.IDByLanguage[language]
|
||||
return id, ok
|
||||
}
|
||||
|
||||
// Type represent language's type. Either data, programming, markup, prose, or unknown.
|
||||
type Type int
|
||||
|
||||
// Type's values.
|
||||
const (
|
||||
Unknown Type = Type(data.TypeUnknown)
|
||||
Data = Type(data.TypeData)
|
||||
Programming = Type(data.TypeProgramming)
|
||||
Markup = Type(data.TypeMarkup)
|
||||
Prose = Type(data.TypeProse)
|
||||
)
|
||||
|
||||
// GetLanguageType returns the type of the given language.
|
||||
func GetLanguageType(language string) (langType Type) {
|
||||
intType, ok := data.LanguagesType[language]
|
||||
@ -540,6 +518,15 @@ func GetLanguageType(language string) (langType Type) {
|
||||
return langType
|
||||
}
|
||||
|
||||
// GetLanguageGroup returns language group or empty string if language does not have group.
|
||||
func GetLanguageGroup(language string) string {
|
||||
if group, ok := data.LanguagesGroup[language]; ok {
|
||||
return group
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetLanguageByAlias returns either the language related to the given alias and ok set to true
|
||||
// or Otherlanguage and ok set to false if the alias is not recognized.
|
||||
func GetLanguageByAlias(alias string) (lang string, ok bool) {
|
||||
@ -551,13 +538,14 @@ func GetLanguageByAlias(alias string) (lang string, ok bool) {
|
||||
return
|
||||
}
|
||||
|
||||
// GetLanguageGroup returns language group or empty string if language does not have group.
|
||||
func GetLanguageGroup(language string) string {
|
||||
if group, ok := data.LanguagesGroup[language]; ok {
|
||||
return group
|
||||
}
|
||||
|
||||
return ""
|
||||
// GetLanguageID returns the ID for the language. IDs are assigned by GitHub.
|
||||
// The input must be the canonical language name. Aliases are not supported.
|
||||
//
|
||||
// NOTE: The zero value (0) is a valid language ID, so this API mimics the Go
|
||||
// map API. Use the second return value to check if the language was found.
|
||||
func GetLanguageID(language string) (int, bool) {
|
||||
id, ok := data.IDByLanguage[language]
|
||||
return id, ok
|
||||
}
|
||||
|
||||
// GetLanguageInfo returns the LanguageInfo for a given language name, or an error if not found.
|
||||
|
224
common_test.go
224
common_test.go
@ -19,15 +19,78 @@ import (
|
||||
const linguistURL = "https://github.com/github/linguist.git"
|
||||
const linguistClonedEnvVar = "ENRY_TEST_REPO"
|
||||
|
||||
type EnryTestSuite struct {
|
||||
// not a part of the test Suite as benchmark does not use testify
|
||||
func maybeCloneLinguist() (string, bool, error) {
|
||||
var err error
|
||||
linguistTmpDir := os.Getenv(linguistClonedEnvVar)
|
||||
isCleanupNeeded := false
|
||||
isLinguistCloned := linguistTmpDir != ""
|
||||
if !isLinguistCloned {
|
||||
linguistTmpDir, err = ioutil.TempDir("", "linguist-")
|
||||
if err != nil {
|
||||
return "", false, err
|
||||
}
|
||||
|
||||
isCleanupNeeded = true
|
||||
cmd := exec.Command("git", "clone", "--depth", "100", linguistURL, linguistTmpDir)
|
||||
if err := cmd.Run(); err != nil {
|
||||
return linguistTmpDir, isCleanupNeeded, err
|
||||
}
|
||||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return linguistTmpDir, isCleanupNeeded, err
|
||||
}
|
||||
|
||||
if err = os.Chdir(linguistTmpDir); err != nil {
|
||||
return linguistTmpDir, isCleanupNeeded, err
|
||||
}
|
||||
|
||||
cmd := exec.Command("git", "checkout", data.LinguistCommit)
|
||||
if err := cmd.Run(); err != nil {
|
||||
return linguistTmpDir, isCleanupNeeded, err
|
||||
}
|
||||
|
||||
if err = os.Chdir(cwd); err != nil {
|
||||
return linguistTmpDir, isCleanupNeeded, err
|
||||
}
|
||||
return linguistTmpDir, isCleanupNeeded, nil
|
||||
}
|
||||
|
||||
type enryBaseTestSuite struct {
|
||||
suite.Suite
|
||||
tmpLinguist string
|
||||
needToClone bool
|
||||
tmpLinguistDir string
|
||||
isCleanupNeeded bool
|
||||
samplesDir string
|
||||
testFixturesDir string
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestRegexpEdgeCases() {
|
||||
func (s *enryBaseTestSuite) SetupSuite() {
|
||||
var err error
|
||||
s.tmpLinguistDir, s.isCleanupNeeded, err = maybeCloneLinguist()
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
s.samplesDir = filepath.Join(s.tmpLinguistDir, "samples")
|
||||
s.testFixturesDir = filepath.Join(s.tmpLinguistDir, "test", "fixtures")
|
||||
}
|
||||
|
||||
func (s *enryBaseTestSuite) TearDownSuite() {
|
||||
if s.isCleanupNeeded {
|
||||
err := os.RemoveAll(s.tmpLinguistDir)
|
||||
require.NoError(s.T(), err)
|
||||
}
|
||||
}
|
||||
|
||||
type enryTestSuite struct {
|
||||
enryBaseTestSuite
|
||||
}
|
||||
|
||||
func Test_EnryTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(enryTestSuite))
|
||||
}
|
||||
|
||||
func (s *enryTestSuite) TestRegexpEdgeCases() {
|
||||
var regexpEdgeCases = []struct {
|
||||
lang string
|
||||
filename string
|
||||
@ -41,7 +104,7 @@ func (s *EnryTestSuite) TestRegexpEdgeCases() {
|
||||
}
|
||||
|
||||
for _, r := range regexpEdgeCases {
|
||||
filename := filepath.Join(s.tmpLinguist, "samples", r.lang, r.filename)
|
||||
filename := filepath.Join(s.tmpLinguistDir, "samples", r.lang, r.filename)
|
||||
|
||||
content, err := ioutil.ReadFile(filename)
|
||||
require.NoError(s.T(), err)
|
||||
@ -54,51 +117,7 @@ func (s *EnryTestSuite) TestRegexpEdgeCases() {
|
||||
}
|
||||
}
|
||||
|
||||
func Test_EnryTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(EnryTestSuite))
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) SetupSuite() {
|
||||
var err error
|
||||
s.tmpLinguist = os.Getenv(linguistClonedEnvVar)
|
||||
s.needToClone = s.tmpLinguist == ""
|
||||
if s.needToClone {
|
||||
s.tmpLinguist, err = ioutil.TempDir("", "linguist-")
|
||||
require.NoError(s.T(), err)
|
||||
s.T().Logf("Cloning Linguist repo to '%s' as %s was not set\n",
|
||||
s.tmpLinguist, linguistClonedEnvVar)
|
||||
cmd := exec.Command("git", "clone", linguistURL, s.tmpLinguist)
|
||||
err = cmd.Run()
|
||||
require.NoError(s.T(), err)
|
||||
}
|
||||
s.samplesDir = filepath.Join(s.tmpLinguist, "samples")
|
||||
s.T().Logf("using samples from %s", s.samplesDir)
|
||||
|
||||
s.testFixturesDir = filepath.Join(s.tmpLinguist, "test", "fixtures")
|
||||
s.T().Logf("using test fixtures from %s", s.samplesDir)
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
assert.NoError(s.T(), err)
|
||||
|
||||
err = os.Chdir(s.tmpLinguist)
|
||||
assert.NoError(s.T(), err)
|
||||
|
||||
cmd := exec.Command("git", "checkout", data.LinguistCommit)
|
||||
err = cmd.Run()
|
||||
assert.NoError(s.T(), err)
|
||||
|
||||
err = os.Chdir(cwd)
|
||||
assert.NoError(s.T(), err)
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TearDownSuite() {
|
||||
if s.needToClone {
|
||||
err := os.RemoveAll(s.tmpLinguist)
|
||||
assert.NoError(s.T(), err)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguage() {
|
||||
func (s *enryTestSuite) TestGetLanguage() {
|
||||
tests := []struct {
|
||||
name string
|
||||
filename string
|
||||
@ -120,7 +139,7 @@ func (s *EnryTestSuite) TestGetLanguage() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguages() {
|
||||
func (s *enryTestSuite) TestGetLanguages() {
|
||||
tests := []struct {
|
||||
name string
|
||||
filename string
|
||||
@ -152,8 +171,8 @@ func (s *EnryTestSuite) TestGetLanguages() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesByModelineLinguist() {
|
||||
var modelinesDir = filepath.Join(s.tmpLinguist, "test", "fixtures", "Data", "Modelines")
|
||||
func (s *enryTestSuite) TestGetLanguagesByModelineLinguist() {
|
||||
var modelinesDir = filepath.Join(s.tmpLinguistDir, "test", "fixtures", "Data", "Modelines")
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
@ -212,7 +231,7 @@ func (s *EnryTestSuite) TestGetLanguagesByModelineLinguist() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesByModeline() {
|
||||
func (s *enryTestSuite) TestGetLanguagesByModeline() {
|
||||
const (
|
||||
wrongVim = `# vim: set syntax=ruby ft =python filetype=perl :`
|
||||
rightVim = `/* vim: set syntax=python ft =python filetype=python */`
|
||||
@ -239,7 +258,7 @@ func (s *EnryTestSuite) TestGetLanguagesByModeline() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesByFilename() {
|
||||
func (s *enryTestSuite) TestGetLanguagesByFilename() {
|
||||
tests := []struct {
|
||||
name string
|
||||
filename string
|
||||
@ -267,7 +286,7 @@ func (s *EnryTestSuite) TestGetLanguagesByFilename() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesByShebang() {
|
||||
func (s *enryTestSuite) TestGetLanguagesByShebang() {
|
||||
const (
|
||||
multilineExecHack = `#!/bin/sh
|
||||
# Next line is comment in Tcl, but not in sh... \
|
||||
@ -352,7 +371,26 @@ println("The shell script says ",vm.arglist.concat(" "));`
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesByExtension() {
|
||||
func (s *enryTestSuite) TestGetLanguageByContent() {
|
||||
tests := []struct {
|
||||
name string
|
||||
filename string
|
||||
content []byte
|
||||
expected string
|
||||
}{
|
||||
{name: "TestGetLanguageByContent_0", filename: "", expected: ""},
|
||||
{name: "TestGetLanguageByContent_1", filename: "foo.cpp", content: []byte("int main() { return 0; }"), expected: ""}, // as .cpp is unambiguous ¯\_(ツ)_/¯
|
||||
{name: "TestGetLanguageByContent_2", filename: "foo.h", content: []byte("int main() { return 0; }"), expected: "C"}, // C, as it does not match any of the heuristics for C++ or Objective-C
|
||||
{name: "TestGetLanguageByContent_3", filename: "foo.h", content: []byte("#include <string>\n int main() { return 0; }"), expected: "C++"}, // '#include <string>' matches regex heuristic
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
languages, _ := GetLanguageByContent(test.filename, test.content)
|
||||
assert.Equal(s.T(), test.expected, languages, fmt.Sprintf("%v: languages = %v, expected: %v", test.name, languages, test.expected))
|
||||
}
|
||||
}
|
||||
|
||||
func (s *enryTestSuite) TestGetLanguagesByExtension() {
|
||||
tests := []struct {
|
||||
name string
|
||||
filename string
|
||||
@ -373,7 +411,7 @@ func (s *EnryTestSuite) TestGetLanguagesByExtension() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesByManpage() {
|
||||
func (s *enryTestSuite) TestGetLanguagesByManpage() {
|
||||
tests := []struct {
|
||||
name string
|
||||
filename string
|
||||
@ -397,7 +435,7 @@ func (s *EnryTestSuite) TestGetLanguagesByManpage() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesByXML() {
|
||||
func (s *enryTestSuite) TestGetLanguagesByXML() {
|
||||
tests := []struct {
|
||||
name string
|
||||
filename string
|
||||
@ -420,7 +458,7 @@ func (s *EnryTestSuite) TestGetLanguagesByXML() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesByClassifier() {
|
||||
func (s *enryTestSuite) TestGetLanguagesByClassifier() {
|
||||
test := []struct {
|
||||
name string
|
||||
filename string
|
||||
@ -457,7 +495,7 @@ func (s *EnryTestSuite) TestGetLanguagesByClassifier() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguagesBySpecificClassifier() {
|
||||
func (s *enryTestSuite) TestGetLanguagesBySpecificClassifier() {
|
||||
test := []struct {
|
||||
name string
|
||||
filename string
|
||||
@ -490,7 +528,7 @@ func (s *EnryTestSuite) TestGetLanguagesBySpecificClassifier() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguageExtensions() {
|
||||
func (s *enryTestSuite) TestGetLanguageExtensions() {
|
||||
tests := []struct {
|
||||
name string
|
||||
language string
|
||||
@ -507,7 +545,7 @@ func (s *EnryTestSuite) TestGetLanguageExtensions() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguageType() {
|
||||
func (s *enryTestSuite) TestGetLanguageType() {
|
||||
tests := []struct {
|
||||
name string
|
||||
language string
|
||||
@ -530,7 +568,7 @@ func (s *EnryTestSuite) TestGetLanguageType() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguageGroup() {
|
||||
func (s *enryTestSuite) TestGetLanguageGroup() {
|
||||
tests := []struct {
|
||||
name string
|
||||
language string
|
||||
@ -548,7 +586,7 @@ func (s *EnryTestSuite) TestGetLanguageGroup() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguageByAlias() {
|
||||
func (s *enryTestSuite) TestGetLanguageByAlias() {
|
||||
tests := []struct {
|
||||
name string
|
||||
alias string
|
||||
@ -574,57 +612,7 @@ func (s *EnryTestSuite) TestGetLanguageByAlias() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestLinguistCorpus() {
|
||||
const filenamesDir = "filenames"
|
||||
var cornerCases = map[string]bool{
|
||||
"drop_stuff.sql": true, // https://github.com/src-d/enry/issues/194
|
||||
"textobj-rubyblock.vba": true, // Because of unsupported negative lookahead RE syntax (https://github.com/github/linguist/blob/8083cb5a89cee2d99f5a988f165994d0243f0d1e/lib/linguist/heuristics.yml#L521)
|
||||
// .es and .ice fail heuristics parsing, but do not fail any tests
|
||||
}
|
||||
|
||||
var total, failed, ok, other int
|
||||
var expected string
|
||||
filepath.Walk(s.samplesDir, func(path string, f os.FileInfo, err error) error {
|
||||
if f.IsDir() {
|
||||
if f.Name() != filenamesDir {
|
||||
expected, _ = data.LanguageByAlias(f.Name())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
filename := filepath.Base(path)
|
||||
content, _ := ioutil.ReadFile(path)
|
||||
|
||||
total++
|
||||
obtained := GetLanguage(filename, content)
|
||||
if obtained == OtherLanguage {
|
||||
obtained = "Other"
|
||||
other++
|
||||
}
|
||||
|
||||
var status string
|
||||
if expected == obtained {
|
||||
status = "ok"
|
||||
ok++
|
||||
} else {
|
||||
status = "failed"
|
||||
failed++
|
||||
}
|
||||
|
||||
if _, ok := cornerCases[filename]; ok {
|
||||
s.T().Logf("\t\t[considered corner case] %s\texpected: %s\tobtained: %s\tstatus: %s\n", filename, expected, obtained, status)
|
||||
} else {
|
||||
assert.Equal(s.T(), expected, obtained, fmt.Sprintf("%s\texpected: %s\tobtained: %s\tstatus: %s\n", filename, expected, obtained, status))
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
s.T().Logf("\t\ttotal files: %d, ok: %d, failed: %d, other: %d\n", total, ok, failed, other)
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguageID() {
|
||||
func (s *enryTestSuite) TestGetLanguageID() {
|
||||
tests := []struct {
|
||||
name string
|
||||
language string
|
||||
@ -647,7 +635,7 @@ func (s *EnryTestSuite) TestGetLanguageID() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguageInfo() {
|
||||
func (s *enryTestSuite) TestGetLanguageInfo() {
|
||||
tests := []struct {
|
||||
name string
|
||||
language string
|
||||
@ -674,7 +662,7 @@ func (s *EnryTestSuite) TestGetLanguageInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EnryTestSuite) TestGetLanguageInfoByID() {
|
||||
func (s *enryTestSuite) TestGetLanguageInfoByID() {
|
||||
tests := []struct {
|
||||
name string
|
||||
id int
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -44,6 +44,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"amusewiki": "Muse",
|
||||
"angelscript": "AngelScript",
|
||||
"ant_build_system": "Ant Build System",
|
||||
"antlers": "Antlers",
|
||||
"antlr": "ANTLR",
|
||||
"apache": "ApacheConf",
|
||||
"apacheconf": "ApacheConf",
|
||||
@ -56,6 +57,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"arc": "Arc",
|
||||
"arexx": "REXX",
|
||||
"as3": "ActionScript",
|
||||
"ascii_stl": "STL",
|
||||
"asciidoc": "AsciiDoc",
|
||||
"asl": "ASL",
|
||||
"asm": "Assembly",
|
||||
@ -94,6 +96,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"berry": "Berry",
|
||||
"bibtex": "BibTeX",
|
||||
"bicep": "Bicep",
|
||||
"bikeshed": "Bikeshed",
|
||||
"bison": "Bison",
|
||||
"bitbake": "BitBake",
|
||||
"blade": "Blade",
|
||||
@ -107,6 +110,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"boogie": "Boogie",
|
||||
"bplus": "BlitzBasic",
|
||||
"brainfuck": "Brainfuck",
|
||||
"brighterscript": "BrighterScript",
|
||||
"brightscript": "Brightscript",
|
||||
"bro": "Zeek",
|
||||
"browserslist": "Browserslist",
|
||||
@ -128,14 +132,18 @@ var LanguageByAliasMap = map[string]string{
|
||||
"cakescript": "C#",
|
||||
"cameligo": "CameLIGO",
|
||||
"cap'n_proto": "Cap'n Proto",
|
||||
"cap_cds": "CAP CDS",
|
||||
"carto": "CartoCSS",
|
||||
"cartocss": "CartoCSS",
|
||||
"cds": "CAP CDS",
|
||||
"ceylon": "Ceylon",
|
||||
"cfc": "ColdFusion CFC",
|
||||
"cfm": "ColdFusion",
|
||||
"cfml": "ColdFusion",
|
||||
"chapel": "Chapel",
|
||||
"charity": "Charity",
|
||||
"checksum": "Checksums",
|
||||
"checksums": "Checksums",
|
||||
"chpl": "Chapel",
|
||||
"chuck": "ChucK",
|
||||
"cil": "CIL",
|
||||
@ -293,6 +301,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"gaml": "GAML",
|
||||
"gams": "GAMS",
|
||||
"gap": "GAP",
|
||||
"gas": "Unix Assembly",
|
||||
"gcc_machine_description": "GCC Machine Description",
|
||||
"gdb": "GDB",
|
||||
"gdscript": "GDScript",
|
||||
@ -304,13 +313,16 @@ var LanguageByAliasMap = map[string]string{
|
||||
"genshi": "Genshi",
|
||||
"gentoo_ebuild": "Gentoo Ebuild",
|
||||
"gentoo_eclass": "Gentoo Eclass",
|
||||
"geojson": "JSON",
|
||||
"gerber_image": "Gerber Image",
|
||||
"gettext_catalog": "Gettext Catalog",
|
||||
"gf": "Grammatical Framework",
|
||||
"gherkin": "Gherkin",
|
||||
"git-ignore": "Ignore List",
|
||||
"git_attributes": "Git Attributes",
|
||||
"git_blame_ignore_revs": "Git Revision List",
|
||||
"git_config": "Git Config",
|
||||
"git_revision_list": "Git Revision List",
|
||||
"gitattributes": "Git Attributes",
|
||||
"gitconfig": "Git Config",
|
||||
"gitignore": "Ignore List",
|
||||
@ -320,6 +332,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"glyph": "Glyph",
|
||||
"glyph_bitmap_distribution_format": "Glyph Bitmap Distribution Format",
|
||||
"gn": "GN",
|
||||
"gnu_asm": "Unix Assembly",
|
||||
"gnuplot": "Gnuplot",
|
||||
"go": "Go",
|
||||
"go.mod": "Go Module",
|
||||
@ -347,6 +360,8 @@ var LanguageByAliasMap = map[string]string{
|
||||
"handlebars": "Handlebars",
|
||||
"haproxy": "HAProxy",
|
||||
"harbour": "Harbour",
|
||||
"hash": "Checksums",
|
||||
"hashes": "Checksums",
|
||||
"hashicorp_configuration_language": "HCL",
|
||||
"haskell": "Haskell",
|
||||
"haxe": "Haxe",
|
||||
@ -410,6 +425,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"javascript": "JavaScript",
|
||||
"javascript+erb": "JavaScript+ERB",
|
||||
"jest_snapshot": "Jest Snapshot",
|
||||
"jetbrains_mps": "JetBrains MPS",
|
||||
"jflex": "JFlex",
|
||||
"jinja": "Jinja",
|
||||
"jison": "Jison",
|
||||
@ -423,6 +439,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"json_with_comments": "JSON with Comments",
|
||||
"jsonc": "JSON with Comments",
|
||||
"jsoniq": "JSONiq",
|
||||
"jsonl": "JSON",
|
||||
"jsonld": "JSONLD",
|
||||
"jsonnet": "Jsonnet",
|
||||
"jsp": "Java Server Pages",
|
||||
@ -532,6 +549,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"moonscript": "MoonScript",
|
||||
"motoko": "Motoko",
|
||||
"motorola_68k_assembly": "Motorola 68K Assembly",
|
||||
"mps": "JetBrains MPS",
|
||||
"mql4": "MQL4",
|
||||
"mql5": "MQL5",
|
||||
"mtml": "MTML",
|
||||
@ -649,6 +667,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"pod_6": "Pod 6",
|
||||
"pogoscript": "PogoScript",
|
||||
"pony": "Pony",
|
||||
"portugol": "Portugol",
|
||||
"posh": "PowerShell",
|
||||
"postcss": "PostCSS",
|
||||
"postscr": "PostScript",
|
||||
@ -810,13 +829,18 @@ var LanguageByAliasMap = map[string]string{
|
||||
"ssh_config": "SSH Config",
|
||||
"stan": "Stan",
|
||||
"standard_ml": "Standard ML",
|
||||
"star": "STAR",
|
||||
"starlark": "Starlark",
|
||||
"stata": "Stata",
|
||||
"stl": "STL",
|
||||
"stla": "STL",
|
||||
"ston": "STON",
|
||||
"stringtemplate": "StringTemplate",
|
||||
"stylus": "Stylus",
|
||||
"subrip_text": "SubRip Text",
|
||||
"sugarss": "SugarSS",
|
||||
"sum": "Checksums",
|
||||
"sums": "Checksums",
|
||||
"supercollider": "SuperCollider",
|
||||
"svelte": "Svelte",
|
||||
"svg": "SVG",
|
||||
@ -841,6 +865,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"tla": "TLA",
|
||||
"tm-properties": "TextMate Properties",
|
||||
"toml": "TOML",
|
||||
"topojson": "JSON",
|
||||
"troff": "Roff",
|
||||
"ts": "TypeScript",
|
||||
"tsql": "TSQL",
|
||||
@ -857,6 +882,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"ultisnips": "Vim Snippet",
|
||||
"unified_parallel_c": "Unified Parallel C",
|
||||
"unity3d_asset": "Unity3D Asset",
|
||||
"unix_asm": "Unix Assembly",
|
||||
"unix_assembly": "Unix Assembly",
|
||||
"uno": "Uno",
|
||||
"unrealscript": "UnrealScript",
|
||||
@ -888,6 +914,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"visual_basic_for_applications": "VBA",
|
||||
"vlang": "V",
|
||||
"volt": "Volt",
|
||||
"vtt": "WebVTT",
|
||||
"vue": "Vue",
|
||||
"vyper": "Vyper",
|
||||
"wasm": "WebAssembly",
|
||||
@ -901,6 +928,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"webvtt": "WebVTT",
|
||||
"wget_config": "Wget Config",
|
||||
"wgetrc": "Wget Config",
|
||||
"whiley": "Whiley",
|
||||
"wiki": "Wikitext",
|
||||
"wikitext": "Wikitext",
|
||||
"win32_message_file": "Win32 Message File",
|
||||
@ -948,6 +976,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"yas": "YASnippet",
|
||||
"yasnippet": "YASnippet",
|
||||
"yml": "YAML",
|
||||
"yul": "Yul",
|
||||
"zap": "ZAP",
|
||||
"zeek": "Zeek",
|
||||
"zenscript": "ZenScript",
|
||||
@ -969,8 +998,9 @@ func LanguageByAlias(langOrAlias string) (lang string, ok bool) {
|
||||
|
||||
// convertToAliasKey converts language name to a key in LanguageByAliasMap.
|
||||
// Following
|
||||
// - internal.code-generator.generator.convertToAliasKey()
|
||||
// - GetLanguageByAlias()
|
||||
// - internal.code-generator.generator.convertToAliasKey()
|
||||
// - GetLanguageByAlias()
|
||||
//
|
||||
// conventions.
|
||||
// It is here to avoid dependency on "generate" and "enry" packages.
|
||||
func convertToAliasKey(langName string) string {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -27,6 +27,7 @@ var LanguagesColor = map[string]string{
|
||||
"Altium Designer": "#A89663",
|
||||
"AngelScript": "#C7D7DC",
|
||||
"Ant Build System": "#A9157E",
|
||||
"Antlers": "#ff269e",
|
||||
"ApacheConf": "#d12127",
|
||||
"Apex": "#1797c0",
|
||||
"Apollo Guidance Computer": "#0B3D91",
|
||||
@ -49,6 +50,7 @@ var LanguagesColor = map[string]string{
|
||||
"Berry": "#15A13C",
|
||||
"BibTeX": "#778899",
|
||||
"Bicep": "#519aba",
|
||||
"Bikeshed": "#5562ac",
|
||||
"Bison": "#6A463F",
|
||||
"BitBake": "#00bce4",
|
||||
"Blade": "#f7523f",
|
||||
@ -58,11 +60,13 @@ var LanguagesColor = map[string]string{
|
||||
"Boo": "#d4bec1",
|
||||
"Boogie": "#c80fa0",
|
||||
"Brainfuck": "#2F2530",
|
||||
"BrighterScript": "#66AABB",
|
||||
"Brightscript": "#662D91",
|
||||
"Browserslist": "#ffd539",
|
||||
"C": "#555555",
|
||||
"C#": "#178600",
|
||||
"C++": "#f34b7d",
|
||||
"CAP CDS": "#0092d1",
|
||||
"CLIPS": "#00A300",
|
||||
"CMake": "#DA3434",
|
||||
"COLLADA": "#F1A42B",
|
||||
@ -171,6 +175,7 @@ var LanguagesColor = map[string]string{
|
||||
"Gherkin": "#5B2063",
|
||||
"Git Attributes": "#F44D27",
|
||||
"Git Config": "#F44D27",
|
||||
"Git Revision List": "#F44D27",
|
||||
"Gleam": "#ffaff3",
|
||||
"Glyph": "#c1ac7f",
|
||||
"Gnuplot": "#f0a9f0",
|
||||
@ -232,6 +237,7 @@ var LanguagesColor = map[string]string{
|
||||
"JavaScript": "#f1e05a",
|
||||
"JavaScript+ERB": "#f1e05a",
|
||||
"Jest Snapshot": "#15c213",
|
||||
"JetBrains MPS": "#21D789",
|
||||
"Jinja": "#a52a22",
|
||||
"Jison": "#56b3cb",
|
||||
"Jison Lex": "#56b3cb",
|
||||
@ -344,6 +350,7 @@ var LanguagesColor = map[string]string{
|
||||
"PigLatin": "#fcd7de",
|
||||
"Pike": "#005390",
|
||||
"PogoScript": "#d80074",
|
||||
"Portugol": "#f8bd00",
|
||||
"PostCSS": "#dc3a0c",
|
||||
"PostScript": "#da291c",
|
||||
"PowerBuilder": "#8f0f8d",
|
||||
@ -399,6 +406,7 @@ var LanguagesColor = map[string]string{
|
||||
"SQL": "#e38c00",
|
||||
"SQLPL": "#e38c00",
|
||||
"SRecode Template": "#348a34",
|
||||
"STL": "#373b5e",
|
||||
"SVG": "#ff9900",
|
||||
"SaltStack": "#646464",
|
||||
"Sass": "#a53b70",
|
||||
@ -438,7 +446,7 @@ var LanguagesColor = map[string]string{
|
||||
"TOML": "#9c4221",
|
||||
"TSQL": "#e38c00",
|
||||
"TSV": "#237346",
|
||||
"TSX": "#2b7489",
|
||||
"TSX": "#3178c6",
|
||||
"TXL": "#0178b8",
|
||||
"Talon": "#333333",
|
||||
"Tcl": "#e4cc98",
|
||||
@ -449,7 +457,7 @@ var LanguagesColor = map[string]string{
|
||||
"Thrift": "#D12127",
|
||||
"Turing": "#cf142b",
|
||||
"Twig": "#c1d026",
|
||||
"TypeScript": "#2b7489",
|
||||
"TypeScript": "#3178c6",
|
||||
"Unified Parallel C": "#4e3617",
|
||||
"Unity3D Asset": "#222c37",
|
||||
"Uno": "#9933cc",
|
||||
@ -472,6 +480,7 @@ var LanguagesColor = map[string]string{
|
||||
"Vyper": "#2980b9",
|
||||
"Web Ontology Language": "#5b70bd",
|
||||
"WebAssembly": "#04133b",
|
||||
"Whiley": "#d5c397",
|
||||
"Wikitext": "#fc5757",
|
||||
"Windows Registry Entries": "#52d5ff",
|
||||
"Witcher Script": "#ff0000",
|
||||
@ -490,6 +499,7 @@ var LanguagesColor = map[string]string{
|
||||
"YARA": "#220000",
|
||||
"YASnippet": "#32AB90",
|
||||
"Yacc": "#4B6C4B",
|
||||
"Yul": "#794932",
|
||||
"ZAP": "#0d665e",
|
||||
"ZIL": "#dc75e5",
|
||||
"ZenScript": "#00BCD1",
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
// linguist's commit from which files were generated.
|
||||
var LinguistCommit = "4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26"
|
||||
var LinguistCommit = "d7799da826e01acdb8f84694d33116dccaabe9c2"
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -638,6 +638,10 @@ var ContentHeuristics = map[string]*Heuristics{
|
||||
rule.MatchingLanguages("BitBake"),
|
||||
regexp.MustCompile(`(?m)^\s*(# |include|require)\b`),
|
||||
),
|
||||
rule.Or(
|
||||
rule.MatchingLanguages("Clojure"),
|
||||
regexp.MustCompile(`(?m)\((def|defn|defmacro|let)\s`),
|
||||
),
|
||||
},
|
||||
".bi": &Heuristics{
|
||||
rule.Or(
|
||||
@ -645,6 +649,7 @@ var ContentHeuristics = map[string]*Heuristics{
|
||||
regexp.MustCompile(`(?m)^[ \t]*#(?:define|endif|endmacro|ifn?def|if|include|lang|macro)\s`),
|
||||
),
|
||||
},
|
||||
".bs": &Heuristics{},
|
||||
".builds": &Heuristics{
|
||||
rule.Or(
|
||||
rule.MatchingLanguages("XML"),
|
||||
@ -1472,6 +1477,16 @@ var ContentHeuristics = map[string]*Heuristics{
|
||||
regexp.MustCompile(`(?m)\A\s*[\[{(^"'\w#]|[a-zA-Z_]\w*\s*:=\s*[a-zA-Z_]\w*|class\s*>>\s*[a-zA-Z_]\w*|^[a-zA-Z_]\w*\s+[a-zA-Z_]\w*:|^Class\s*{|if(?:True|False):\s*\[`),
|
||||
),
|
||||
},
|
||||
".star": &Heuristics{
|
||||
rule.Or(
|
||||
rule.MatchingLanguages("STAR"),
|
||||
regexp.MustCompile(`(?m)^loop_\s*$`),
|
||||
),
|
||||
rule.Always(
|
||||
rule.MatchingLanguages("Starlark"),
|
||||
),
|
||||
},
|
||||
".stl": &Heuristics{},
|
||||
".t": &Heuristics{
|
||||
rule.Or(
|
||||
rule.MatchingLanguages("Perl"),
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -18,7 +18,9 @@ var LanguagesByExtension = map[string][]string{
|
||||
".3qt": {"Roff", "Roff Manpage"},
|
||||
".3x": {"Roff", "Roff Manpage"},
|
||||
".4": {"Roff", "Roff Manpage"},
|
||||
".4dform": {"JSON"},
|
||||
".4dm": {"4D"},
|
||||
".4dproject": {"JSON"},
|
||||
".4gl": {"Genero"},
|
||||
".4th": {"Forth"},
|
||||
".5": {"Roff", "Roff Manpage"},
|
||||
@ -59,6 +61,9 @@ var LanguagesByExtension = map[string][]string{
|
||||
".angelscript": {"AngelScript"},
|
||||
".anim": {"Unity3D Asset"},
|
||||
".ant": {"XML"},
|
||||
".antlers.html": {"Antlers"},
|
||||
".antlers.php": {"Antlers"},
|
||||
".antlers.xml": {"Antlers"},
|
||||
".apacheconf": {"ApacheConf"},
|
||||
".apib": {"API Blueprint"},
|
||||
".apl": {"APL"},
|
||||
@ -106,7 +111,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".bash": {"Shell"},
|
||||
".bat": {"Batchfile"},
|
||||
".bats": {"Shell"},
|
||||
".bb": {"BitBake", "BlitzBasic"},
|
||||
".bb": {"BitBake", "BlitzBasic", "Clojure"},
|
||||
".bbx": {"TeX"},
|
||||
".bdf": {"Glyph Bitmap Distribution Format"},
|
||||
".bdy": {"PLSQL"},
|
||||
@ -128,6 +133,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".brd": {"Eagle", "KiCad Legacy Layout"},
|
||||
".bro": {"Zeek"},
|
||||
".brs": {"Brightscript"},
|
||||
".bs": {"Bikeshed", "BrighterScript"},
|
||||
".bsl": {"1C Enterprise"},
|
||||
".bsv": {"Bluespec"},
|
||||
".builder": {"Ruby"},
|
||||
@ -151,6 +157,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".ccxml": {"XML"},
|
||||
".cdc": {"Cadence"},
|
||||
".cdf": {"Mathematica"},
|
||||
".cds": {"CAP CDS"},
|
||||
".ceylon": {"Ceylon"},
|
||||
".cfc": {"ColdFusion CFC"},
|
||||
".cfg": {"HAProxy", "INI"},
|
||||
@ -206,6 +213,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".cpy": {"COBOL"},
|
||||
".cql": {"SQL"},
|
||||
".cr": {"Crystal"},
|
||||
".crc32": {"Checksums"},
|
||||
".creole": {"Creole"},
|
||||
".cs": {"C#", "Smalltalk"},
|
||||
".csc": {"GSC"},
|
||||
@ -222,6 +230,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".csx": {"C#"},
|
||||
".ct": {"XML"},
|
||||
".ctp": {"PHP"},
|
||||
".cts": {"TypeScript"},
|
||||
".cu": {"Cuda"},
|
||||
".cue": {"CUE", "Cue Sheet"},
|
||||
".cuh": {"Cuda"},
|
||||
@ -350,6 +359,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".fsi": {"F#"},
|
||||
".fsproj": {"XML"},
|
||||
".fst": {"F*"},
|
||||
".fsti": {"F*"},
|
||||
".fsx": {"F#"},
|
||||
".fth": {"Forth"},
|
||||
".ftl": {"Fluent", "FreeMarker"},
|
||||
@ -540,6 +550,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".kak": {"KakouneScript"},
|
||||
".kicad_mod": {"KiCad Layout"},
|
||||
".kicad_pcb": {"KiCad Layout"},
|
||||
".kicad_sch": {"KiCad Schematic"},
|
||||
".kicad_wks": {"KiCad Layout"},
|
||||
".kid": {"Genshi"},
|
||||
".kit": {"Kit"},
|
||||
@ -579,6 +590,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".liquid": {"Liquid"},
|
||||
".lisp": {"Common Lisp", "NewLisp"},
|
||||
".litcoffee": {"Literate CoffeeScript"},
|
||||
".livemd": {"Markdown"},
|
||||
".ll": {"LLVM"},
|
||||
".lmi": {"Python"},
|
||||
".logtalk": {"Logtalk"},
|
||||
@ -591,6 +603,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".lsp": {"Common Lisp", "NewLisp"},
|
||||
".ltx": {"TeX"},
|
||||
".lua": {"Lua"},
|
||||
".lvclass": {"LabVIEW"},
|
||||
".lvlib": {"LabVIEW"},
|
||||
".lvproj": {"LabVIEW"},
|
||||
".ly": {"LilyPond"},
|
||||
@ -623,6 +636,9 @@ var LanguagesByExtension = map[string][]string{
|
||||
".mcmeta": {"JSON"},
|
||||
".mcr": {"MAXScript"},
|
||||
".md": {"GCC Machine Description", "Markdown"},
|
||||
".md2": {"Checksums"},
|
||||
".md4": {"Checksums"},
|
||||
".md5": {"Checksums"},
|
||||
".mdoc": {"Roff", "Roff Manpage"},
|
||||
".mdown": {"Markdown"},
|
||||
".mdpolicy": {"XML"},
|
||||
@ -664,16 +680,20 @@ var LanguagesByExtension = map[string][]string{
|
||||
".monkey2": {"Monkey"},
|
||||
".moo": {"Mercury", "Moocode"},
|
||||
".moon": {"MoonScript"},
|
||||
".mpl": {"JetBrains MPS"},
|
||||
".mps": {"JetBrains MPS"},
|
||||
".mq4": {"MQL4"},
|
||||
".mq5": {"MQL5"},
|
||||
".mqh": {"MQL4", "MQL5"},
|
||||
".mrc": {"mIRC Script"},
|
||||
".ms": {"MAXScript", "Roff", "Unix Assembly"},
|
||||
".msd": {"JetBrains MPS"},
|
||||
".mspec": {"Ruby"},
|
||||
".mss": {"CartoCSS"},
|
||||
".mt": {"Mathematica"},
|
||||
".mtl": {"Wavefront Material"},
|
||||
".mtml": {"MTML"},
|
||||
".mts": {"TypeScript"},
|
||||
".mu": {"mupad"},
|
||||
".mud": {"ZIL"},
|
||||
".muf": {"MUF"},
|
||||
@ -819,6 +839,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".podspec": {"Ruby"},
|
||||
".pogo": {"PogoScript"},
|
||||
".pony": {"Pony"},
|
||||
".por": {"Portugol"},
|
||||
".postcss": {"PostCSS"},
|
||||
".pot": {"Gettext Catalog"},
|
||||
".pov": {"POV-Ray SDL"},
|
||||
@ -978,6 +999,14 @@ var LanguagesByExtension = map[string][]string{
|
||||
".sh": {"Shell"},
|
||||
".sh-session": {"ShellSession"},
|
||||
".sh.in": {"Shell"},
|
||||
".sha1": {"Checksums"},
|
||||
".sha2": {"Checksums"},
|
||||
".sha224": {"Checksums"},
|
||||
".sha256": {"Checksums"},
|
||||
".sha256sum": {"Checksums"},
|
||||
".sha3": {"Checksums"},
|
||||
".sha384": {"Checksums"},
|
||||
".sha512": {"Checksums"},
|
||||
".shader": {"GLSL", "ShaderLab"},
|
||||
".shen": {"Shen"},
|
||||
".shproj": {"XML"},
|
||||
@ -1021,7 +1050,9 @@ var LanguagesByExtension = map[string][]string{
|
||||
".sss": {"SugarSS"},
|
||||
".st": {"Smalltalk", "StringTemplate"},
|
||||
".stan": {"Stan"},
|
||||
".star": {"STAR", "Starlark"},
|
||||
".sthlp": {"Stata"},
|
||||
".stl": {"STL"},
|
||||
".ston": {"STON"},
|
||||
".story": {"Gherkin"},
|
||||
".storyboard": {"XML"},
|
||||
@ -1166,6 +1197,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".webidl": {"WebIDL"},
|
||||
".webmanifest": {"JSON"},
|
||||
".weechatlog": {"IRC log"},
|
||||
".whiley": {"Whiley"},
|
||||
".wiki": {"Wikitext"},
|
||||
".wikitext": {"Wikitext"},
|
||||
".wisp": {"wisp"},
|
||||
@ -1245,6 +1277,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".yml": {"YAML"},
|
||||
".yml.mysql": {"YAML"},
|
||||
".yrl": {"Erlang"},
|
||||
".yul": {"Yul"},
|
||||
".yy": {"JSON", "Yacc"},
|
||||
".yyp": {"JSON"},
|
||||
".zap": {"ZAP"},
|
||||
@ -1287,6 +1320,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Alloy": {".als"},
|
||||
"Altium Designer": {".outjob", ".pcbdoc", ".prjpcb", ".schdoc"},
|
||||
"AngelScript": {".as", ".angelscript"},
|
||||
"Antlers": {".antlers.html", ".antlers.php", ".antlers.xml"},
|
||||
"ApacheConf": {".apacheconf", ".vhost"},
|
||||
"Apex": {".cls"},
|
||||
"Apollo Guidance Computer": {".agc"},
|
||||
@ -1310,6 +1344,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Berry": {".be"},
|
||||
"BibTeX": {".bib", ".bibtex"},
|
||||
"Bicep": {".bicep"},
|
||||
"Bikeshed": {".bs"},
|
||||
"Bison": {".bison"},
|
||||
"BitBake": {".bb"},
|
||||
"Blade": {".blade", ".blade.php"},
|
||||
@ -1319,12 +1354,14 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Boo": {".boo"},
|
||||
"Boogie": {".bpl"},
|
||||
"Brainfuck": {".b", ".bf"},
|
||||
"BrighterScript": {".bs"},
|
||||
"Brightscript": {".brs"},
|
||||
"C": {".c", ".cats", ".h", ".idc"},
|
||||
"C#": {".cs", ".cake", ".csx", ".linq"},
|
||||
"C++": {".cpp", ".c++", ".cc", ".cp", ".cxx", ".h", ".h++", ".hh", ".hpp", ".hxx", ".inc", ".inl", ".ino", ".ipp", ".ixx", ".re", ".tcc", ".tpp"},
|
||||
"C-ObjDump": {".c-objdump"},
|
||||
"C2hs Haskell": {".chs"},
|
||||
"CAP CDS": {".cds"},
|
||||
"CIL": {".cil"},
|
||||
"CLIPS": {".clp"},
|
||||
"CMake": {".cmake", ".cmake.in"},
|
||||
@ -1344,6 +1381,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Ceylon": {".ceylon"},
|
||||
"Chapel": {".chpl"},
|
||||
"Charity": {".ch"},
|
||||
"Checksums": {".crc32", ".md2", ".md4", ".md5", ".sha1", ".sha2", ".sha224", ".sha256", ".sha256sum", ".sha3", ".sha384", ".sha512"},
|
||||
"ChucK": {".ck"},
|
||||
"Cirru": {".cirru"},
|
||||
"Clarion": {".clw"},
|
||||
@ -1351,7 +1389,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Classic ASP": {".asp"},
|
||||
"Clean": {".icl", ".dcl"},
|
||||
"Click": {".click"},
|
||||
"Clojure": {".clj", ".boot", ".cl2", ".cljc", ".cljs", ".cljs.hl", ".cljscm", ".cljx", ".hic"},
|
||||
"Clojure": {".clj", ".bb", ".boot", ".cl2", ".cljc", ".cljs", ".cljs.hl", ".cljscm", ".cljx", ".hic"},
|
||||
"Closure Templates": {".soy"},
|
||||
"CoNLL-U": {".conllu", ".conll"},
|
||||
"CodeQL": {".ql", ".qll"},
|
||||
@ -1411,7 +1449,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Erlang": {".erl", ".app.src", ".es", ".escript", ".hrl", ".xrl", ".yrl"},
|
||||
"Euphoria": {".e", ".ex"},
|
||||
"F#": {".fs", ".fsi", ".fsx"},
|
||||
"F*": {".fst"},
|
||||
"F*": {".fst", ".fsti"},
|
||||
"FIGlet Font": {".flf"},
|
||||
"FLUX": {".fx", ".flux"},
|
||||
"Factor": {".factor"},
|
||||
@ -1502,7 +1540,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Isabelle": {".thy"},
|
||||
"J": {".ijs"},
|
||||
"JFlex": {".flex", ".jflex"},
|
||||
"JSON": {".json", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".json-tmlanguage", ".jsonl", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"},
|
||||
"JSON": {".json", ".4dform", ".4dproject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".json-tmlanguage", ".jsonl", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"},
|
||||
"JSON with Comments": {".jsonc", ".code-snippets", ".sublime-build", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"},
|
||||
"JSON5": {".json5"},
|
||||
"JSONLD": {".jsonld"},
|
||||
@ -1515,6 +1553,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"JavaScript": {".js", "._js", ".bones", ".cjs", ".es", ".es6", ".frag", ".gs", ".jake", ".javascript", ".jsb", ".jscad", ".jsfl", ".jslib", ".jsm", ".jspre", ".jss", ".jsx", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib"},
|
||||
"JavaScript+ERB": {".js.erb"},
|
||||
"Jest Snapshot": {".snap"},
|
||||
"JetBrains MPS": {".mps", ".mpl", ".msd"},
|
||||
"Jinja": {".jinja", ".j2", ".jinja2"},
|
||||
"Jison": {".jison"},
|
||||
"Jison Lex": {".jisonlex"},
|
||||
@ -1527,7 +1566,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"KakouneScript": {".kak"},
|
||||
"KiCad Layout": {".kicad_pcb", ".kicad_mod", ".kicad_wks"},
|
||||
"KiCad Legacy Layout": {".brd"},
|
||||
"KiCad Schematic": {".sch"},
|
||||
"KiCad Schematic": {".kicad_sch", ".sch"},
|
||||
"Kit": {".kit"},
|
||||
"Kotlin": {".kt", ".ktm", ".kts"},
|
||||
"Kusto": {".csl"},
|
||||
@ -1536,7 +1575,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"LOLCODE": {".lol"},
|
||||
"LSL": {".lsl", ".lslp"},
|
||||
"LTspice Symbol": {".asy"},
|
||||
"LabVIEW": {".lvproj", ".lvlib"},
|
||||
"LabVIEW": {".lvproj", ".lvclass", ".lvlib"},
|
||||
"Lark": {".lark"},
|
||||
"Lasso": {".lasso", ".las", ".lasso8", ".lasso9"},
|
||||
"Latte": {".latte"},
|
||||
@ -1571,7 +1610,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Macaulay2": {".m2"},
|
||||
"Makefile": {".mak", ".d", ".make", ".makefile", ".mk", ".mkfile"},
|
||||
"Mako": {".mako", ".mao"},
|
||||
"Markdown": {".md", ".markdown", ".mdown", ".mdwn", ".mdx", ".mkd", ".mkdn", ".mkdown", ".ronn", ".scd", ".workbook"},
|
||||
"Markdown": {".md", ".livemd", ".markdown", ".mdown", ".mdwn", ".mdx", ".mkd", ".mkdn", ".mkdown", ".ronn", ".scd", ".workbook"},
|
||||
"Marko": {".marko"},
|
||||
"Mask": {".mask"},
|
||||
"Mathematica": {".mathematica", ".cdf", ".m", ".ma", ".mt", ".nb", ".nbp", ".wl", ".wlt"},
|
||||
@ -1665,6 +1704,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Pod 6": {".pod", ".pod6"},
|
||||
"PogoScript": {".pogo"},
|
||||
"Pony": {".pony"},
|
||||
"Portugol": {".por"},
|
||||
"PostCSS": {".pcss", ".postcss"},
|
||||
"PostScript": {".ps", ".eps", ".epsi", ".pfa"},
|
||||
"PowerBuilder": {".pbt", ".sra", ".sru", ".srw"},
|
||||
@ -1731,6 +1771,8 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"SQL": {".sql", ".cql", ".ddl", ".inc", ".mysql", ".prc", ".tab", ".udf", ".viw"},
|
||||
"SQLPL": {".sql", ".db2"},
|
||||
"SRecode Template": {".srt"},
|
||||
"STAR": {".star"},
|
||||
"STL": {".stl"},
|
||||
"STON": {".ston"},
|
||||
"SVG": {".svg"},
|
||||
"SWIG": {".i"},
|
||||
@ -1760,7 +1802,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Squirrel": {".nut"},
|
||||
"Stan": {".stan"},
|
||||
"Standard ML": {".ml", ".fun", ".sig", ".sml"},
|
||||
"Starlark": {".bzl"},
|
||||
"Starlark": {".bzl", ".star"},
|
||||
"Stata": {".do", ".ado", ".doh", ".ihlp", ".mata", ".matah", ".sthlp"},
|
||||
"StringTemplate": {".st"},
|
||||
"Stylus": {".styl"},
|
||||
@ -1791,7 +1833,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Turtle": {".ttl"},
|
||||
"Twig": {".twig"},
|
||||
"Type Language": {".tl"},
|
||||
"TypeScript": {".ts"},
|
||||
"TypeScript": {".ts", ".cts", ".mts"},
|
||||
"Unified Parallel C": {".upc"},
|
||||
"Unity3D Asset": {".anim", ".asset", ".mask", ".mat", ".meta", ".prefab", ".unity"},
|
||||
"Unix Assembly": {".s", ".ms"},
|
||||
@ -1819,6 +1861,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"WebAssembly": {".wast", ".wat"},
|
||||
"WebIDL": {".webidl"},
|
||||
"WebVTT": {".vtt"},
|
||||
"Whiley": {".whiley"},
|
||||
"Wikitext": {".mediawiki", ".wiki", ".wikitext"},
|
||||
"Win32 Message File": {".mc"},
|
||||
"Windows Registry Entries": {".reg"},
|
||||
@ -1844,6 +1887,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"YARA": {".yar", ".yara"},
|
||||
"YASnippet": {".yasnippet"},
|
||||
"Yacc": {".y", ".yacc", ".yy"},
|
||||
"Yul": {".yul"},
|
||||
"ZAP": {".zap", ".xzap"},
|
||||
"ZIL": {".zil", ".mud"},
|
||||
"Zeek": {".zeek", ".bro"},
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -24,10 +24,12 @@ var LanguagesByFilename = map[string][]string{
|
||||
".clang-tidy": {"YAML"},
|
||||
".classpath": {"XML"},
|
||||
".coffeelintignore": {"Ignore List"},
|
||||
".coveragerc": {"INI"},
|
||||
".cproject": {"XML"},
|
||||
".cshrc": {"Shell"},
|
||||
".curlrc": {"cURL Config"},
|
||||
".cvsignore": {"Ignore List"},
|
||||
".devcontainer.json": {"JSON with Comments"},
|
||||
".dir_colors": {"dircolors"},
|
||||
".dircolors": {"dircolors"},
|
||||
".dockerignore": {"Ignore List"},
|
||||
@ -46,6 +48,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
".flaskenv": {"Shell"},
|
||||
".gclient": {"Python"},
|
||||
".gemrc": {"YAML"},
|
||||
".git-blame-ignore-revs": {"Git Revision List"},
|
||||
".gitattributes": {"Git Attributes"},
|
||||
".gitconfig": {"Git Config"},
|
||||
".gitignore": {"Ignore List"},
|
||||
@ -78,6 +81,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
".profile": {"Shell"},
|
||||
".project": {"XML"},
|
||||
".pryrc": {"Ruby"},
|
||||
".pylintrc": {"INI"},
|
||||
".shellcheckrc": {"ShellCheck Config"},
|
||||
".simplecov": {"Ruby"},
|
||||
".spacemacs": {"Emacs Lisp"},
|
||||
@ -146,6 +150,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
"LICENSE.mysql": {"Text"},
|
||||
"Lexer.x": {"Lex"},
|
||||
"MANIFEST.MF": {"JAR Manifest"},
|
||||
"MD5SUMS": {"Checksums"},
|
||||
"Makefile": {"Makefile"},
|
||||
"Makefile.PL": {"Perl"},
|
||||
"Makefile.am": {"Makefile"},
|
||||
@ -176,6 +181,10 @@ var LanguagesByFilename = map[string][]string{
|
||||
"Rexfile": {"Perl"},
|
||||
"SConscript": {"Python"},
|
||||
"SConstruct": {"Python"},
|
||||
"SHA1SUMS": {"Checksums"},
|
||||
"SHA256SUMS": {"Checksums"},
|
||||
"SHA256SUMS.txt": {"Checksums"},
|
||||
"SHA512SUMS": {"Checksums"},
|
||||
"Settings.StyleCop": {"XML"},
|
||||
"Singularity": {"Singularity"},
|
||||
"Slakefile": {"LiveScript"},
|
||||
@ -211,6 +220,8 @@ var LanguagesByFilename = map[string][]string{
|
||||
"buildozer.spec": {"INI"},
|
||||
"cabal.config": {"Cabal Config"},
|
||||
"cabal.project": {"Cabal Config"},
|
||||
"checksums.txt": {"Checksums"},
|
||||
"cksums": {"Checksums"},
|
||||
"click.me": {"Text"},
|
||||
"composer.lock": {"JSON"},
|
||||
"configure.ac": {"M4Sugar"},
|
||||
@ -259,6 +270,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
"makefile.sco": {"Makefile"},
|
||||
"man": {"Shell"},
|
||||
"mcmod.info": {"JSON"},
|
||||
"md5sum.txt": {"Checksums"},
|
||||
"meson.build": {"Meson"},
|
||||
"meson_options.txt": {"Meson"},
|
||||
"mix.lock": {"Elixir"},
|
||||
@ -279,6 +291,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
"pom.xml": {"Maven POM"},
|
||||
"port_contexts": {"SELinux Policy"},
|
||||
"profile": {"Shell"},
|
||||
"pylintrc": {"INI"},
|
||||
"read.me": {"Text"},
|
||||
"readme.1st": {"Text"},
|
||||
"rebar.config": {"Erlang"},
|
||||
|
13676
data/frequencies.go
13676
data/frequencies.go
File diff suppressed because it is too large
Load Diff
@ -74,7 +74,7 @@ var GeneratedCodeNameMatchers = []GeneratedCodeNameMatcher{
|
||||
nameEndsWith("package-lock.json"),
|
||||
|
||||
// Yarn plugnplay
|
||||
nameMatches(`(^|\/)\.pnp\.(c|m)?js$`),
|
||||
nameMatches(`(^|\/)\.pnp\..*$`),
|
||||
|
||||
// Godeps
|
||||
nameContains("Godeps/"),
|
||||
@ -113,6 +113,7 @@ var GeneratedCodeMatchers = []GeneratedCodeMatcher{
|
||||
isGeneratedJavaScriptPEGParser,
|
||||
isGeneratedPostScript,
|
||||
isGeneratedGo,
|
||||
isGeneratedProtobufFromGo,
|
||||
isGeneratedProtobuf,
|
||||
isGeneratedJavaScriptProtocolBuffer,
|
||||
isGeneratedApacheThrift,
|
||||
@ -339,6 +340,24 @@ func isGeneratedGo(_, ext string, content []byte) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func isGeneratedProtobufFromGo(_, ext string, content []byte) bool {
|
||||
if ext != ".proto" {
|
||||
return false
|
||||
}
|
||||
lines := getLines(content, 20)
|
||||
if len(lines) <= 1 {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, line := range lines {
|
||||
if bytes.Contains(line, []byte("This file was autogenerated by go-to-protobuf")) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
var protoExtensions = map[string]struct{}{
|
||||
".py": {},
|
||||
".java": {},
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
|
14
data/id.go
14
data/id.go
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -30,6 +30,7 @@ var IDByLanguage = map[string]int{
|
||||
"Altium Designer": 187772328,
|
||||
"AngelScript": 389477596,
|
||||
"Ant Build System": 15,
|
||||
"Antlers": 1067292663,
|
||||
"ApacheConf": 16,
|
||||
"Apex": 17,
|
||||
"Apollo Guidance Computer": 18,
|
||||
@ -53,6 +54,7 @@ var IDByLanguage = map[string]int{
|
||||
"Berry": 121855308,
|
||||
"BibTeX": 982188347,
|
||||
"Bicep": 321200902,
|
||||
"Bikeshed": 1055528081,
|
||||
"Bison": 31,
|
||||
"BitBake": 32,
|
||||
"Blade": 33,
|
||||
@ -62,6 +64,7 @@ var IDByLanguage = map[string]int{
|
||||
"Boo": 37,
|
||||
"Boogie": 955017407,
|
||||
"Brainfuck": 38,
|
||||
"BrighterScript": 943571030,
|
||||
"Brightscript": 39,
|
||||
"Browserslist": 153503348,
|
||||
"C": 41,
|
||||
@ -69,6 +72,7 @@ var IDByLanguage = map[string]int{
|
||||
"C++": 43,
|
||||
"C-ObjDump": 44,
|
||||
"C2hs Haskell": 45,
|
||||
"CAP CDS": 390788699,
|
||||
"CIL": 29176339,
|
||||
"CLIPS": 46,
|
||||
"CMake": 47,
|
||||
@ -89,6 +93,7 @@ var IDByLanguage = map[string]int{
|
||||
"Ceylon": 54,
|
||||
"Chapel": 55,
|
||||
"Charity": 56,
|
||||
"Checksums": 372063053,
|
||||
"ChucK": 57,
|
||||
"Cirru": 58,
|
||||
"Clarion": 59,
|
||||
@ -202,6 +207,7 @@ var IDByLanguage = map[string]int{
|
||||
"Gherkin": 76,
|
||||
"Git Attributes": 956324166,
|
||||
"Git Config": 807968997,
|
||||
"Git Revision List": 461881235,
|
||||
"Gleam": 1054258749,
|
||||
"Glyph": 130,
|
||||
"Glyph Bitmap Distribution Format": 997665271,
|
||||
@ -269,6 +275,7 @@ var IDByLanguage = map[string]int{
|
||||
"JavaScript": 183,
|
||||
"JavaScript+ERB": 914318960,
|
||||
"Jest Snapshot": 774635084,
|
||||
"JetBrains MPS": 465165328,
|
||||
"Jinja": 147,
|
||||
"Jison": 284531423,
|
||||
"Jison Lex": 406395330,
|
||||
@ -423,6 +430,7 @@ var IDByLanguage = map[string]int{
|
||||
"Pod 6": 155357471,
|
||||
"PogoScript": 289,
|
||||
"Pony": 290,
|
||||
"Portugol": 832391833,
|
||||
"PostCSS": 262764437,
|
||||
"PostScript": 291,
|
||||
"PowerBuilder": 292,
|
||||
@ -496,6 +504,8 @@ var IDByLanguage = map[string]int{
|
||||
"SQLPL": 334,
|
||||
"SRecode Template": 335,
|
||||
"SSH Config": 554920715,
|
||||
"STAR": 424510560,
|
||||
"STL": 455361735,
|
||||
"STON": 336,
|
||||
"SVG": 337,
|
||||
"SWIG": 1066250075,
|
||||
@ -589,6 +599,7 @@ var IDByLanguage = map[string]int{
|
||||
"WebIDL": 395,
|
||||
"WebVTT": 658679714,
|
||||
"Wget Config": 668457123,
|
||||
"Whiley": 888779559,
|
||||
"Wikitext": 228,
|
||||
"Win32 Message File": 950967261,
|
||||
"Windows Registry Entries": 969674868,
|
||||
@ -616,6 +627,7 @@ var IDByLanguage = map[string]int{
|
||||
"YARA": 805122868,
|
||||
"YASnippet": 378760102,
|
||||
"Yacc": 409,
|
||||
"Yul": 237469033,
|
||||
"ZAP": 952972794,
|
||||
"ZIL": 973483626,
|
||||
"Zeek": 40,
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -13,6 +13,7 @@ var LanguagesByInterpreter = map[string][]string{
|
||||
"asy": {"Asymptote"},
|
||||
"awk": {"Awk"},
|
||||
"bash": {"Shell"},
|
||||
"bb": {"Clojure"},
|
||||
"bigloo": {"Scheme"},
|
||||
"boogie": {"Boogie"},
|
||||
"boolector": {"SMT"},
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -584,6 +584,27 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 15,
|
||||
},
|
||||
1067292663: LanguageInfo{
|
||||
Name: "Antlers",
|
||||
FSName: "",
|
||||
Type: TypeForString("markup"),
|
||||
Color: "#ff269e",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".antlers.html",
|
||||
".antlers.php",
|
||||
".antlers.xml",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "text.html.statamic",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 1067292663,
|
||||
},
|
||||
16: LanguageInfo{
|
||||
Name: "ApacheConf",
|
||||
FSName: "",
|
||||
@ -1070,6 +1091,25 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 321200902,
|
||||
},
|
||||
1055528081: LanguageInfo{
|
||||
Name: "Bikeshed",
|
||||
FSName: "",
|
||||
Type: TypeForString("markup"),
|
||||
Color: "#5562ac",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".bs",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "text/html",
|
||||
TMScope: "source.csswg",
|
||||
AceMode: "html",
|
||||
CodeMirrorMode: "htmlmixed",
|
||||
Wrap: false,
|
||||
LanguageID: 1055528081,
|
||||
},
|
||||
31: LanguageInfo{
|
||||
Name: "Bison",
|
||||
FSName: "",
|
||||
@ -1253,6 +1293,25 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 38,
|
||||
},
|
||||
943571030: LanguageInfo{
|
||||
Name: "BrighterScript",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "#66AABB",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".bs",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.brs",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 943571030,
|
||||
},
|
||||
39: LanguageInfo{
|
||||
Name: "Brightscript",
|
||||
FSName: "",
|
||||
@ -1266,7 +1325,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.brightscript",
|
||||
TMScope: "source.brs",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
@ -1420,6 +1479,27 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 45,
|
||||
},
|
||||
390788699: LanguageInfo{
|
||||
Name: "CAP CDS",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "#0092d1",
|
||||
Group: "",
|
||||
Aliases: []string{
|
||||
"cds",
|
||||
},
|
||||
Extensions: []string{
|
||||
".cds",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.cds",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 390788699,
|
||||
},
|
||||
29176339: LanguageInfo{
|
||||
Name: "CIL",
|
||||
FSName: "",
|
||||
@ -1816,6 +1896,51 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 56,
|
||||
},
|
||||
372063053: LanguageInfo{
|
||||
Name: "Checksums",
|
||||
FSName: "",
|
||||
Type: TypeForString("data"),
|
||||
Color: "",
|
||||
Group: "",
|
||||
Aliases: []string{
|
||||
"checksum",
|
||||
"hash",
|
||||
"hashes",
|
||||
"sum",
|
||||
"sums",
|
||||
},
|
||||
Extensions: []string{
|
||||
".crc32",
|
||||
".md2",
|
||||
".md4",
|
||||
".md5",
|
||||
".sha1",
|
||||
".sha2",
|
||||
".sha224",
|
||||
".sha256",
|
||||
".sha256sum",
|
||||
".sha3",
|
||||
".sha384",
|
||||
".sha512",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{
|
||||
"MD5SUMS",
|
||||
"SHA1SUMS",
|
||||
"SHA256SUMS",
|
||||
"SHA256SUMS.txt",
|
||||
"SHA512SUMS",
|
||||
"checksums.txt",
|
||||
"cksums",
|
||||
"md5sum.txt",
|
||||
},
|
||||
MimeType: "",
|
||||
TMScope: "text.checksums",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 372063053,
|
||||
},
|
||||
57: LanguageInfo{
|
||||
Name: "ChucK",
|
||||
FSName: "",
|
||||
@ -1961,6 +2086,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".clj",
|
||||
".bb",
|
||||
".boot",
|
||||
".cl2",
|
||||
".cljc",
|
||||
@ -1970,7 +2096,9 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
".cljx",
|
||||
".hic",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Interpreters: []string{
|
||||
"bb",
|
||||
},
|
||||
Filenames: []string{
|
||||
"riemann.config",
|
||||
},
|
||||
@ -3328,6 +3456,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
},
|
||||
Extensions: []string{
|
||||
".fst",
|
||||
".fsti",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
@ -4239,6 +4368,27 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 807968997,
|
||||
},
|
||||
461881235: LanguageInfo{
|
||||
Name: "Git Revision List",
|
||||
FSName: "",
|
||||
Type: TypeForString("data"),
|
||||
Color: "#F44D27",
|
||||
Group: "",
|
||||
Aliases: []string{
|
||||
"Git Blame Ignore Revs",
|
||||
},
|
||||
Extensions: []string{},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{
|
||||
".git-blame-ignore-revs",
|
||||
},
|
||||
MimeType: "",
|
||||
TMScope: "source.git-revlist",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 461881235,
|
||||
},
|
||||
1054258749: LanguageInfo{
|
||||
Name: "Gleam",
|
||||
FSName: "",
|
||||
@ -5115,8 +5265,11 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{
|
||||
".coveragerc",
|
||||
".flake8",
|
||||
".pylintrc",
|
||||
"buildozer.spec",
|
||||
"pylintrc",
|
||||
},
|
||||
MimeType: "text/x-properties",
|
||||
TMScope: "source.ini",
|
||||
@ -5415,14 +5568,20 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
LanguageID: 173,
|
||||
},
|
||||
174: LanguageInfo{
|
||||
Name: "JSON",
|
||||
FSName: "",
|
||||
Type: TypeForString("data"),
|
||||
Color: "#292929",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Name: "JSON",
|
||||
FSName: "",
|
||||
Type: TypeForString("data"),
|
||||
Color: "#292929",
|
||||
Group: "",
|
||||
Aliases: []string{
|
||||
"geojson",
|
||||
"jsonl",
|
||||
"topojson",
|
||||
},
|
||||
Extensions: []string{
|
||||
".json",
|
||||
".4DForm",
|
||||
".4DProject",
|
||||
".avsc",
|
||||
".geojson",
|
||||
".gltf",
|
||||
@ -5490,6 +5649,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{
|
||||
".babelrc",
|
||||
".devcontainer.json",
|
||||
".eslintrc.json",
|
||||
".jscsrc",
|
||||
".jshintrc",
|
||||
@ -5762,6 +5922,29 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 774635084,
|
||||
},
|
||||
465165328: LanguageInfo{
|
||||
Name: "JetBrains MPS",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "#21D789",
|
||||
Group: "",
|
||||
Aliases: []string{
|
||||
"mps",
|
||||
},
|
||||
Extensions: []string{
|
||||
".mps",
|
||||
".mpl",
|
||||
".msd",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "text/xml",
|
||||
TMScope: "none",
|
||||
AceMode: "xml",
|
||||
CodeMirrorMode: "xml",
|
||||
Wrap: false,
|
||||
LanguageID: 465165328,
|
||||
},
|
||||
147: LanguageInfo{
|
||||
Name: "Jinja",
|
||||
FSName: "",
|
||||
@ -6030,6 +6213,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
"eeschema schematic",
|
||||
},
|
||||
Extensions: []string{
|
||||
".kicad_sch",
|
||||
".sch",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
@ -6207,6 +6391,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".lvproj",
|
||||
".lvclass",
|
||||
".lvlib",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
@ -6968,6 +7153,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
},
|
||||
Extensions: []string{
|
||||
".md",
|
||||
".livemd",
|
||||
".markdown",
|
||||
".mdown",
|
||||
".mdwn",
|
||||
@ -9056,6 +9242,25 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 290,
|
||||
},
|
||||
832391833: LanguageInfo{
|
||||
Name: "Portugol",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "#f8bd00",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".por",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.portugol",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 832391833,
|
||||
},
|
||||
262764437: LanguageInfo{
|
||||
Name: "PostCSS",
|
||||
FSName: "",
|
||||
@ -10764,6 +10969,47 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 554920715,
|
||||
},
|
||||
424510560: LanguageInfo{
|
||||
Name: "STAR",
|
||||
FSName: "",
|
||||
Type: TypeForString("data"),
|
||||
Color: "",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".star",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.star",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 424510560,
|
||||
},
|
||||
455361735: LanguageInfo{
|
||||
Name: "STL",
|
||||
FSName: "",
|
||||
Type: TypeForString("data"),
|
||||
Color: "#373b5e",
|
||||
Group: "",
|
||||
Aliases: []string{
|
||||
"ascii stl",
|
||||
"stla",
|
||||
},
|
||||
Extensions: []string{
|
||||
".stl",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.stl",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 455361735,
|
||||
},
|
||||
336: LanguageInfo{
|
||||
Name: "STON",
|
||||
FSName: "",
|
||||
@ -11488,6 +11734,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
},
|
||||
Extensions: []string{
|
||||
".bzl",
|
||||
".star",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{
|
||||
@ -11794,7 +12041,7 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Name: "TSX",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "#2b7489",
|
||||
Color: "#3178c6",
|
||||
Group: "TypeScript",
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
@ -12189,13 +12436,15 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Name: "TypeScript",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "#2b7489",
|
||||
Color: "#3178c6",
|
||||
Group: "",
|
||||
Aliases: []string{
|
||||
"ts",
|
||||
},
|
||||
Extensions: []string{
|
||||
".ts",
|
||||
".cts",
|
||||
".mts",
|
||||
},
|
||||
Interpreters: []string{
|
||||
"deno",
|
||||
@ -12254,12 +12503,16 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
LanguageID: 380,
|
||||
},
|
||||
120: LanguageInfo{
|
||||
Name: "Unix Assembly",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "",
|
||||
Group: "Assembly",
|
||||
Aliases: []string{},
|
||||
Name: "Unix Assembly",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "",
|
||||
Group: "Assembly",
|
||||
Aliases: []string{
|
||||
"gas",
|
||||
"gnu asm",
|
||||
"unix asm",
|
||||
},
|
||||
Extensions: []string{
|
||||
".s",
|
||||
".ms",
|
||||
@ -12773,19 +13026,21 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
LanguageID: 395,
|
||||
},
|
||||
658679714: LanguageInfo{
|
||||
Name: "WebVTT",
|
||||
FSName: "",
|
||||
Type: TypeForString("data"),
|
||||
Color: "",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Name: "WebVTT",
|
||||
FSName: "",
|
||||
Type: TypeForString("data"),
|
||||
Color: "",
|
||||
Group: "",
|
||||
Aliases: []string{
|
||||
"vtt",
|
||||
},
|
||||
Extensions: []string{
|
||||
".vtt",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.vtt",
|
||||
TMScope: "text.vtt",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: true,
|
||||
@ -12812,6 +13067,25 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 668457123,
|
||||
},
|
||||
888779559: LanguageInfo{
|
||||
Name: "Whiley",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "#d5c397",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".whiley",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.whiley",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 888779559,
|
||||
},
|
||||
228: LanguageInfo{
|
||||
Name: "Wikitext",
|
||||
FSName: "",
|
||||
@ -13502,6 +13776,25 @@ var LanguageInfoByID = map[int]LanguageInfo{
|
||||
Wrap: false,
|
||||
LanguageID: 409,
|
||||
},
|
||||
237469033: LanguageInfo{
|
||||
Name: "Yul",
|
||||
FSName: "",
|
||||
Type: TypeForString("programming"),
|
||||
Color: "#794932",
|
||||
Group: "",
|
||||
Aliases: []string{},
|
||||
Extensions: []string{
|
||||
".yul",
|
||||
},
|
||||
Interpreters: []string{},
|
||||
Filenames: []string{},
|
||||
MimeType: "",
|
||||
TMScope: "source.yul",
|
||||
AceMode: "text",
|
||||
CodeMirrorMode: "",
|
||||
Wrap: false,
|
||||
LanguageID: 237469033,
|
||||
},
|
||||
952972794: LanguageInfo{
|
||||
Name: "ZAP",
|
||||
FSName: "",
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -16,6 +16,7 @@ var LanguagesMime = map[string]string{
|
||||
"Asymptote": "text/x-kotlin",
|
||||
"Beef": "text/x-csharp",
|
||||
"BibTeX": "text/x-stex",
|
||||
"Bikeshed": "text/html",
|
||||
"Brainfuck": "text/x-brainfuck",
|
||||
"C": "text/x-csrc",
|
||||
"C#": "text/x-csharp",
|
||||
@ -111,6 +112,7 @@ var LanguagesMime = map[string]string{
|
||||
"JavaScript": "text/javascript",
|
||||
"JavaScript+ERB": "application/javascript",
|
||||
"Jest Snapshot": "application/javascript",
|
||||
"JetBrains MPS": "text/xml",
|
||||
"Jinja": "text/x-django",
|
||||
"Julia": "text/x-julia",
|
||||
"Jupyter Notebook": "application/json",
|
||||
|
14
data/type.go
14
data/type.go
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -72,6 +72,7 @@ var LanguagesType = map[string]int{
|
||||
"Altium Designer": 1,
|
||||
"AngelScript": 2,
|
||||
"Ant Build System": 1,
|
||||
"Antlers": 3,
|
||||
"ApacheConf": 1,
|
||||
"Apex": 2,
|
||||
"Apollo Guidance Computer": 2,
|
||||
@ -95,6 +96,7 @@ var LanguagesType = map[string]int{
|
||||
"Berry": 2,
|
||||
"BibTeX": 3,
|
||||
"Bicep": 2,
|
||||
"Bikeshed": 3,
|
||||
"Bison": 2,
|
||||
"BitBake": 2,
|
||||
"Blade": 3,
|
||||
@ -104,6 +106,7 @@ var LanguagesType = map[string]int{
|
||||
"Boo": 2,
|
||||
"Boogie": 2,
|
||||
"Brainfuck": 2,
|
||||
"BrighterScript": 2,
|
||||
"Brightscript": 2,
|
||||
"Browserslist": 1,
|
||||
"C": 2,
|
||||
@ -111,6 +114,7 @@ var LanguagesType = map[string]int{
|
||||
"C++": 2,
|
||||
"C-ObjDump": 1,
|
||||
"C2hs Haskell": 2,
|
||||
"CAP CDS": 2,
|
||||
"CIL": 1,
|
||||
"CLIPS": 2,
|
||||
"CMake": 2,
|
||||
@ -131,6 +135,7 @@ var LanguagesType = map[string]int{
|
||||
"Ceylon": 2,
|
||||
"Chapel": 2,
|
||||
"Charity": 2,
|
||||
"Checksums": 1,
|
||||
"ChucK": 2,
|
||||
"Cirru": 2,
|
||||
"Clarion": 2,
|
||||
@ -244,6 +249,7 @@ var LanguagesType = map[string]int{
|
||||
"Gherkin": 2,
|
||||
"Git Attributes": 1,
|
||||
"Git Config": 1,
|
||||
"Git Revision List": 1,
|
||||
"Gleam": 2,
|
||||
"Glyph": 2,
|
||||
"Glyph Bitmap Distribution Format": 1,
|
||||
@ -311,6 +317,7 @@ var LanguagesType = map[string]int{
|
||||
"JavaScript": 2,
|
||||
"JavaScript+ERB": 2,
|
||||
"Jest Snapshot": 1,
|
||||
"JetBrains MPS": 2,
|
||||
"Jinja": 3,
|
||||
"Jison": 2,
|
||||
"Jison Lex": 2,
|
||||
@ -465,6 +472,7 @@ var LanguagesType = map[string]int{
|
||||
"Pod 6": 4,
|
||||
"PogoScript": 2,
|
||||
"Pony": 2,
|
||||
"Portugol": 2,
|
||||
"PostCSS": 3,
|
||||
"PostScript": 3,
|
||||
"PowerBuilder": 2,
|
||||
@ -538,6 +546,8 @@ var LanguagesType = map[string]int{
|
||||
"SQLPL": 2,
|
||||
"SRecode Template": 3,
|
||||
"SSH Config": 1,
|
||||
"STAR": 1,
|
||||
"STL": 1,
|
||||
"STON": 1,
|
||||
"SVG": 1,
|
||||
"SWIG": 2,
|
||||
@ -631,6 +641,7 @@ var LanguagesType = map[string]int{
|
||||
"WebIDL": 2,
|
||||
"WebVTT": 1,
|
||||
"Wget Config": 1,
|
||||
"Whiley": 2,
|
||||
"Wikitext": 4,
|
||||
"Win32 Message File": 1,
|
||||
"Windows Registry Entries": 1,
|
||||
@ -658,6 +669,7 @@ var LanguagesType = map[string]int{
|
||||
"YARA": 2,
|
||||
"YASnippet": 3,
|
||||
"Yacc": 2,
|
||||
"Yul": 2,
|
||||
"ZAP": 2,
|
||||
"ZIL": 2,
|
||||
"Zeek": 2,
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -171,4 +171,8 @@ var VendorMatchers = []regex.EnryRegexp{
|
||||
regex.MustCompile(`(^|/)\.google_apis/`),
|
||||
regex.MustCompile(`(^|/)Jenkinsfile$`),
|
||||
regex.MustCompile(`(^|/)\.gitpod\.Dockerfile$`),
|
||||
regex.MustCompile(`(^|/)\.github/`),
|
||||
}
|
||||
|
||||
// FastVendorMatcher is equivalent to matching any of the VendorMatchers.
|
||||
var FastVendorMatcher = regex.MustCompile(`(?:^(?:(?:[Dd]ependencies/)|(?:debian/)|(?:deps/)|(?:rebar$)))|(?:(?:^|/)(?:(?:BuddyBuildSDK\.framework/)|(?:Carthage/)|(?:Chart\.js$)|(?:Control\.FullScreen\.css)|(?:Control\.FullScreen\.js)|(?:Crashlytics\.framework/)|(?:Fabric\.framework/)|(?:Godeps/_workspace/)|(?:Jenkinsfile$)|(?:Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$)|(?:MathJax/)|(?:MochiKit\.js$)|(?:RealmSwift\.framework)|(?:Realm\.framework)|(?:Sparkle/)|(?:Vagrantfile$)|(?:[Bb]ourbon/.*\.(css|less|scss|styl)$)|(?:[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo))|(?:[Ee]xtern(als?)?/)|(?:[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$)|(?:[Pp]ackages\/.+\.\d+\/)|(?:[Ss]pecs?/fixtures/)|(?:[Tt]ests?/fixtures/)|(?:[Vv]+endor/)|(?:\.[Dd][Ss]_[Ss]tore$)|(?:\.gitattributes$)|(?:\.github/)|(?:\.gitignore$)|(?:\.gitmodules$)|(?:\.gitpod\.Dockerfile$)|(?:\.google_apis/)|(?:\.indent\.pro)|(?:\.mvn/wrapper/)|(?:\.osx$)|(?:\.sublime-project)|(?:\.sublime-workspace)|(?:\.vscode/)|(?:\.yarn/plugins/)|(?:\.yarn/releases/)|(?:\.yarn/sdks/)|(?:\.yarn/unplugged/)|(?:\.yarn/versions/)|(?:_esy$)|(?:ace-builds/)|(?:aclocal\.m4)|(?:activator$)|(?:activator\.bat$)|(?:admin_media/)|(?:angular([^.]*)\.js$)|(?:animate\.(css|less|scss|styl)$)|(?:bootbox\.js)|(?:bootstrap([^/.]*)\.(js|css|less|scss|styl)$)|(?:bootstrap-datepicker/)|(?:bower_components/)|(?:bulma\.(css|sass|scss)$)|(?:cache/)|(?:ckeditor\.js$)|(?:config\.guess$)|(?:config\.sub$)|(?:configure$)|(?:controls\.js$)|(?:cordova([^.]*)\.js$)|(?:cordova\-\d\.\d(\.\d)?\.js$)|(?:cpplint\.py)|(?:custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$)|(?:dist/)|(?:docs?/_?(build|themes?|templates?|static)/)|(?:dojo\.js$)|(?:dotnet-install\.(ps1|sh)$)|(?:dragdrop\.js$)|(?:effects\.js$)|(?:env/)|(?:erlang\.mk)|(?:extjs/.*?\.html$)|(?:extjs/.*?\.js$)|(?:extjs/.*?\.properties$)|(?:extjs/.*?\.txt$)|(?:extjs/.*?\.xml$)|(?:extjs/\.sencha/)|(?:extjs/builds/)|(?:extjs/cmd/)|(?:extjs/docs/)|(?:extjs/examples/)|(?:extjs/locale/)|(?:extjs/packages/)|(?:extjs/plugins/)|(?:extjs/resources/)|(?:extjs/src/)|(?:extjs/welcome/)|(?:fabfile\.py$)|(?:flow-typed/.*\.js$)|(?:font-?awesome/.*\.(css|less|scss|styl)$)|(?:font-?awesome\.(css|less|scss|styl)$)|(?:fontello(.*?)\.css$)|(?:foundation(\..*)?\.js$)|(?:foundation\.(css|less|scss|styl)$)|(?:fuelux\.js)|(?:gradle/wrapper/)|(?:gradlew$)|(?:gradlew\.bat$)|(?:html5shiv\.js$)|(?:inst/extdata/)|(?:jquery([^.]*)\.js$)|(?:jquery([^.]*)\.unobtrusive\-ajax\.js$)|(?:jquery([^.]*)\.validate(\.unobtrusive)?\.js$)|(?:jquery\-\d\.\d+(\.\d+)?\.js$)|(?:jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$)|(?:jquery\.(ui|effects)\.([^.]*)\.(js|css)$)|(?:jquery\.dataTables\.js)|(?:jquery\.fancybox\.(js|css))|(?:jquery\.fileupload(-\w+)?\.js$)|(?:jquery\.fn\.gantt\.js)|(?:knockout-(\d+\.){3}(debug\.)?js$)|(?:leaflet\.draw-src\.js)|(?:leaflet\.draw\.css)|(?:leaflet\.spin\.js)|(?:libtool\.m4)|(?:ltoptions\.m4)|(?:ltsugar\.m4)|(?:ltversion\.m4)|(?:lt~obsolete\.m4)|(?:materialize\.(css|less|scss|styl|js)$)|(?:modernizr\-\d\.\d+(\.\d+)?\.js$)|(?:modernizr\.custom\.\d+\.js$)|(?:mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$)|(?:mvnw$)|(?:mvnw\.cmd$)|(?:node_modules/)|(?:normalize\.(css|less|scss|styl)$)|(?:octicons\.css)|(?:pdf\.worker\.js)|(?:proguard-rules\.pro$)|(?:proguard\.pro$)|(?:prototype(.*)\.js$)|(?:puphpet/)|(?:react(-[^.]*)?\.js$)|(?:run\.n$)|(?:select2/.*\.(css|scss|js)$)|(?:shBrush([^.]*)\.js$)|(?:shCore\.js$)|(?:shLegacy\.js$)|(?:skeleton\.(css|less|scss|styl)$)|(?:slick\.\w+.js$)|(?:sprockets-octicons\.scss)|(?:testdata/)|(?:tiny_mce([^.]*)\.js$)|(?:tiny_mce/(langs|plugins|themes|utils))|(?:vendors?/)|(?:vignettes/)|(?:waf$)|(?:wicket-leaflet\.js)|(?:yahoo-([^.]*)\.js$)|(?:yui([^.]*)\.js$)))|(?:(.*?)\.d\.ts$)|(?:(3rd|[Tt]hird)[-_]?[Pp]arty/)|(?:([^\s]*)import\.(css|less|scss|styl)$)|(?:(\.|-)min\.(js|css)$)|(?:(^|\/)d3(\.v\d+)?([^.]*)\.js$)|(?:-vsdoc\.js$)|(?:\.imageset/)|(?:\.intellisense\.js$)|(?:\.xctemplate/)`)
|
||||
|
14
enry.go
14
enry.go
@ -14,3 +14,17 @@
|
||||
package enry // import "github.com/go-enry/go-enry/v2"
|
||||
|
||||
//go:generate make code-generate
|
||||
|
||||
import "github.com/go-enry/go-enry/v2/data"
|
||||
|
||||
// Type represent language's type. Either data, programming, markup, prose, or unknown.
|
||||
type Type int
|
||||
|
||||
// Type's values.
|
||||
const (
|
||||
Unknown Type = Type(data.TypeUnknown)
|
||||
Data = Type(data.TypeData)
|
||||
Programming = Type(data.TypeProgramming)
|
||||
Markup = Type(data.TypeMarkup)
|
||||
Prose = Type(data.TypeProse)
|
||||
)
|
||||
|
@ -22,8 +22,9 @@ func LanguageByAlias(langOrAlias string) (lang string, ok bool) {
|
||||
|
||||
// convertToAliasKey converts language name to a key in LanguageByAliasMap.
|
||||
// Following
|
||||
// - internal.code-generator.generator.convertToAliasKey()
|
||||
// - GetLanguageByAlias()
|
||||
// - internal.code-generator.generator.convertToAliasKey()
|
||||
// - GetLanguageByAlias()
|
||||
//
|
||||
// conventions.
|
||||
// It is here to avoid dependency on "generate" and "enry" packages.
|
||||
func convertToAliasKey(langName string) string {
|
||||
|
@ -7,3 +7,6 @@ var VendorMatchers = []regex.EnryRegexp{
|
||||
regex.MustCompile(`{{ $regexp }}`),
|
||||
{{end -}}
|
||||
}
|
||||
|
||||
// FastVendorMatcher is equivalent to matching any of the VendorMatchers.
|
||||
var FastVendorMatcher = regex.MustCompile(`{{ optimize . }}`)
|
@ -19,7 +19,7 @@ import (
|
||||
var (
|
||||
linguistURL = "https://github.com/github/linguist.git"
|
||||
linguistClonedEnvVar = "ENRY_TEST_REPO"
|
||||
commit = "4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26"
|
||||
commit = "d7799da826e01acdb8f84694d33116dccaabe9c2"
|
||||
samplesDir = "samples"
|
||||
languagesFile = filepath.Join("lib", "linguist", "languages.yml")
|
||||
|
||||
@ -97,9 +97,9 @@ var (
|
||||
|
||||
type GeneratorTestSuite struct {
|
||||
suite.Suite
|
||||
tmpLinguist string
|
||||
cloned bool
|
||||
testCases []testCase
|
||||
tmpLinguistDir string
|
||||
isCleanupNeeded bool
|
||||
testCases []testCase
|
||||
}
|
||||
|
||||
type testCase struct {
|
||||
@ -121,28 +121,32 @@ func Test_GeneratorTestSuite(t *testing.T) {
|
||||
|
||||
func (s *GeneratorTestSuite) maybeCloneLinguist() {
|
||||
var err error
|
||||
s.tmpLinguist = os.Getenv(linguistClonedEnvVar)
|
||||
s.cloned = s.tmpLinguist == ""
|
||||
if s.cloned {
|
||||
s.tmpLinguist, err = ioutil.TempDir("", "linguist-")
|
||||
assert.NoError(s.T(), err)
|
||||
cmd := exec.Command("git", "clone", linguistURL, s.tmpLinguist)
|
||||
s.tmpLinguistDir = os.Getenv(linguistClonedEnvVar)
|
||||
isLinguistCloned := s.tmpLinguistDir != ""
|
||||
if !isLinguistCloned {
|
||||
s.tmpLinguistDir, err = ioutil.TempDir("", "linguist-")
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
s.T().Logf("Cloning Linguist repo to '%s' as %s was not set\n",
|
||||
s.tmpLinguistDir, linguistClonedEnvVar)
|
||||
cmd := exec.Command("git", "clone", "--depth", "100", linguistURL, s.tmpLinguistDir)
|
||||
err = cmd.Run()
|
||||
assert.NoError(s.T(), err)
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
assert.NoError(s.T(), err)
|
||||
|
||||
err = os.Chdir(s.tmpLinguist)
|
||||
assert.NoError(s.T(), err)
|
||||
|
||||
cmd = exec.Command("git", "checkout", commit)
|
||||
err = cmd.Run()
|
||||
assert.NoError(s.T(), err)
|
||||
|
||||
err = os.Chdir(cwd)
|
||||
assert.NoError(s.T(), err)
|
||||
require.NoError(s.T(), err)
|
||||
s.isCleanupNeeded = true
|
||||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
err = os.Chdir(s.tmpLinguistDir)
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
cmd := exec.Command("git", "checkout", commit)
|
||||
err = cmd.Run()
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
err = os.Chdir(cwd)
|
||||
require.NoError(s.T(), err)
|
||||
}
|
||||
|
||||
func (s *GeneratorTestSuite) SetupSuite() {
|
||||
@ -150,7 +154,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
s.testCases = []testCase{
|
||||
{
|
||||
name: "Extensions()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, languagesFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, languagesFile),
|
||||
samplesDir: "",
|
||||
tmplPath: extensionTestTmplPath,
|
||||
tmplName: extensionTestTmplName,
|
||||
@ -160,7 +164,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Heuristics()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, heuristicsTestFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, heuristicsTestFile),
|
||||
samplesDir: "",
|
||||
tmplPath: contentTestTmplPath,
|
||||
tmplName: contentTestTmplName,
|
||||
@ -170,7 +174,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Vendor()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, vendorTestFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, vendorTestFile),
|
||||
samplesDir: "",
|
||||
tmplPath: vendorTestTmplPath,
|
||||
tmplName: vendorTestTmplName,
|
||||
@ -180,7 +184,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Documentation()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, documentationTestFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, documentationTestFile),
|
||||
samplesDir: "",
|
||||
tmplPath: documentationTestTmplPath,
|
||||
tmplName: documentationTestTmplName,
|
||||
@ -190,7 +194,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Types()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, languagesFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, languagesFile),
|
||||
samplesDir: "",
|
||||
tmplPath: typeTestTmplPath,
|
||||
tmplName: typeTestTmplName,
|
||||
@ -200,7 +204,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Interpreters()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, languagesFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, languagesFile),
|
||||
samplesDir: "",
|
||||
tmplPath: interpreterTestTmplPath,
|
||||
tmplName: interpreterTestTmplName,
|
||||
@ -210,8 +214,8 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Filenames()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, languagesFile),
|
||||
samplesDir: filepath.Join(s.tmpLinguist, samplesDir),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, languagesFile),
|
||||
samplesDir: filepath.Join(s.tmpLinguistDir, samplesDir),
|
||||
tmplPath: filenameTestTmplPath,
|
||||
tmplName: filenameTestTmplName,
|
||||
commit: commit,
|
||||
@ -220,7 +224,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Aliases()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, languagesFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, languagesFile),
|
||||
samplesDir: "",
|
||||
tmplPath: aliasTestTmplPath,
|
||||
tmplName: aliasTestTmplName,
|
||||
@ -230,7 +234,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Frequencies()",
|
||||
samplesDir: filepath.Join(s.tmpLinguist, samplesDir),
|
||||
samplesDir: filepath.Join(s.tmpLinguistDir, samplesDir),
|
||||
tmplPath: frequenciesTestTmplPath,
|
||||
tmplName: frequenciesTestTmplName,
|
||||
commit: commit,
|
||||
@ -248,7 +252,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "MimeType()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, languagesFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, languagesFile),
|
||||
samplesDir: "",
|
||||
tmplPath: mimeTypeTestTmplPath,
|
||||
tmplName: mimeTypeTestTmplName,
|
||||
@ -258,7 +262,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Colors()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, languagesFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, languagesFile),
|
||||
samplesDir: "",
|
||||
tmplPath: colorsTestTmplPath,
|
||||
tmplName: colorsTestTmplName,
|
||||
@ -268,7 +272,7 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
},
|
||||
{
|
||||
name: "Groups()",
|
||||
fileToParse: filepath.Join(s.tmpLinguist, languagesFile),
|
||||
fileToParse: filepath.Join(s.tmpLinguistDir, languagesFile),
|
||||
samplesDir: "",
|
||||
tmplPath: groupsTestTmplPath,
|
||||
tmplName: groupsTestTmplName,
|
||||
@ -280,11 +284,9 @@ func (s *GeneratorTestSuite) SetupSuite() {
|
||||
}
|
||||
|
||||
func (s *GeneratorTestSuite) TearDownSuite() {
|
||||
if s.cloned {
|
||||
err := os.RemoveAll(s.tmpLinguist)
|
||||
if err != nil {
|
||||
s.T().Logf("Failed to clean up %s after the test.\n", s.tmpLinguist)
|
||||
}
|
||||
if s.isCleanupNeeded {
|
||||
err := os.RemoveAll(s.tmpLinguistDir)
|
||||
assert.NoError(s.T(), err)
|
||||
}
|
||||
}
|
||||
|
||||
@ -331,7 +333,7 @@ func (s *GeneratorTestSuite) TestGenerationFiles() {
|
||||
|
||||
func (s *GeneratorTestSuite) TestTokenizerOnATS() {
|
||||
const suspiciousSample = "samples/ATS/csv_parse.hats"
|
||||
sFile := filepath.Join(s.tmpLinguist, suspiciousSample)
|
||||
sFile := filepath.Join(s.tmpLinguistDir, suspiciousSample)
|
||||
content, err := ioutil.ReadFile(sFile)
|
||||
require.NoError(s.T(), err)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -44,6 +44,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"amusewiki": "Muse",
|
||||
"angelscript": "AngelScript",
|
||||
"ant_build_system": "Ant Build System",
|
||||
"antlers": "Antlers",
|
||||
"antlr": "ANTLR",
|
||||
"apache": "ApacheConf",
|
||||
"apacheconf": "ApacheConf",
|
||||
@ -56,6 +57,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"arc": "Arc",
|
||||
"arexx": "REXX",
|
||||
"as3": "ActionScript",
|
||||
"ascii_stl": "STL",
|
||||
"asciidoc": "AsciiDoc",
|
||||
"asl": "ASL",
|
||||
"asm": "Assembly",
|
||||
@ -94,6 +96,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"berry": "Berry",
|
||||
"bibtex": "BibTeX",
|
||||
"bicep": "Bicep",
|
||||
"bikeshed": "Bikeshed",
|
||||
"bison": "Bison",
|
||||
"bitbake": "BitBake",
|
||||
"blade": "Blade",
|
||||
@ -107,6 +110,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"boogie": "Boogie",
|
||||
"bplus": "BlitzBasic",
|
||||
"brainfuck": "Brainfuck",
|
||||
"brighterscript": "BrighterScript",
|
||||
"brightscript": "Brightscript",
|
||||
"bro": "Zeek",
|
||||
"browserslist": "Browserslist",
|
||||
@ -128,14 +132,18 @@ var LanguageByAliasMap = map[string]string{
|
||||
"cakescript": "C#",
|
||||
"cameligo": "CameLIGO",
|
||||
"cap'n_proto": "Cap'n Proto",
|
||||
"cap_cds": "CAP CDS",
|
||||
"carto": "CartoCSS",
|
||||
"cartocss": "CartoCSS",
|
||||
"cds": "CAP CDS",
|
||||
"ceylon": "Ceylon",
|
||||
"cfc": "ColdFusion CFC",
|
||||
"cfm": "ColdFusion",
|
||||
"cfml": "ColdFusion",
|
||||
"chapel": "Chapel",
|
||||
"charity": "Charity",
|
||||
"checksum": "Checksums",
|
||||
"checksums": "Checksums",
|
||||
"chpl": "Chapel",
|
||||
"chuck": "ChucK",
|
||||
"cil": "CIL",
|
||||
@ -293,6 +301,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"gaml": "GAML",
|
||||
"gams": "GAMS",
|
||||
"gap": "GAP",
|
||||
"gas": "Unix Assembly",
|
||||
"gcc_machine_description": "GCC Machine Description",
|
||||
"gdb": "GDB",
|
||||
"gdscript": "GDScript",
|
||||
@ -304,13 +313,16 @@ var LanguageByAliasMap = map[string]string{
|
||||
"genshi": "Genshi",
|
||||
"gentoo_ebuild": "Gentoo Ebuild",
|
||||
"gentoo_eclass": "Gentoo Eclass",
|
||||
"geojson": "JSON",
|
||||
"gerber_image": "Gerber Image",
|
||||
"gettext_catalog": "Gettext Catalog",
|
||||
"gf": "Grammatical Framework",
|
||||
"gherkin": "Gherkin",
|
||||
"git-ignore": "Ignore List",
|
||||
"git_attributes": "Git Attributes",
|
||||
"git_blame_ignore_revs": "Git Revision List",
|
||||
"git_config": "Git Config",
|
||||
"git_revision_list": "Git Revision List",
|
||||
"gitattributes": "Git Attributes",
|
||||
"gitconfig": "Git Config",
|
||||
"gitignore": "Ignore List",
|
||||
@ -320,6 +332,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"glyph": "Glyph",
|
||||
"glyph_bitmap_distribution_format": "Glyph Bitmap Distribution Format",
|
||||
"gn": "GN",
|
||||
"gnu_asm": "Unix Assembly",
|
||||
"gnuplot": "Gnuplot",
|
||||
"go": "Go",
|
||||
"go.mod": "Go Module",
|
||||
@ -347,6 +360,8 @@ var LanguageByAliasMap = map[string]string{
|
||||
"handlebars": "Handlebars",
|
||||
"haproxy": "HAProxy",
|
||||
"harbour": "Harbour",
|
||||
"hash": "Checksums",
|
||||
"hashes": "Checksums",
|
||||
"hashicorp_configuration_language": "HCL",
|
||||
"haskell": "Haskell",
|
||||
"haxe": "Haxe",
|
||||
@ -410,6 +425,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"javascript": "JavaScript",
|
||||
"javascript+erb": "JavaScript+ERB",
|
||||
"jest_snapshot": "Jest Snapshot",
|
||||
"jetbrains_mps": "JetBrains MPS",
|
||||
"jflex": "JFlex",
|
||||
"jinja": "Jinja",
|
||||
"jison": "Jison",
|
||||
@ -423,6 +439,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"json_with_comments": "JSON with Comments",
|
||||
"jsonc": "JSON with Comments",
|
||||
"jsoniq": "JSONiq",
|
||||
"jsonl": "JSON",
|
||||
"jsonld": "JSONLD",
|
||||
"jsonnet": "Jsonnet",
|
||||
"jsp": "Java Server Pages",
|
||||
@ -532,6 +549,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"moonscript": "MoonScript",
|
||||
"motoko": "Motoko",
|
||||
"motorola_68k_assembly": "Motorola 68K Assembly",
|
||||
"mps": "JetBrains MPS",
|
||||
"mql4": "MQL4",
|
||||
"mql5": "MQL5",
|
||||
"mtml": "MTML",
|
||||
@ -649,6 +667,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"pod_6": "Pod 6",
|
||||
"pogoscript": "PogoScript",
|
||||
"pony": "Pony",
|
||||
"portugol": "Portugol",
|
||||
"posh": "PowerShell",
|
||||
"postcss": "PostCSS",
|
||||
"postscr": "PostScript",
|
||||
@ -810,13 +829,18 @@ var LanguageByAliasMap = map[string]string{
|
||||
"ssh_config": "SSH Config",
|
||||
"stan": "Stan",
|
||||
"standard_ml": "Standard ML",
|
||||
"star": "STAR",
|
||||
"starlark": "Starlark",
|
||||
"stata": "Stata",
|
||||
"stl": "STL",
|
||||
"stla": "STL",
|
||||
"ston": "STON",
|
||||
"stringtemplate": "StringTemplate",
|
||||
"stylus": "Stylus",
|
||||
"subrip_text": "SubRip Text",
|
||||
"sugarss": "SugarSS",
|
||||
"sum": "Checksums",
|
||||
"sums": "Checksums",
|
||||
"supercollider": "SuperCollider",
|
||||
"svelte": "Svelte",
|
||||
"svg": "SVG",
|
||||
@ -841,6 +865,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"tla": "TLA",
|
||||
"tm-properties": "TextMate Properties",
|
||||
"toml": "TOML",
|
||||
"topojson": "JSON",
|
||||
"troff": "Roff",
|
||||
"ts": "TypeScript",
|
||||
"tsql": "TSQL",
|
||||
@ -857,6 +882,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"ultisnips": "Vim Snippet",
|
||||
"unified_parallel_c": "Unified Parallel C",
|
||||
"unity3d_asset": "Unity3D Asset",
|
||||
"unix_asm": "Unix Assembly",
|
||||
"unix_assembly": "Unix Assembly",
|
||||
"uno": "Uno",
|
||||
"unrealscript": "UnrealScript",
|
||||
@ -888,6 +914,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"visual_basic_for_applications": "VBA",
|
||||
"vlang": "V",
|
||||
"volt": "Volt",
|
||||
"vtt": "WebVTT",
|
||||
"vue": "Vue",
|
||||
"vyper": "Vyper",
|
||||
"wasm": "WebAssembly",
|
||||
@ -901,6 +928,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"webvtt": "WebVTT",
|
||||
"wget_config": "Wget Config",
|
||||
"wgetrc": "Wget Config",
|
||||
"whiley": "Whiley",
|
||||
"wiki": "Wikitext",
|
||||
"wikitext": "Wikitext",
|
||||
"win32_message_file": "Win32 Message File",
|
||||
@ -948,6 +976,7 @@ var LanguageByAliasMap = map[string]string{
|
||||
"yas": "YASnippet",
|
||||
"yasnippet": "YASnippet",
|
||||
"yml": "YAML",
|
||||
"yul": "Yul",
|
||||
"zap": "ZAP",
|
||||
"zeek": "Zeek",
|
||||
"zenscript": "ZenScript",
|
||||
@ -969,8 +998,9 @@ func LanguageByAlias(langOrAlias string) (lang string, ok bool) {
|
||||
|
||||
// convertToAliasKey converts language name to a key in LanguageByAliasMap.
|
||||
// Following
|
||||
// - internal.code-generator.generator.convertToAliasKey()
|
||||
// - GetLanguageByAlias()
|
||||
// - internal.code-generator.generator.convertToAliasKey()
|
||||
// - GetLanguageByAlias()
|
||||
//
|
||||
// conventions.
|
||||
// It is here to avoid dependency on "generate" and "enry" packages.
|
||||
func convertToAliasKey(langName string) string {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -27,6 +27,7 @@ var LanguagesColor = map[string]string{
|
||||
"Altium Designer": "#A89663",
|
||||
"AngelScript": "#C7D7DC",
|
||||
"Ant Build System": "#A9157E",
|
||||
"Antlers": "#ff269e",
|
||||
"ApacheConf": "#d12127",
|
||||
"Apex": "#1797c0",
|
||||
"Apollo Guidance Computer": "#0B3D91",
|
||||
@ -49,6 +50,7 @@ var LanguagesColor = map[string]string{
|
||||
"Berry": "#15A13C",
|
||||
"BibTeX": "#778899",
|
||||
"Bicep": "#519aba",
|
||||
"Bikeshed": "#5562ac",
|
||||
"Bison": "#6A463F",
|
||||
"BitBake": "#00bce4",
|
||||
"Blade": "#f7523f",
|
||||
@ -58,11 +60,13 @@ var LanguagesColor = map[string]string{
|
||||
"Boo": "#d4bec1",
|
||||
"Boogie": "#c80fa0",
|
||||
"Brainfuck": "#2F2530",
|
||||
"BrighterScript": "#66AABB",
|
||||
"Brightscript": "#662D91",
|
||||
"Browserslist": "#ffd539",
|
||||
"C": "#555555",
|
||||
"C#": "#178600",
|
||||
"C++": "#f34b7d",
|
||||
"CAP CDS": "#0092d1",
|
||||
"CLIPS": "#00A300",
|
||||
"CMake": "#DA3434",
|
||||
"COLLADA": "#F1A42B",
|
||||
@ -171,6 +175,7 @@ var LanguagesColor = map[string]string{
|
||||
"Gherkin": "#5B2063",
|
||||
"Git Attributes": "#F44D27",
|
||||
"Git Config": "#F44D27",
|
||||
"Git Revision List": "#F44D27",
|
||||
"Gleam": "#ffaff3",
|
||||
"Glyph": "#c1ac7f",
|
||||
"Gnuplot": "#f0a9f0",
|
||||
@ -232,6 +237,7 @@ var LanguagesColor = map[string]string{
|
||||
"JavaScript": "#f1e05a",
|
||||
"JavaScript+ERB": "#f1e05a",
|
||||
"Jest Snapshot": "#15c213",
|
||||
"JetBrains MPS": "#21D789",
|
||||
"Jinja": "#a52a22",
|
||||
"Jison": "#56b3cb",
|
||||
"Jison Lex": "#56b3cb",
|
||||
@ -344,6 +350,7 @@ var LanguagesColor = map[string]string{
|
||||
"PigLatin": "#fcd7de",
|
||||
"Pike": "#005390",
|
||||
"PogoScript": "#d80074",
|
||||
"Portugol": "#f8bd00",
|
||||
"PostCSS": "#dc3a0c",
|
||||
"PostScript": "#da291c",
|
||||
"PowerBuilder": "#8f0f8d",
|
||||
@ -399,6 +406,7 @@ var LanguagesColor = map[string]string{
|
||||
"SQL": "#e38c00",
|
||||
"SQLPL": "#e38c00",
|
||||
"SRecode Template": "#348a34",
|
||||
"STL": "#373b5e",
|
||||
"SVG": "#ff9900",
|
||||
"SaltStack": "#646464",
|
||||
"Sass": "#a53b70",
|
||||
@ -438,7 +446,7 @@ var LanguagesColor = map[string]string{
|
||||
"TOML": "#9c4221",
|
||||
"TSQL": "#e38c00",
|
||||
"TSV": "#237346",
|
||||
"TSX": "#2b7489",
|
||||
"TSX": "#3178c6",
|
||||
"TXL": "#0178b8",
|
||||
"Talon": "#333333",
|
||||
"Tcl": "#e4cc98",
|
||||
@ -449,7 +457,7 @@ var LanguagesColor = map[string]string{
|
||||
"Thrift": "#D12127",
|
||||
"Turing": "#cf142b",
|
||||
"Twig": "#c1d026",
|
||||
"TypeScript": "#2b7489",
|
||||
"TypeScript": "#3178c6",
|
||||
"Unified Parallel C": "#4e3617",
|
||||
"Unity3D Asset": "#222c37",
|
||||
"Uno": "#9933cc",
|
||||
@ -472,6 +480,7 @@ var LanguagesColor = map[string]string{
|
||||
"Vyper": "#2980b9",
|
||||
"Web Ontology Language": "#5b70bd",
|
||||
"WebAssembly": "#04133b",
|
||||
"Whiley": "#d5c397",
|
||||
"Wikitext": "#fc5757",
|
||||
"Windows Registry Entries": "#52d5ff",
|
||||
"Witcher Script": "#ff0000",
|
||||
@ -490,6 +499,7 @@ var LanguagesColor = map[string]string{
|
||||
"YARA": "#220000",
|
||||
"YASnippet": "#32AB90",
|
||||
"Yacc": "#4B6C4B",
|
||||
"Yul": "#794932",
|
||||
"ZAP": "#0d665e",
|
||||
"ZIL": "#dc75e5",
|
||||
"ZenScript": "#00BCD1",
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
// linguist's commit from which files were generated.
|
||||
var LinguistCommit = "4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26"
|
||||
var LinguistCommit = "d7799da826e01acdb8f84694d33116dccaabe9c2"
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -638,6 +638,10 @@ var ContentHeuristics = map[string]*Heuristics{
|
||||
rule.MatchingLanguages("BitBake"),
|
||||
regexp.MustCompile(`(?m)^\s*(# |include|require)\b`),
|
||||
),
|
||||
rule.Or(
|
||||
rule.MatchingLanguages("Clojure"),
|
||||
regexp.MustCompile(`(?m)\((def|defn|defmacro|let)\s`),
|
||||
),
|
||||
},
|
||||
".bi": &Heuristics{
|
||||
rule.Or(
|
||||
@ -645,6 +649,7 @@ var ContentHeuristics = map[string]*Heuristics{
|
||||
regexp.MustCompile(`(?m)^[ \t]*#(?:define|endif|endmacro|ifn?def|if|include|lang|macro)\s`),
|
||||
),
|
||||
},
|
||||
".bs": &Heuristics{},
|
||||
".builds": &Heuristics{
|
||||
rule.Or(
|
||||
rule.MatchingLanguages("XML"),
|
||||
@ -1472,6 +1477,16 @@ var ContentHeuristics = map[string]*Heuristics{
|
||||
regexp.MustCompile(`(?m)\A\s*[\[{(^"'\w#]|[a-zA-Z_]\w*\s*:=\s*[a-zA-Z_]\w*|class\s*>>\s*[a-zA-Z_]\w*|^[a-zA-Z_]\w*\s+[a-zA-Z_]\w*:|^Class\s*{|if(?:True|False):\s*\[`),
|
||||
),
|
||||
},
|
||||
".star": &Heuristics{
|
||||
rule.Or(
|
||||
rule.MatchingLanguages("STAR"),
|
||||
regexp.MustCompile(`(?m)^loop_\s*$`),
|
||||
),
|
||||
rule.Always(
|
||||
rule.MatchingLanguages("Starlark"),
|
||||
),
|
||||
},
|
||||
".stl": &Heuristics{},
|
||||
".t": &Heuristics{
|
||||
rule.Or(
|
||||
rule.MatchingLanguages("Perl"),
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -18,7 +18,9 @@ var LanguagesByExtension = map[string][]string{
|
||||
".3qt": {"Roff", "Roff Manpage"},
|
||||
".3x": {"Roff", "Roff Manpage"},
|
||||
".4": {"Roff", "Roff Manpage"},
|
||||
".4dform": {"JSON"},
|
||||
".4dm": {"4D"},
|
||||
".4dproject": {"JSON"},
|
||||
".4gl": {"Genero"},
|
||||
".4th": {"Forth"},
|
||||
".5": {"Roff", "Roff Manpage"},
|
||||
@ -59,6 +61,9 @@ var LanguagesByExtension = map[string][]string{
|
||||
".angelscript": {"AngelScript"},
|
||||
".anim": {"Unity3D Asset"},
|
||||
".ant": {"XML"},
|
||||
".antlers.html": {"Antlers"},
|
||||
".antlers.php": {"Antlers"},
|
||||
".antlers.xml": {"Antlers"},
|
||||
".apacheconf": {"ApacheConf"},
|
||||
".apib": {"API Blueprint"},
|
||||
".apl": {"APL"},
|
||||
@ -106,7 +111,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".bash": {"Shell"},
|
||||
".bat": {"Batchfile"},
|
||||
".bats": {"Shell"},
|
||||
".bb": {"BitBake", "BlitzBasic"},
|
||||
".bb": {"BitBake", "BlitzBasic", "Clojure"},
|
||||
".bbx": {"TeX"},
|
||||
".bdf": {"Glyph Bitmap Distribution Format"},
|
||||
".bdy": {"PLSQL"},
|
||||
@ -128,6 +133,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".brd": {"Eagle", "KiCad Legacy Layout"},
|
||||
".bro": {"Zeek"},
|
||||
".brs": {"Brightscript"},
|
||||
".bs": {"Bikeshed", "BrighterScript"},
|
||||
".bsl": {"1C Enterprise"},
|
||||
".bsv": {"Bluespec"},
|
||||
".builder": {"Ruby"},
|
||||
@ -151,6 +157,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".ccxml": {"XML"},
|
||||
".cdc": {"Cadence"},
|
||||
".cdf": {"Mathematica"},
|
||||
".cds": {"CAP CDS"},
|
||||
".ceylon": {"Ceylon"},
|
||||
".cfc": {"ColdFusion CFC"},
|
||||
".cfg": {"HAProxy", "INI"},
|
||||
@ -206,6 +213,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".cpy": {"COBOL"},
|
||||
".cql": {"SQL"},
|
||||
".cr": {"Crystal"},
|
||||
".crc32": {"Checksums"},
|
||||
".creole": {"Creole"},
|
||||
".cs": {"C#", "Smalltalk"},
|
||||
".csc": {"GSC"},
|
||||
@ -222,6 +230,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".csx": {"C#"},
|
||||
".ct": {"XML"},
|
||||
".ctp": {"PHP"},
|
||||
".cts": {"TypeScript"},
|
||||
".cu": {"Cuda"},
|
||||
".cue": {"CUE", "Cue Sheet"},
|
||||
".cuh": {"Cuda"},
|
||||
@ -350,6 +359,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".fsi": {"F#"},
|
||||
".fsproj": {"XML"},
|
||||
".fst": {"F*"},
|
||||
".fsti": {"F*"},
|
||||
".fsx": {"F#"},
|
||||
".fth": {"Forth"},
|
||||
".ftl": {"Fluent", "FreeMarker"},
|
||||
@ -540,6 +550,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".kak": {"KakouneScript"},
|
||||
".kicad_mod": {"KiCad Layout"},
|
||||
".kicad_pcb": {"KiCad Layout"},
|
||||
".kicad_sch": {"KiCad Schematic"},
|
||||
".kicad_wks": {"KiCad Layout"},
|
||||
".kid": {"Genshi"},
|
||||
".kit": {"Kit"},
|
||||
@ -579,6 +590,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".liquid": {"Liquid"},
|
||||
".lisp": {"Common Lisp", "NewLisp"},
|
||||
".litcoffee": {"Literate CoffeeScript"},
|
||||
".livemd": {"Markdown"},
|
||||
".ll": {"LLVM"},
|
||||
".lmi": {"Python"},
|
||||
".logtalk": {"Logtalk"},
|
||||
@ -591,6 +603,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".lsp": {"Common Lisp", "NewLisp"},
|
||||
".ltx": {"TeX"},
|
||||
".lua": {"Lua"},
|
||||
".lvclass": {"LabVIEW"},
|
||||
".lvlib": {"LabVIEW"},
|
||||
".lvproj": {"LabVIEW"},
|
||||
".ly": {"LilyPond"},
|
||||
@ -623,6 +636,9 @@ var LanguagesByExtension = map[string][]string{
|
||||
".mcmeta": {"JSON"},
|
||||
".mcr": {"MAXScript"},
|
||||
".md": {"GCC Machine Description", "Markdown"},
|
||||
".md2": {"Checksums"},
|
||||
".md4": {"Checksums"},
|
||||
".md5": {"Checksums"},
|
||||
".mdoc": {"Roff", "Roff Manpage"},
|
||||
".mdown": {"Markdown"},
|
||||
".mdpolicy": {"XML"},
|
||||
@ -664,16 +680,20 @@ var LanguagesByExtension = map[string][]string{
|
||||
".monkey2": {"Monkey"},
|
||||
".moo": {"Mercury", "Moocode"},
|
||||
".moon": {"MoonScript"},
|
||||
".mpl": {"JetBrains MPS"},
|
||||
".mps": {"JetBrains MPS"},
|
||||
".mq4": {"MQL4"},
|
||||
".mq5": {"MQL5"},
|
||||
".mqh": {"MQL4", "MQL5"},
|
||||
".mrc": {"mIRC Script"},
|
||||
".ms": {"MAXScript", "Roff", "Unix Assembly"},
|
||||
".msd": {"JetBrains MPS"},
|
||||
".mspec": {"Ruby"},
|
||||
".mss": {"CartoCSS"},
|
||||
".mt": {"Mathematica"},
|
||||
".mtl": {"Wavefront Material"},
|
||||
".mtml": {"MTML"},
|
||||
".mts": {"TypeScript"},
|
||||
".mu": {"mupad"},
|
||||
".mud": {"ZIL"},
|
||||
".muf": {"MUF"},
|
||||
@ -819,6 +839,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".podspec": {"Ruby"},
|
||||
".pogo": {"PogoScript"},
|
||||
".pony": {"Pony"},
|
||||
".por": {"Portugol"},
|
||||
".postcss": {"PostCSS"},
|
||||
".pot": {"Gettext Catalog"},
|
||||
".pov": {"POV-Ray SDL"},
|
||||
@ -978,6 +999,14 @@ var LanguagesByExtension = map[string][]string{
|
||||
".sh": {"Shell"},
|
||||
".sh-session": {"ShellSession"},
|
||||
".sh.in": {"Shell"},
|
||||
".sha1": {"Checksums"},
|
||||
".sha2": {"Checksums"},
|
||||
".sha224": {"Checksums"},
|
||||
".sha256": {"Checksums"},
|
||||
".sha256sum": {"Checksums"},
|
||||
".sha3": {"Checksums"},
|
||||
".sha384": {"Checksums"},
|
||||
".sha512": {"Checksums"},
|
||||
".shader": {"GLSL", "ShaderLab"},
|
||||
".shen": {"Shen"},
|
||||
".shproj": {"XML"},
|
||||
@ -1021,7 +1050,9 @@ var LanguagesByExtension = map[string][]string{
|
||||
".sss": {"SugarSS"},
|
||||
".st": {"Smalltalk", "StringTemplate"},
|
||||
".stan": {"Stan"},
|
||||
".star": {"STAR", "Starlark"},
|
||||
".sthlp": {"Stata"},
|
||||
".stl": {"STL"},
|
||||
".ston": {"STON"},
|
||||
".story": {"Gherkin"},
|
||||
".storyboard": {"XML"},
|
||||
@ -1166,6 +1197,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".webidl": {"WebIDL"},
|
||||
".webmanifest": {"JSON"},
|
||||
".weechatlog": {"IRC log"},
|
||||
".whiley": {"Whiley"},
|
||||
".wiki": {"Wikitext"},
|
||||
".wikitext": {"Wikitext"},
|
||||
".wisp": {"wisp"},
|
||||
@ -1245,6 +1277,7 @@ var LanguagesByExtension = map[string][]string{
|
||||
".yml": {"YAML"},
|
||||
".yml.mysql": {"YAML"},
|
||||
".yrl": {"Erlang"},
|
||||
".yul": {"Yul"},
|
||||
".yy": {"JSON", "Yacc"},
|
||||
".yyp": {"JSON"},
|
||||
".zap": {"ZAP"},
|
||||
@ -1287,6 +1320,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Alloy": {".als"},
|
||||
"Altium Designer": {".outjob", ".pcbdoc", ".prjpcb", ".schdoc"},
|
||||
"AngelScript": {".as", ".angelscript"},
|
||||
"Antlers": {".antlers.html", ".antlers.php", ".antlers.xml"},
|
||||
"ApacheConf": {".apacheconf", ".vhost"},
|
||||
"Apex": {".cls"},
|
||||
"Apollo Guidance Computer": {".agc"},
|
||||
@ -1310,6 +1344,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Berry": {".be"},
|
||||
"BibTeX": {".bib", ".bibtex"},
|
||||
"Bicep": {".bicep"},
|
||||
"Bikeshed": {".bs"},
|
||||
"Bison": {".bison"},
|
||||
"BitBake": {".bb"},
|
||||
"Blade": {".blade", ".blade.php"},
|
||||
@ -1319,12 +1354,14 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Boo": {".boo"},
|
||||
"Boogie": {".bpl"},
|
||||
"Brainfuck": {".b", ".bf"},
|
||||
"BrighterScript": {".bs"},
|
||||
"Brightscript": {".brs"},
|
||||
"C": {".c", ".cats", ".h", ".idc"},
|
||||
"C#": {".cs", ".cake", ".csx", ".linq"},
|
||||
"C++": {".cpp", ".c++", ".cc", ".cp", ".cxx", ".h", ".h++", ".hh", ".hpp", ".hxx", ".inc", ".inl", ".ino", ".ipp", ".ixx", ".re", ".tcc", ".tpp"},
|
||||
"C-ObjDump": {".c-objdump"},
|
||||
"C2hs Haskell": {".chs"},
|
||||
"CAP CDS": {".cds"},
|
||||
"CIL": {".cil"},
|
||||
"CLIPS": {".clp"},
|
||||
"CMake": {".cmake", ".cmake.in"},
|
||||
@ -1344,6 +1381,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Ceylon": {".ceylon"},
|
||||
"Chapel": {".chpl"},
|
||||
"Charity": {".ch"},
|
||||
"Checksums": {".crc32", ".md2", ".md4", ".md5", ".sha1", ".sha2", ".sha224", ".sha256", ".sha256sum", ".sha3", ".sha384", ".sha512"},
|
||||
"ChucK": {".ck"},
|
||||
"Cirru": {".cirru"},
|
||||
"Clarion": {".clw"},
|
||||
@ -1351,7 +1389,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Classic ASP": {".asp"},
|
||||
"Clean": {".icl", ".dcl"},
|
||||
"Click": {".click"},
|
||||
"Clojure": {".clj", ".boot", ".cl2", ".cljc", ".cljs", ".cljs.hl", ".cljscm", ".cljx", ".hic"},
|
||||
"Clojure": {".clj", ".bb", ".boot", ".cl2", ".cljc", ".cljs", ".cljs.hl", ".cljscm", ".cljx", ".hic"},
|
||||
"Closure Templates": {".soy"},
|
||||
"CoNLL-U": {".conllu", ".conll"},
|
||||
"CodeQL": {".ql", ".qll"},
|
||||
@ -1411,7 +1449,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Erlang": {".erl", ".app.src", ".es", ".escript", ".hrl", ".xrl", ".yrl"},
|
||||
"Euphoria": {".e", ".ex"},
|
||||
"F#": {".fs", ".fsi", ".fsx"},
|
||||
"F*": {".fst"},
|
||||
"F*": {".fst", ".fsti"},
|
||||
"FIGlet Font": {".flf"},
|
||||
"FLUX": {".fx", ".flux"},
|
||||
"Factor": {".factor"},
|
||||
@ -1502,7 +1540,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Isabelle": {".thy"},
|
||||
"J": {".ijs"},
|
||||
"JFlex": {".flex", ".jflex"},
|
||||
"JSON": {".json", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".json-tmlanguage", ".jsonl", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"},
|
||||
"JSON": {".json", ".4dform", ".4dproject", ".avsc", ".geojson", ".gltf", ".har", ".ice", ".json-tmlanguage", ".jsonl", ".mcmeta", ".tfstate", ".tfstate.backup", ".topojson", ".webapp", ".webmanifest", ".yy", ".yyp"},
|
||||
"JSON with Comments": {".jsonc", ".code-snippets", ".sublime-build", ".sublime-commands", ".sublime-completions", ".sublime-keymap", ".sublime-macro", ".sublime-menu", ".sublime-mousemap", ".sublime-project", ".sublime-settings", ".sublime-theme", ".sublime-workspace", ".sublime_metrics", ".sublime_session"},
|
||||
"JSON5": {".json5"},
|
||||
"JSONLD": {".jsonld"},
|
||||
@ -1515,6 +1553,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"JavaScript": {".js", "._js", ".bones", ".cjs", ".es", ".es6", ".frag", ".gs", ".jake", ".javascript", ".jsb", ".jscad", ".jsfl", ".jslib", ".jsm", ".jspre", ".jss", ".jsx", ".mjs", ".njs", ".pac", ".sjs", ".ssjs", ".xsjs", ".xsjslib"},
|
||||
"JavaScript+ERB": {".js.erb"},
|
||||
"Jest Snapshot": {".snap"},
|
||||
"JetBrains MPS": {".mps", ".mpl", ".msd"},
|
||||
"Jinja": {".jinja", ".j2", ".jinja2"},
|
||||
"Jison": {".jison"},
|
||||
"Jison Lex": {".jisonlex"},
|
||||
@ -1527,7 +1566,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"KakouneScript": {".kak"},
|
||||
"KiCad Layout": {".kicad_pcb", ".kicad_mod", ".kicad_wks"},
|
||||
"KiCad Legacy Layout": {".brd"},
|
||||
"KiCad Schematic": {".sch"},
|
||||
"KiCad Schematic": {".kicad_sch", ".sch"},
|
||||
"Kit": {".kit"},
|
||||
"Kotlin": {".kt", ".ktm", ".kts"},
|
||||
"Kusto": {".csl"},
|
||||
@ -1536,7 +1575,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"LOLCODE": {".lol"},
|
||||
"LSL": {".lsl", ".lslp"},
|
||||
"LTspice Symbol": {".asy"},
|
||||
"LabVIEW": {".lvproj", ".lvlib"},
|
||||
"LabVIEW": {".lvproj", ".lvclass", ".lvlib"},
|
||||
"Lark": {".lark"},
|
||||
"Lasso": {".lasso", ".las", ".lasso8", ".lasso9"},
|
||||
"Latte": {".latte"},
|
||||
@ -1571,7 +1610,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Macaulay2": {".m2"},
|
||||
"Makefile": {".mak", ".d", ".make", ".makefile", ".mk", ".mkfile"},
|
||||
"Mako": {".mako", ".mao"},
|
||||
"Markdown": {".md", ".markdown", ".mdown", ".mdwn", ".mdx", ".mkd", ".mkdn", ".mkdown", ".ronn", ".scd", ".workbook"},
|
||||
"Markdown": {".md", ".livemd", ".markdown", ".mdown", ".mdwn", ".mdx", ".mkd", ".mkdn", ".mkdown", ".ronn", ".scd", ".workbook"},
|
||||
"Marko": {".marko"},
|
||||
"Mask": {".mask"},
|
||||
"Mathematica": {".mathematica", ".cdf", ".m", ".ma", ".mt", ".nb", ".nbp", ".wl", ".wlt"},
|
||||
@ -1665,6 +1704,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Pod 6": {".pod", ".pod6"},
|
||||
"PogoScript": {".pogo"},
|
||||
"Pony": {".pony"},
|
||||
"Portugol": {".por"},
|
||||
"PostCSS": {".pcss", ".postcss"},
|
||||
"PostScript": {".ps", ".eps", ".epsi", ".pfa"},
|
||||
"PowerBuilder": {".pbt", ".sra", ".sru", ".srw"},
|
||||
@ -1731,6 +1771,8 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"SQL": {".sql", ".cql", ".ddl", ".inc", ".mysql", ".prc", ".tab", ".udf", ".viw"},
|
||||
"SQLPL": {".sql", ".db2"},
|
||||
"SRecode Template": {".srt"},
|
||||
"STAR": {".star"},
|
||||
"STL": {".stl"},
|
||||
"STON": {".ston"},
|
||||
"SVG": {".svg"},
|
||||
"SWIG": {".i"},
|
||||
@ -1760,7 +1802,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Squirrel": {".nut"},
|
||||
"Stan": {".stan"},
|
||||
"Standard ML": {".ml", ".fun", ".sig", ".sml"},
|
||||
"Starlark": {".bzl"},
|
||||
"Starlark": {".bzl", ".star"},
|
||||
"Stata": {".do", ".ado", ".doh", ".ihlp", ".mata", ".matah", ".sthlp"},
|
||||
"StringTemplate": {".st"},
|
||||
"Stylus": {".styl"},
|
||||
@ -1791,7 +1833,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"Turtle": {".ttl"},
|
||||
"Twig": {".twig"},
|
||||
"Type Language": {".tl"},
|
||||
"TypeScript": {".ts"},
|
||||
"TypeScript": {".ts", ".cts", ".mts"},
|
||||
"Unified Parallel C": {".upc"},
|
||||
"Unity3D Asset": {".anim", ".asset", ".mask", ".mat", ".meta", ".prefab", ".unity"},
|
||||
"Unix Assembly": {".s", ".ms"},
|
||||
@ -1819,6 +1861,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"WebAssembly": {".wast", ".wat"},
|
||||
"WebIDL": {".webidl"},
|
||||
"WebVTT": {".vtt"},
|
||||
"Whiley": {".whiley"},
|
||||
"Wikitext": {".mediawiki", ".wiki", ".wikitext"},
|
||||
"Win32 Message File": {".mc"},
|
||||
"Windows Registry Entries": {".reg"},
|
||||
@ -1844,6 +1887,7 @@ var ExtensionsByLanguage = map[string][]string{
|
||||
"YARA": {".yar", ".yara"},
|
||||
"YASnippet": {".yasnippet"},
|
||||
"Yacc": {".y", ".yacc", ".yy"},
|
||||
"Yul": {".yul"},
|
||||
"ZAP": {".zap", ".xzap"},
|
||||
"ZIL": {".zil", ".mud"},
|
||||
"Zeek": {".zeek", ".bro"},
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -24,10 +24,12 @@ var LanguagesByFilename = map[string][]string{
|
||||
".clang-tidy": {"YAML"},
|
||||
".classpath": {"XML"},
|
||||
".coffeelintignore": {"Ignore List"},
|
||||
".coveragerc": {"INI"},
|
||||
".cproject": {"XML"},
|
||||
".cshrc": {"Shell"},
|
||||
".curlrc": {"cURL Config"},
|
||||
".cvsignore": {"Ignore List"},
|
||||
".devcontainer.json": {"JSON with Comments"},
|
||||
".dir_colors": {"dircolors"},
|
||||
".dircolors": {"dircolors"},
|
||||
".dockerignore": {"Ignore List"},
|
||||
@ -46,6 +48,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
".flaskenv": {"Shell"},
|
||||
".gclient": {"Python"},
|
||||
".gemrc": {"YAML"},
|
||||
".git-blame-ignore-revs": {"Git Revision List"},
|
||||
".gitattributes": {"Git Attributes"},
|
||||
".gitconfig": {"Git Config"},
|
||||
".gitignore": {"Ignore List"},
|
||||
@ -78,6 +81,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
".profile": {"Shell"},
|
||||
".project": {"XML"},
|
||||
".pryrc": {"Ruby"},
|
||||
".pylintrc": {"INI"},
|
||||
".shellcheckrc": {"ShellCheck Config"},
|
||||
".simplecov": {"Ruby"},
|
||||
".spacemacs": {"Emacs Lisp"},
|
||||
@ -146,6 +150,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
"LICENSE.mysql": {"Text"},
|
||||
"Lexer.x": {"Lex"},
|
||||
"MANIFEST.MF": {"JAR Manifest"},
|
||||
"MD5SUMS": {"Checksums"},
|
||||
"Makefile": {"Makefile"},
|
||||
"Makefile.PL": {"Perl"},
|
||||
"Makefile.am": {"Makefile"},
|
||||
@ -176,6 +181,10 @@ var LanguagesByFilename = map[string][]string{
|
||||
"Rexfile": {"Perl"},
|
||||
"SConscript": {"Python"},
|
||||
"SConstruct": {"Python"},
|
||||
"SHA1SUMS": {"Checksums"},
|
||||
"SHA256SUMS": {"Checksums"},
|
||||
"SHA256SUMS.txt": {"Checksums"},
|
||||
"SHA512SUMS": {"Checksums"},
|
||||
"Settings.StyleCop": {"XML"},
|
||||
"Singularity": {"Singularity"},
|
||||
"Slakefile": {"LiveScript"},
|
||||
@ -211,6 +220,8 @@ var LanguagesByFilename = map[string][]string{
|
||||
"buildozer.spec": {"INI"},
|
||||
"cabal.config": {"Cabal Config"},
|
||||
"cabal.project": {"Cabal Config"},
|
||||
"checksums.txt": {"Checksums"},
|
||||
"cksums": {"Checksums"},
|
||||
"click.me": {"Text"},
|
||||
"composer.lock": {"JSON"},
|
||||
"configure.ac": {"M4Sugar"},
|
||||
@ -259,6 +270,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
"makefile.sco": {"Makefile"},
|
||||
"man": {"Shell"},
|
||||
"mcmod.info": {"JSON"},
|
||||
"md5sum.txt": {"Checksums"},
|
||||
"meson.build": {"Meson"},
|
||||
"meson_options.txt": {"Meson"},
|
||||
"mix.lock": {"Elixir"},
|
||||
@ -279,6 +291,7 @@ var LanguagesByFilename = map[string][]string{
|
||||
"pom.xml": {"Maven POM"},
|
||||
"port_contexts": {"SELinux Policy"},
|
||||
"profile": {"Shell"},
|
||||
"pylintrc": {"INI"},
|
||||
"read.me": {"Text"},
|
||||
"readme.1st": {"Text"},
|
||||
"rebar.config": {"Erlang"},
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -13,6 +13,7 @@ var LanguagesByInterpreter = map[string][]string{
|
||||
"asy": {"Asymptote"},
|
||||
"awk": {"Awk"},
|
||||
"bash": {"Shell"},
|
||||
"bb": {"Clojure"},
|
||||
"bigloo": {"Scheme"},
|
||||
"boogie": {"Boogie"},
|
||||
"boolector": {"SMT"},
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -16,6 +16,7 @@ var LanguagesMime = map[string]string{
|
||||
"Asymptote": "text/x-kotlin",
|
||||
"Beef": "text/x-csharp",
|
||||
"BibTeX": "text/x-stex",
|
||||
"Bikeshed": "text/html",
|
||||
"Brainfuck": "text/x-brainfuck",
|
||||
"C": "text/x-csrc",
|
||||
"C#": "text/x-csharp",
|
||||
@ -111,6 +112,7 @@ var LanguagesMime = map[string]string{
|
||||
"JavaScript": "text/javascript",
|
||||
"JavaScript+ERB": "application/javascript",
|
||||
"Jest Snapshot": "application/javascript",
|
||||
"JetBrains MPS": "text/xml",
|
||||
"Jinja": "text/x-django",
|
||||
"Julia": "text/x-julia",
|
||||
"Jupyter Notebook": "application/json",
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -72,6 +72,7 @@ var LanguagesType = map[string]int{
|
||||
"Altium Designer": 1,
|
||||
"AngelScript": 2,
|
||||
"Ant Build System": 1,
|
||||
"Antlers": 3,
|
||||
"ApacheConf": 1,
|
||||
"Apex": 2,
|
||||
"Apollo Guidance Computer": 2,
|
||||
@ -95,6 +96,7 @@ var LanguagesType = map[string]int{
|
||||
"Berry": 2,
|
||||
"BibTeX": 3,
|
||||
"Bicep": 2,
|
||||
"Bikeshed": 3,
|
||||
"Bison": 2,
|
||||
"BitBake": 2,
|
||||
"Blade": 3,
|
||||
@ -104,6 +106,7 @@ var LanguagesType = map[string]int{
|
||||
"Boo": 2,
|
||||
"Boogie": 2,
|
||||
"Brainfuck": 2,
|
||||
"BrighterScript": 2,
|
||||
"Brightscript": 2,
|
||||
"Browserslist": 1,
|
||||
"C": 2,
|
||||
@ -111,6 +114,7 @@ var LanguagesType = map[string]int{
|
||||
"C++": 2,
|
||||
"C-ObjDump": 1,
|
||||
"C2hs Haskell": 2,
|
||||
"CAP CDS": 2,
|
||||
"CIL": 1,
|
||||
"CLIPS": 2,
|
||||
"CMake": 2,
|
||||
@ -131,6 +135,7 @@ var LanguagesType = map[string]int{
|
||||
"Ceylon": 2,
|
||||
"Chapel": 2,
|
||||
"Charity": 2,
|
||||
"Checksums": 1,
|
||||
"ChucK": 2,
|
||||
"Cirru": 2,
|
||||
"Clarion": 2,
|
||||
@ -244,6 +249,7 @@ var LanguagesType = map[string]int{
|
||||
"Gherkin": 2,
|
||||
"Git Attributes": 1,
|
||||
"Git Config": 1,
|
||||
"Git Revision List": 1,
|
||||
"Gleam": 2,
|
||||
"Glyph": 2,
|
||||
"Glyph Bitmap Distribution Format": 1,
|
||||
@ -311,6 +317,7 @@ var LanguagesType = map[string]int{
|
||||
"JavaScript": 2,
|
||||
"JavaScript+ERB": 2,
|
||||
"Jest Snapshot": 1,
|
||||
"JetBrains MPS": 2,
|
||||
"Jinja": 3,
|
||||
"Jison": 2,
|
||||
"Jison Lex": 2,
|
||||
@ -465,6 +472,7 @@ var LanguagesType = map[string]int{
|
||||
"Pod 6": 4,
|
||||
"PogoScript": 2,
|
||||
"Pony": 2,
|
||||
"Portugol": 2,
|
||||
"PostCSS": 3,
|
||||
"PostScript": 3,
|
||||
"PowerBuilder": 2,
|
||||
@ -538,6 +546,8 @@ var LanguagesType = map[string]int{
|
||||
"SQLPL": 2,
|
||||
"SRecode Template": 3,
|
||||
"SSH Config": 1,
|
||||
"STAR": 1,
|
||||
"STL": 1,
|
||||
"STON": 1,
|
||||
"SVG": 1,
|
||||
"SWIG": 2,
|
||||
@ -631,6 +641,7 @@ var LanguagesType = map[string]int{
|
||||
"WebIDL": 2,
|
||||
"WebVTT": 1,
|
||||
"Wget Config": 1,
|
||||
"Whiley": 2,
|
||||
"Wikitext": 4,
|
||||
"Win32 Message File": 1,
|
||||
"Windows Registry Entries": 1,
|
||||
@ -658,6 +669,7 @@ var LanguagesType = map[string]int{
|
||||
"YARA": 2,
|
||||
"YASnippet": 3,
|
||||
"Yacc": 2,
|
||||
"Yul": 2,
|
||||
"ZAP": 2,
|
||||
"ZIL": 2,
|
||||
"Zeek": 2,
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Code generated by github.com/go-enry/go-enry/v2/internal/code-generator DO NOT EDIT.
|
||||
// Extracted from github/linguist commit: 4ffcdbcbb60a74cbfbd37656bcc3fcea4eca8e26
|
||||
// Extracted from github/linguist commit: d7799da826e01acdb8f84694d33116dccaabe9c2
|
||||
|
||||
package data
|
||||
|
||||
@ -171,4 +171,8 @@ var VendorMatchers = []regex.EnryRegexp{
|
||||
regex.MustCompile(`(^|/)\.google_apis/`),
|
||||
regex.MustCompile(`(^|/)Jenkinsfile$`),
|
||||
regex.MustCompile(`(^|/)\.gitpod\.Dockerfile$`),
|
||||
regex.MustCompile(`(^|/)\.github/`),
|
||||
}
|
||||
|
||||
// FastVendorMatcher is equivalent to matching any of the VendorMatchers.
|
||||
var FastVendorMatcher = regex.MustCompile(`(?:^(?:(?:[Dd]ependencies/)|(?:debian/)|(?:deps/)|(?:rebar$)))|(?:(?:^|/)(?:(?:BuddyBuildSDK\.framework/)|(?:Carthage/)|(?:Chart\.js$)|(?:Control\.FullScreen\.css)|(?:Control\.FullScreen\.js)|(?:Crashlytics\.framework/)|(?:Fabric\.framework/)|(?:Godeps/_workspace/)|(?:Jenkinsfile$)|(?:Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$)|(?:MathJax/)|(?:MochiKit\.js$)|(?:RealmSwift\.framework)|(?:Realm\.framework)|(?:Sparkle/)|(?:Vagrantfile$)|(?:[Bb]ourbon/.*\.(css|less|scss|styl)$)|(?:[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo))|(?:[Ee]xtern(als?)?/)|(?:[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$)|(?:[Pp]ackages\/.+\.\d+\/)|(?:[Ss]pecs?/fixtures/)|(?:[Tt]ests?/fixtures/)|(?:[Vv]+endor/)|(?:\.[Dd][Ss]_[Ss]tore$)|(?:\.gitattributes$)|(?:\.github/)|(?:\.gitignore$)|(?:\.gitmodules$)|(?:\.gitpod\.Dockerfile$)|(?:\.google_apis/)|(?:\.indent\.pro)|(?:\.mvn/wrapper/)|(?:\.osx$)|(?:\.sublime-project)|(?:\.sublime-workspace)|(?:\.vscode/)|(?:\.yarn/plugins/)|(?:\.yarn/releases/)|(?:\.yarn/sdks/)|(?:\.yarn/unplugged/)|(?:\.yarn/versions/)|(?:_esy$)|(?:ace-builds/)|(?:aclocal\.m4)|(?:activator$)|(?:activator\.bat$)|(?:admin_media/)|(?:angular([^.]*)\.js$)|(?:animate\.(css|less|scss|styl)$)|(?:bootbox\.js)|(?:bootstrap([^/.]*)\.(js|css|less|scss|styl)$)|(?:bootstrap-datepicker/)|(?:bower_components/)|(?:bulma\.(css|sass|scss)$)|(?:cache/)|(?:ckeditor\.js$)|(?:config\.guess$)|(?:config\.sub$)|(?:configure$)|(?:controls\.js$)|(?:cordova([^.]*)\.js$)|(?:cordova\-\d\.\d(\.\d)?\.js$)|(?:cpplint\.py)|(?:custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$)|(?:dist/)|(?:docs?/_?(build|themes?|templates?|static)/)|(?:dojo\.js$)|(?:dotnet-install\.(ps1|sh)$)|(?:dragdrop\.js$)|(?:effects\.js$)|(?:env/)|(?:erlang\.mk)|(?:extjs/.*?\.html$)|(?:extjs/.*?\.js$)|(?:extjs/.*?\.properties$)|(?:extjs/.*?\.txt$)|(?:extjs/.*?\.xml$)|(?:extjs/\.sencha/)|(?:extjs/builds/)|(?:extjs/cmd/)|(?:extjs/docs/)|(?:extjs/examples/)|(?:extjs/locale/)|(?:extjs/packages/)|(?:extjs/plugins/)|(?:extjs/resources/)|(?:extjs/src/)|(?:extjs/welcome/)|(?:fabfile\.py$)|(?:flow-typed/.*\.js$)|(?:font-?awesome/.*\.(css|less|scss|styl)$)|(?:font-?awesome\.(css|less|scss|styl)$)|(?:fontello(.*?)\.css$)|(?:foundation(\..*)?\.js$)|(?:foundation\.(css|less|scss|styl)$)|(?:fuelux\.js)|(?:gradle/wrapper/)|(?:gradlew$)|(?:gradlew\.bat$)|(?:html5shiv\.js$)|(?:inst/extdata/)|(?:jquery([^.]*)\.js$)|(?:jquery([^.]*)\.unobtrusive\-ajax\.js$)|(?:jquery([^.]*)\.validate(\.unobtrusive)?\.js$)|(?:jquery\-\d\.\d+(\.\d+)?\.js$)|(?:jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$)|(?:jquery\.(ui|effects)\.([^.]*)\.(js|css)$)|(?:jquery\.dataTables\.js)|(?:jquery\.fancybox\.(js|css))|(?:jquery\.fileupload(-\w+)?\.js$)|(?:jquery\.fn\.gantt\.js)|(?:knockout-(\d+\.){3}(debug\.)?js$)|(?:leaflet\.draw-src\.js)|(?:leaflet\.draw\.css)|(?:leaflet\.spin\.js)|(?:libtool\.m4)|(?:ltoptions\.m4)|(?:ltsugar\.m4)|(?:ltversion\.m4)|(?:lt~obsolete\.m4)|(?:materialize\.(css|less|scss|styl|js)$)|(?:modernizr\-\d\.\d+(\.\d+)?\.js$)|(?:modernizr\.custom\.\d+\.js$)|(?:mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$)|(?:mvnw$)|(?:mvnw\.cmd$)|(?:node_modules/)|(?:normalize\.(css|less|scss|styl)$)|(?:octicons\.css)|(?:pdf\.worker\.js)|(?:proguard-rules\.pro$)|(?:proguard\.pro$)|(?:prototype(.*)\.js$)|(?:puphpet/)|(?:react(-[^.]*)?\.js$)|(?:run\.n$)|(?:select2/.*\.(css|scss|js)$)|(?:shBrush([^.]*)\.js$)|(?:shCore\.js$)|(?:shLegacy\.js$)|(?:skeleton\.(css|less|scss|styl)$)|(?:slick\.\w+.js$)|(?:sprockets-octicons\.scss)|(?:testdata/)|(?:tiny_mce([^.]*)\.js$)|(?:tiny_mce/(langs|plugins|themes|utils))|(?:vendors?/)|(?:vignettes/)|(?:waf$)|(?:wicket-leaflet\.js)|(?:yahoo-([^.]*)\.js$)|(?:yui([^.]*)\.js$)))|(?:(.*?)\.d\.ts$)|(?:(3rd|[Tt]hird)[-_]?[Pp]arty/)|(?:([^\s]*)import\.(css|less|scss|styl)$)|(?:(\.|-)min\.(js|css)$)|(?:(^|\/)d3(\.v\d+)?([^.]*)\.js$)|(?:-vsdoc\.js$)|(?:\.imageset/)|(?:\.intellisense\.js$)|(?:\.xctemplate/)`)
|
||||
|
@ -2,8 +2,12 @@ package generator
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"gopkg.in/yaml.v2"
|
||||
)
|
||||
@ -16,19 +20,97 @@ func Vendor(fileToParse, samplesDir, outPath, tmplPath, tmplName, commit string)
|
||||
return err
|
||||
}
|
||||
|
||||
var regexpList []string
|
||||
if err := yaml.Unmarshal(data, ®expList); err != nil {
|
||||
return nil
|
||||
var regexps []string
|
||||
if err := yaml.Unmarshal(data, ®exps); err != nil {
|
||||
return fmt.Errorf("failed to parse YAML %s, %q", fileToParse, err)
|
||||
}
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
if err := executeVendorTemplate(buf, regexpList, tmplPath, tmplName, commit); err != nil {
|
||||
return nil
|
||||
if err := executeVendorTemplate(buf, regexps, tmplPath, tmplName, commit); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return formatedWrite(outPath, buf.Bytes())
|
||||
}
|
||||
|
||||
func executeVendorTemplate(out io.Writer, regexpList []string, tmplPath, tmplName, commit string) error {
|
||||
return executeTemplate(out, tmplName, tmplPath, commit, nil, regexpList)
|
||||
func executeVendorTemplate(out io.Writer, regexps []string, tmplPath, tmplName, commit string) error {
|
||||
funcs := template.FuncMap{"optimize": collateAllMatchers}
|
||||
return executeTemplate(out, tmplName, tmplPath, commit, funcs, regexps)
|
||||
}
|
||||
|
||||
func collateAllMatchers(regexps []string) string {
|
||||
// We now collate all regexps from VendorMatchers to a single large regexp
|
||||
// which is at least twice as fast to test than simply iterating & matching.
|
||||
//
|
||||
// ---
|
||||
//
|
||||
// We could test each matcher from VendorMatchers in turn i.e.
|
||||
//
|
||||
// func IsVendor(filename string) bool {
|
||||
// for _, matcher := range data.VendorMatchers {
|
||||
// if matcher.MatchString(filename) {
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// Or naïvely concatentate all these regexps using groups i.e.
|
||||
//
|
||||
// `(regexp1)|(regexp2)|(regexp3)|...`
|
||||
//
|
||||
// However, both of these are relatively slow and don't take advantage
|
||||
// of the inherent structure within our regexps.
|
||||
//
|
||||
// Imperical observation: by looking at the regexps, we only have 3 types.
|
||||
// 1. Those that start with `^`
|
||||
// 2. Those that start with `(^|/)`
|
||||
// 3. All the rest
|
||||
//
|
||||
// If we collate our regexps into these 3 groups - that will significantly
|
||||
// reduce the likelihood of backtracking within the regexp trie matcher.
|
||||
//
|
||||
// A further improvement is to use non-capturing groups (?:) as otherwise
|
||||
// the regexp parser, whilst matching, will have to allocate slices for
|
||||
// matching positions. (A future improvement left out could be to
|
||||
// enforce non-capturing groups within the sub-regexps.)
|
||||
const (
|
||||
caret = "^"
|
||||
caretOrSlash = "(^|/)"
|
||||
)
|
||||
|
||||
sort.Strings(regexps)
|
||||
|
||||
var caretPrefixed, caretOrSlashPrefixed, theRest []string
|
||||
// Check prefix, add to the respective group slices
|
||||
for _, re := range regexps {
|
||||
if strings.HasPrefix(re, caret) {
|
||||
caretPrefixed = append(caretPrefixed, re[len(caret):])
|
||||
} else if strings.HasPrefix(re, caretOrSlash) {
|
||||
caretOrSlashPrefixed = append(caretOrSlashPrefixed, re[len(caretOrSlash):])
|
||||
} else {
|
||||
theRest = append(theRest, re)
|
||||
}
|
||||
}
|
||||
var sb strings.Builder
|
||||
appendGroupWithCommonPrefix(&sb, "^", caretPrefixed)
|
||||
sb.WriteString("|")
|
||||
|
||||
appendGroupWithCommonPrefix(&sb, "(?:^|/)", caretOrSlashPrefixed)
|
||||
sb.WriteString("|")
|
||||
|
||||
appendGroupWithCommonPrefix(&sb, "", theRest)
|
||||
return sb.String()
|
||||
}
|
||||
|
||||
func appendGroupWithCommonPrefix(sb *strings.Builder, commonPrefix string, res []string) {
|
||||
sb.WriteString("(?:")
|
||||
if commonPrefix != "" {
|
||||
sb.WriteString(fmt.Sprintf("%s(?:(?:", commonPrefix))
|
||||
}
|
||||
sb.WriteString(strings.Join(res, ")|(?:"))
|
||||
if commonPrefix != "" {
|
||||
sb.WriteString("))")
|
||||
}
|
||||
sb.WriteString(")")
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ func main() {
|
||||
|
||||
for _, file := range fileList {
|
||||
if err := file.generate(file.fileToParse, file.samplesDir, file.outPath, file.tmplPath, file.tmplName, file.commit); err != nil {
|
||||
log.Printf("error generating template %q to %q: %+v", file.tmplPath, file.outPath, err)
|
||||
log.Fatalf("error generating template %q to %q: %+v", file.tmplPath, file.outPath, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
71
linguist_corpus_test.go
Normal file
71
linguist_corpus_test.go
Normal file
@ -0,0 +1,71 @@
|
||||
package enry
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"github.com/go-enry/go-enry/v2/data"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type linguistCorpusSuite struct {
|
||||
enryBaseTestSuite
|
||||
}
|
||||
|
||||
func Test_EnryOnLinguistCorpus(t *testing.T) {
|
||||
suite.Run(t, new(linguistCorpusSuite))
|
||||
}
|
||||
|
||||
// First part of the test_blob.rb#test_language
|
||||
// https://github.com/github/linguist/blob/59b2d88b2242e6062384e5fb876668cc30ead951/test/test_blob.rb#L258
|
||||
func (s *linguistCorpusSuite) TestLinguistSamples() {
|
||||
const filenamesDir = "filenames"
|
||||
var cornerCases = map[string]bool{
|
||||
"drop_stuff.sql": true, // https://github.com/src-d/enry/issues/194
|
||||
"textobj-rubyblock.vba": true, // Because of unsupported negative lookahead RE syntax (https://github.com/github/linguist/blob/8083cb5a89cee2d99f5a988f165994d0243f0d1e/lib/linguist/heuristics.yml#L521)
|
||||
// .es and .ice fail heuristics parsing, but do not fail any tests
|
||||
}
|
||||
|
||||
var total, failed, ok, other int
|
||||
var expected string
|
||||
filepath.Walk(s.samplesDir, func(path string, f os.FileInfo, err error) error {
|
||||
if f.IsDir() {
|
||||
if f.Name() != filenamesDir {
|
||||
expected, _ = data.LanguageByAlias(f.Name())
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
filename := filepath.Base(path)
|
||||
content, _ := ioutil.ReadFile(path)
|
||||
|
||||
total++
|
||||
obtained := GetLanguage(filename, content)
|
||||
if obtained == OtherLanguage {
|
||||
obtained = "Other"
|
||||
other++
|
||||
}
|
||||
|
||||
var status string
|
||||
if expected == obtained {
|
||||
status = "ok"
|
||||
ok++
|
||||
} else {
|
||||
status = "failed"
|
||||
failed++
|
||||
}
|
||||
|
||||
if _, ok := cornerCases[filename]; ok {
|
||||
s.T().Logf("\t\t[considered corner case] %s\texpected: %s\tobtained: %s\tstatus: %s\n", filename, expected, obtained, status)
|
||||
} else {
|
||||
assert.Equal(s.T(), expected, obtained, fmt.Sprintf("%s\texpected: %s\tobtained: %s\tstatus: %s\n", filename, expected, obtained, status))
|
||||
}
|
||||
return nil
|
||||
})
|
||||
s.T().Logf("\t\ttotal files: %d, ok: %d, failed: %d, other: %d\n", total, ok, failed, other)
|
||||
}
|
135
utils.go
135
utils.go
@ -3,8 +3,6 @@ package enry
|
||||
import (
|
||||
"bytes"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/go-enry/go-enry/v2/data"
|
||||
@ -63,11 +61,9 @@ func IsDotFile(path string) bool {
|
||||
return strings.HasPrefix(base, ".") && base != "."
|
||||
}
|
||||
|
||||
var isVendorRegExp *regexp.Regexp
|
||||
|
||||
// IsVendor returns whether or not path is a vendor path.
|
||||
func IsVendor(path string) bool {
|
||||
return isVendorRegExp.MatchString(path)
|
||||
return data.FastVendorMatcher.MatchString(path)
|
||||
}
|
||||
|
||||
// IsTest returns whether or not path is a test path.
|
||||
@ -75,6 +71,16 @@ func IsTest(path string) bool {
|
||||
return matchRegexSlice(data.TestMatchers, path)
|
||||
}
|
||||
|
||||
func matchRegexSlice(exprs []regex.EnryRegexp, str string) bool {
|
||||
for _, expr := range exprs {
|
||||
if expr.MatchString(str) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// IsBinary detects if data is a binary value based on:
|
||||
// http://git.kernel.org/cgit/git/git.git/tree/xdiff-interface.c?id=HEAD#n198
|
||||
func IsBinary(data []byte) bool {
|
||||
@ -102,16 +108,6 @@ func GetColor(language string) string {
|
||||
return "#cccccc"
|
||||
}
|
||||
|
||||
func matchRegexSlice(exprs []regex.EnryRegexp, str string) bool {
|
||||
for _, expr := range exprs {
|
||||
if expr.MatchString(str) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// IsGenerated returns whether the file with the given path and content is a
|
||||
// generated file.
|
||||
func IsGenerated(path string, content []byte) bool {
|
||||
@ -135,112 +131,3 @@ func IsGenerated(path string, content []byte) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func init() {
|
||||
// We now collate the individual regexps that make up the VendorMatchers to
|
||||
// produce a single large regexp which is around twice as fast to test than
|
||||
// simply iterating through all the regexps or naïvely collating the
|
||||
// regexps.
|
||||
//
|
||||
// ---
|
||||
//
|
||||
// data.VendorMatchers here is a slice containing individual regexps that
|
||||
// match a vendor file therefore if we want to test if a filename is a
|
||||
// Vendor we need to test whether that filename matches one or more of
|
||||
// those regexps.
|
||||
//
|
||||
// Now we could test each matcher in turn using a shortcircuiting test i.e.
|
||||
//
|
||||
// func IsVendor(filename string) bool {
|
||||
// for _, matcher := range data.VendorMatchers {
|
||||
// if matcher.Match(filename) {
|
||||
// return true
|
||||
// }
|
||||
// }
|
||||
// return false
|
||||
// }
|
||||
//
|
||||
// Or concatenate all these regexps using groups i.e.
|
||||
//
|
||||
// `(regexp1)|(regexp2)|(regexp3)|...`
|
||||
//
|
||||
// However both of these are relatively slow and they don't take advantage
|
||||
// of the inherent structure within our regexps...
|
||||
//
|
||||
// If we look at our regexps there are essentially three types of regexp:
|
||||
//
|
||||
// 1. Those that start with `^`
|
||||
// 2. Those that start with `(^|/)`
|
||||
// 3. Others
|
||||
//
|
||||
// If we collate our regexps into these groups that will significantly
|
||||
// reduce the likelihood of backtracking within the regexp trie matcher.
|
||||
//
|
||||
// A further improvement is to use non-capturing groups as otherwise the
|
||||
// regexp parser, whilst matching, will have to allocate slices for
|
||||
// matching positions. (A future improvement here could be in the use of
|
||||
// enforcing non-capturing groups within the sub-regexps too.)
|
||||
//
|
||||
// Finally if we sort the segments we can help the matcher build a more
|
||||
// efficient matcher and trie.
|
||||
|
||||
// alias the VendorMatchers to simplify things
|
||||
matchers := data.VendorMatchers
|
||||
|
||||
// Create three temporary string slices for our three groups above - prefixes removed
|
||||
caretStrings := make([]string, 0, 10)
|
||||
caretSegmentStrings := make([]string, 0, 10)
|
||||
matcherStrings := make([]string, 0, len(matchers))
|
||||
|
||||
// Walk the matchers and check their string representation for each group prefix, remove it and add to the respective group slices
|
||||
for _, matcher := range matchers {
|
||||
str := matcher.String()
|
||||
if str[0] == '^' {
|
||||
caretStrings = append(caretStrings, str[1:])
|
||||
} else if str[0:5] == "(^|/)" {
|
||||
caretSegmentStrings = append(caretSegmentStrings, str[5:])
|
||||
} else {
|
||||
matcherStrings = append(matcherStrings, str)
|
||||
}
|
||||
}
|
||||
|
||||
// Sort the strings within each group - a potential further improvement could be in simplifying within these groups
|
||||
sort.Strings(caretSegmentStrings)
|
||||
sort.Strings(caretStrings)
|
||||
sort.Strings(matcherStrings)
|
||||
|
||||
// Now build the collated regexp
|
||||
sb := &strings.Builder{}
|
||||
|
||||
// Start with group 1 - those that started with `^`
|
||||
sb.WriteString("(?:^(?:")
|
||||
sb.WriteString(caretStrings[0])
|
||||
for _, matcher := range caretStrings[1:] {
|
||||
sb.WriteString(")|(?:")
|
||||
sb.WriteString(matcher)
|
||||
}
|
||||
sb.WriteString("))")
|
||||
sb.WriteString("|")
|
||||
|
||||
// Now add group 2 - those that started with `(^|/)`
|
||||
sb.WriteString("(?:(?:^|/)(?:")
|
||||
sb.WriteString(caretSegmentStrings[0])
|
||||
for _, matcher := range caretSegmentStrings[1:] {
|
||||
sb.WriteString(")|(?:")
|
||||
sb.WriteString(matcher)
|
||||
}
|
||||
sb.WriteString("))")
|
||||
sb.WriteString("|")
|
||||
|
||||
// Finally add the rest
|
||||
sb.WriteString("(?:")
|
||||
sb.WriteString(matcherStrings[0])
|
||||
for _, matcher := range matcherStrings[1:] {
|
||||
sb.WriteString(")|(?:")
|
||||
sb.WriteString(matcher)
|
||||
}
|
||||
sb.WriteString(")")
|
||||
|
||||
// Compile the whole thing as the isVendorRegExp
|
||||
isVendorRegExp = regexp.MustCompile(sb.String())
|
||||
}
|
||||
|
@ -11,45 +11,53 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
//TODO(bzz): port all from test/test_file_blob.rb test_vendored()
|
||||
//https://github.com/github/linguist/blob/86adc140d3e8903980565a2984f5532edf4ae875/test/test_file_blob.rb#L270-L583
|
||||
var vendorTests = []struct {
|
||||
path string
|
||||
expected bool
|
||||
}{
|
||||
{"cache/", true},
|
||||
{"something_cache/", false},
|
||||
{"random/cache/", true},
|
||||
{"cache", false},
|
||||
{"dependencies/", true},
|
||||
{"Dependencies/", true},
|
||||
{"dependency/", false},
|
||||
{"dist/", true},
|
||||
{"dist", false},
|
||||
{"random/dist/", true},
|
||||
{"random/dist", false},
|
||||
{"deps/", true},
|
||||
{"foodeps/", false},
|
||||
{"configure", true},
|
||||
{"a/configure", true},
|
||||
{"config.guess", true},
|
||||
{"config.guess/", false},
|
||||
{".vscode/", true},
|
||||
{"doc/_build/", true},
|
||||
{"a/docs/_build/", true},
|
||||
{"a/dasdocs/_build-vsdoc.js", true},
|
||||
{"a/dasdocs/_build-vsdoc.j", false},
|
||||
{"foo/bar", false},
|
||||
{".sublime-project", true},
|
||||
{"foo/vendor/foo", true},
|
||||
{"leaflet.draw-src.js", true},
|
||||
{"foo/bar/MochiKit.js", true},
|
||||
{"foo/bar/dojo.js", true},
|
||||
{"foo/env/whatever", true},
|
||||
{"some/python/venv/", false},
|
||||
{"foo/.imageset/bar", true},
|
||||
{"Vagrantfile", true},
|
||||
{"src/bootstrap-custom.js", true},
|
||||
// {"/css/bootstrap.rtl.css", true}, // from linguist v7.23
|
||||
}
|
||||
|
||||
func TestIsVendor(t *testing.T) {
|
||||
tests := []struct {
|
||||
path string
|
||||
expected bool
|
||||
}{
|
||||
{"cache/", true},
|
||||
{"random/cache/", true},
|
||||
{"cache", false},
|
||||
{"dependencies/", true},
|
||||
{"Dependencies/", true},
|
||||
{"dependency/", false},
|
||||
{"dist/", true},
|
||||
{"dist", false},
|
||||
{"random/dist/", true},
|
||||
{"random/dist", false},
|
||||
{"deps/", true},
|
||||
{"configure", true},
|
||||
{"a/configure", true},
|
||||
{"config.guess", true},
|
||||
{"config.guess/", false},
|
||||
{".vscode/", true},
|
||||
{"doc/_build/", true},
|
||||
{"a/docs/_build/", true},
|
||||
{"a/dasdocs/_build-vsdoc.js", true},
|
||||
{"a/dasdocs/_build-vsdoc.j", false},
|
||||
{"foo/bar", false},
|
||||
{".sublime-project", true},
|
||||
{"foo/vendor/foo", true},
|
||||
{"leaflet.draw-src.js", true},
|
||||
{"foo/bar/MochiKit.js", true},
|
||||
{"foo/bar/dojo.js", true},
|
||||
{"foo/env/whatever", true},
|
||||
{"foo/.imageset/bar", true},
|
||||
{"Vagrantfile", true},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
for _, tt := range vendorTests {
|
||||
t.Run(tt.path, func(t *testing.T) {
|
||||
if got := IsVendor(tt.path); got != tt.expected {
|
||||
t.Errorf("IsVendor() = %v, expected %v", got, tt.expected)
|
||||
t.Errorf("IsVendor(%q) = %v, expected %v", tt.path, got, tt.expected)
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -57,10 +65,9 @@ func TestIsVendor(t *testing.T) {
|
||||
|
||||
func BenchmarkIsVendor(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
IsVendor(".vscode/")
|
||||
IsVendor("cache/")
|
||||
IsVendor("foo/bar")
|
||||
IsVendor("foo/bar/MochiKit.js")
|
||||
for _, t := range vendorTests {
|
||||
IsVendor(t.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user