Merge pull request #12 from mcuadros/oniguruma

data: replace substring package with regex package
This commit is contained in:
Máximo Cuadros 2020-04-15 19:58:28 +02:00 committed by GitHub
commit 9fba3da45f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 401 additions and 395 deletions

View File

@ -3,24 +3,24 @@
package data package data
import "gopkg.in/toqueteos/substring.v1" import "github.com/go-enry/go-enry/v2/regex"
var DocumentationMatchers = substring.Or( var DocumentationMatchers = []regex.EnryRegexp{
substring.Regexp(`^[Dd]ocs?/`), regex.MustCompile(`^[Dd]ocs?/`),
substring.Regexp(`(^|/)[Dd]ocumentation/`), regex.MustCompile(`(^|/)[Dd]ocumentation/`),
substring.Regexp(`(^|/)[Gg]roovydoc/`), regex.MustCompile(`(^|/)[Gg]roovydoc/`),
substring.Regexp(`(^|/)[Jj]avadoc/`), regex.MustCompile(`(^|/)[Jj]avadoc/`),
substring.Regexp(`^[Mm]an/`), regex.MustCompile(`^[Mm]an/`),
substring.Regexp(`^[Ee]xamples/`), regex.MustCompile(`^[Ee]xamples/`),
substring.Regexp(`^[Dd]emos?/`), regex.MustCompile(`^[Dd]emos?/`),
substring.Regexp(`(^|/)inst/doc/`), regex.MustCompile(`(^|/)inst/doc/`),
substring.Regexp(`(^|/)CHANGE(S|LOG)?(\.|$)`), regex.MustCompile(`(^|/)CHANGE(S|LOG)?(\.|$)`),
substring.Regexp(`(^|/)CONTRIBUTING(\.|$)`), regex.MustCompile(`(^|/)CONTRIBUTING(\.|$)`),
substring.Regexp(`(^|/)COPYING(\.|$)`), regex.MustCompile(`(^|/)COPYING(\.|$)`),
substring.Regexp(`(^|/)INSTALL(\.|$)`), regex.MustCompile(`(^|/)INSTALL(\.|$)`),
substring.Regexp(`(^|/)LICEN[CS]E(\.|$)`), regex.MustCompile(`(^|/)LICEN[CS]E(\.|$)`),
substring.Regexp(`(^|/)[Ll]icen[cs]e(\.|$)`), regex.MustCompile(`(^|/)[Ll]icen[cs]e(\.|$)`),
substring.Regexp(`(^|/)README(\.|$)`), regex.MustCompile(`(^|/)README(\.|$)`),
substring.Regexp(`(^|/)[Rr]eadme(\.|$)`), regex.MustCompile(`(^|/)[Rr]eadme(\.|$)`),
substring.Regexp(`^[Ss]amples?/`), regex.MustCompile(`^[Ss]amples?/`),
) }

View File

@ -1,17 +1,17 @@
package data package data
import "gopkg.in/toqueteos/substring.v1" import "github.com/go-enry/go-enry/v2/regex"
// TestMatchers is hand made collection of regexp used by the function `enry.IsTest` // TestMatchers is hand made collection of regexp used by the function `enry.IsTest`
// to identify test files in different languages. // to identify test files in different languages.
var TestMatchers = substring.Or( var TestMatchers = []regex.EnryRegexp{
substring.Regexp(`(^|/)tests/.*Test\.php$`), regex.MustCompile(`(^|/)tests/.*Test\.php$`),
substring.Regexp(`(^|/)test/.*Test(s?)\.java$`), regex.MustCompile(`(^|/)test/.*Test(s?)\.java$`),
substring.Regexp(`(^|/)test(/|/.*/)Test.*\.java$`), regex.MustCompile(`(^|/)test(/|/.*/)Test.*\.java$`),
substring.Regexp(`(^|/)test/.*(Test(s?)|Spec(s?))\.scala$`), regex.MustCompile(`(^|/)test/.*(Test(s?)|Spec(s?))\.scala$`),
substring.Regexp(`(^|/)test_.*\.py$`), regex.MustCompile(`(^|/)test_.*\.py$`),
substring.Regexp(`(^|/).*_test\.go$`), regex.MustCompile(`(^|/).*_test\.go$`),
substring.Regexp(`(^|/).*_(test|spec)\.rb$`), regex.MustCompile(`(^|/).*_(test|spec)\.rb$`),
substring.Regexp(`(^|/).*Test(s?)\.cs$`), regex.MustCompile(`(^|/).*Test(s?)\.cs$`),
substring.Regexp(`(^|/).*\.(test|spec)\.(ts|tsx|js)$`), regex.MustCompile(`(^|/).*\.(test|spec)\.(ts|tsx|js)$`),
) }

View File

@ -3,167 +3,167 @@
package data package data
import "gopkg.in/toqueteos/substring.v1" import "github.com/go-enry/go-enry/v2/regex"
var VendorMatchers = substring.Or( var VendorMatchers = []regex.EnryRegexp{
substring.Regexp(`(^|/)cache/`), regex.MustCompile(`(^|/)cache/`),
substring.Regexp(`^[Dd]ependencies/`), regex.MustCompile(`^[Dd]ependencies/`),
substring.Regexp(`(^|/)dist/`), regex.MustCompile(`(^|/)dist/`),
substring.Regexp(`^deps/`), regex.MustCompile(`^deps/`),
substring.Regexp(`(^|/)configure$`), regex.MustCompile(`(^|/)configure$`),
substring.Regexp(`(^|/)config.guess$`), regex.MustCompile(`(^|/)config.guess$`),
substring.Regexp(`(^|/)config.sub$`), regex.MustCompile(`(^|/)config.sub$`),
substring.Regexp(`(^|/)aclocal.m4`), regex.MustCompile(`(^|/)aclocal.m4`),
substring.Regexp(`(^|/)libtool.m4`), regex.MustCompile(`(^|/)libtool.m4`),
substring.Regexp(`(^|/)ltoptions.m4`), regex.MustCompile(`(^|/)ltoptions.m4`),
substring.Regexp(`(^|/)ltsugar.m4`), regex.MustCompile(`(^|/)ltsugar.m4`),
substring.Regexp(`(^|/)ltversion.m4`), regex.MustCompile(`(^|/)ltversion.m4`),
substring.Regexp(`(^|/)lt~obsolete.m4`), regex.MustCompile(`(^|/)lt~obsolete.m4`),
substring.Regexp(`dotnet-install\.(ps1|sh)$`), regex.MustCompile(`dotnet-install\.(ps1|sh)$`),
substring.Regexp(`cpplint.py`), regex.MustCompile(`cpplint.py`),
substring.Regexp(`node_modules/`), regex.MustCompile(`node_modules/`),
substring.Regexp(`(^|/)\.yarn/releases/`), regex.MustCompile(`(^|/)\.yarn/releases/`),
substring.Regexp(`(^|/)_esy$`), regex.MustCompile(`(^|/)_esy$`),
substring.Regexp(`bower_components/`), regex.MustCompile(`bower_components/`),
substring.Regexp(`^rebar$`), regex.MustCompile(`^rebar$`),
substring.Regexp(`erlang.mk`), regex.MustCompile(`erlang.mk`),
substring.Regexp(`Godeps/_workspace/`), regex.MustCompile(`Godeps/_workspace/`),
substring.Regexp(`(^|/)testdata/`), regex.MustCompile(`(^|/)testdata/`),
substring.Regexp(`.indent.pro`), regex.MustCompile(`.indent.pro`),
substring.Regexp(`(\.|-)min\.(js|css)$`), regex.MustCompile(`(\.|-)min\.(js|css)$`),
substring.Regexp(`([^\s]*)import\.(css|less|scss|styl)$`), regex.MustCompile(`([^\s]*)import\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)bootstrap([^.]*)\.(js|css|less|scss|styl)$`), regex.MustCompile(`(^|/)bootstrap([^.]*)\.(js|css|less|scss|styl)$`),
substring.Regexp(`(^|/)custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$`), regex.MustCompile(`(^|/)custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$`),
substring.Regexp(`(^|/)font-?awesome\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)font-?awesome\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)font-?awesome/.*\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)font-?awesome/.*\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)foundation\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)foundation\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)normalize\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)normalize\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)skeleton\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)skeleton\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)[Bb]ourbon/.*\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)[Bb]ourbon/.*\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)animate\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)animate\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)materialize\.(css|less|scss|styl|js)$`), regex.MustCompile(`(^|/)materialize\.(css|less|scss|styl|js)$`),
substring.Regexp(`(^|/)select2/.*\.(css|scss|js)$`), regex.MustCompile(`(^|/)select2/.*\.(css|scss|js)$`),
substring.Regexp(`(^|/)bulma\.(css|sass|scss)$`), regex.MustCompile(`(^|/)bulma\.(css|sass|scss)$`),
substring.Regexp(`(3rd|[Tt]hird)[-_]?[Pp]arty/`), regex.MustCompile(`(3rd|[Tt]hird)[-_]?[Pp]arty/`),
substring.Regexp(`vendors?/`), regex.MustCompile(`vendors?/`),
substring.Regexp(`extern(al)?/`), regex.MustCompile(`extern(al)?/`),
substring.Regexp(`(^|/)[Vv]+endor/`), regex.MustCompile(`(^|/)[Vv]+endor/`),
substring.Regexp(`^debian/`), regex.MustCompile(`^debian/`),
substring.Regexp(`run.n$`), regex.MustCompile(`run.n$`),
substring.Regexp(`bootstrap-datepicker/`), regex.MustCompile(`bootstrap-datepicker/`),
substring.Regexp(`(^|/)jquery([^.]*)\.js$`), regex.MustCompile(`(^|/)jquery([^.]*)\.js$`),
substring.Regexp(`(^|/)jquery\-\d\.\d+(\.\d+)?\.js$`), regex.MustCompile(`(^|/)jquery\-\d\.\d+(\.\d+)?\.js$`),
substring.Regexp(`(^|/)jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$`), regex.MustCompile(`(^|/)jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$`),
substring.Regexp(`(^|/)jquery\.(ui|effects)\.([^.]*)\.(js|css)$`), regex.MustCompile(`(^|/)jquery\.(ui|effects)\.([^.]*)\.(js|css)$`),
substring.Regexp(`jquery.fn.gantt.js`), regex.MustCompile(`jquery.fn.gantt.js`),
substring.Regexp(`jquery.fancybox.(js|css)`), regex.MustCompile(`jquery.fancybox.(js|css)`),
substring.Regexp(`fuelux.js`), regex.MustCompile(`fuelux.js`),
substring.Regexp(`(^|/)jquery\.fileupload(-\w+)?\.js$`), regex.MustCompile(`(^|/)jquery\.fileupload(-\w+)?\.js$`),
substring.Regexp(`jquery.dataTables.js`), regex.MustCompile(`jquery.dataTables.js`),
substring.Regexp(`bootbox.js`), regex.MustCompile(`bootbox.js`),
substring.Regexp(`pdf.worker.js`), regex.MustCompile(`pdf.worker.js`),
substring.Regexp(`(^|/)slick\.\w+.js$`), regex.MustCompile(`(^|/)slick\.\w+.js$`),
substring.Regexp(`(^|/)Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$`), regex.MustCompile(`(^|/)Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$`),
substring.Regexp(`leaflet.draw-src.js`), regex.MustCompile(`leaflet.draw-src.js`),
substring.Regexp(`leaflet.draw.css`), regex.MustCompile(`leaflet.draw.css`),
substring.Regexp(`Control.FullScreen.css`), regex.MustCompile(`Control.FullScreen.css`),
substring.Regexp(`Control.FullScreen.js`), regex.MustCompile(`Control.FullScreen.js`),
substring.Regexp(`leaflet.spin.js`), regex.MustCompile(`leaflet.spin.js`),
substring.Regexp(`wicket-leaflet.js`), regex.MustCompile(`wicket-leaflet.js`),
substring.Regexp(`.sublime-project`), regex.MustCompile(`.sublime-project`),
substring.Regexp(`.sublime-workspace`), regex.MustCompile(`.sublime-workspace`),
substring.Regexp(`.vscode`), regex.MustCompile(`.vscode`),
substring.Regexp(`(^|/)prototype(.*)\.js$`), regex.MustCompile(`(^|/)prototype(.*)\.js$`),
substring.Regexp(`(^|/)effects\.js$`), regex.MustCompile(`(^|/)effects\.js$`),
substring.Regexp(`(^|/)controls\.js$`), regex.MustCompile(`(^|/)controls\.js$`),
substring.Regexp(`(^|/)dragdrop\.js$`), regex.MustCompile(`(^|/)dragdrop\.js$`),
substring.Regexp(`(.*?)\.d\.ts$`), regex.MustCompile(`(.*?)\.d\.ts$`),
substring.Regexp(`(^|/)mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$`), regex.MustCompile(`(^|/)mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$`),
substring.Regexp(`(^|/)dojo\.js$`), regex.MustCompile(`(^|/)dojo\.js$`),
substring.Regexp(`(^|/)MochiKit\.js$`), regex.MustCompile(`(^|/)MochiKit\.js$`),
substring.Regexp(`(^|/)yahoo-([^.]*)\.js$`), regex.MustCompile(`(^|/)yahoo-([^.]*)\.js$`),
substring.Regexp(`(^|/)yui([^.]*)\.js$`), regex.MustCompile(`(^|/)yui([^.]*)\.js$`),
substring.Regexp(`(^|/)ckeditor\.js$`), regex.MustCompile(`(^|/)ckeditor\.js$`),
substring.Regexp(`(^|/)tiny_mce([^.]*)\.js$`), regex.MustCompile(`(^|/)tiny_mce([^.]*)\.js$`),
substring.Regexp(`(^|/)tiny_mce/(langs|plugins|themes|utils)`), regex.MustCompile(`(^|/)tiny_mce/(langs|plugins|themes|utils)`),
substring.Regexp(`(^|/)ace-builds/`), regex.MustCompile(`(^|/)ace-builds/`),
substring.Regexp(`(^|/)fontello(.*?)\.css$`), regex.MustCompile(`(^|/)fontello(.*?)\.css$`),
substring.Regexp(`(^|/)MathJax/`), regex.MustCompile(`(^|/)MathJax/`),
substring.Regexp(`(^|/)Chart\.js$`), regex.MustCompile(`(^|/)Chart\.js$`),
substring.Regexp(`(^|/)[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo)`), regex.MustCompile(`(^|/)[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo)`),
substring.Regexp(`(^|/)shBrush([^.]*)\.js$`), regex.MustCompile(`(^|/)shBrush([^.]*)\.js$`),
substring.Regexp(`(^|/)shCore\.js$`), regex.MustCompile(`(^|/)shCore\.js$`),
substring.Regexp(`(^|/)shLegacy\.js$`), regex.MustCompile(`(^|/)shLegacy\.js$`),
substring.Regexp(`(^|/)angular([^.]*)\.js$`), regex.MustCompile(`(^|/)angular([^.]*)\.js$`),
substring.Regexp(`(^|\/)d3(\.v\d+)?([^.]*)\.js$`), regex.MustCompile(`(^|\/)d3(\.v\d+)?([^.]*)\.js$`),
substring.Regexp(`(^|/)react(-[^.]*)?\.js$`), regex.MustCompile(`(^|/)react(-[^.]*)?\.js$`),
substring.Regexp(`(^|/)flow-typed/.*\.js$`), regex.MustCompile(`(^|/)flow-typed/.*\.js$`),
substring.Regexp(`(^|/)modernizr\-\d\.\d+(\.\d+)?\.js$`), regex.MustCompile(`(^|/)modernizr\-\d\.\d+(\.\d+)?\.js$`),
substring.Regexp(`(^|/)modernizr\.custom\.\d+\.js$`), regex.MustCompile(`(^|/)modernizr\.custom\.\d+\.js$`),
substring.Regexp(`(^|/)knockout-(\d+\.){3}(debug\.)?js$`), regex.MustCompile(`(^|/)knockout-(\d+\.){3}(debug\.)?js$`),
substring.Regexp(`(^|/)docs?/_?(build|themes?|templates?|static)/`), regex.MustCompile(`(^|/)docs?/_?(build|themes?|templates?|static)/`),
substring.Regexp(`(^|/)admin_media/`), regex.MustCompile(`(^|/)admin_media/`),
substring.Regexp(`(^|/)env/`), regex.MustCompile(`(^|/)env/`),
substring.Regexp(`^fabfile\.py$`), regex.MustCompile(`^fabfile\.py$`),
substring.Regexp(`^waf$`), regex.MustCompile(`^waf$`),
substring.Regexp(`^.osx$`), regex.MustCompile(`^.osx$`),
substring.Regexp(`\.xctemplate/`), regex.MustCompile(`\.xctemplate/`),
substring.Regexp(`\.imageset/`), regex.MustCompile(`\.imageset/`),
substring.Regexp(`(^|/)Carthage/`), regex.MustCompile(`(^|/)Carthage/`),
substring.Regexp(`(^|/)Sparkle/`), regex.MustCompile(`(^|/)Sparkle/`),
substring.Regexp(`Crashlytics.framework/`), regex.MustCompile(`Crashlytics.framework/`),
substring.Regexp(`Fabric.framework/`), regex.MustCompile(`Fabric.framework/`),
substring.Regexp(`BuddyBuildSDK.framework/`), regex.MustCompile(`BuddyBuildSDK.framework/`),
substring.Regexp(`Realm.framework`), regex.MustCompile(`Realm.framework`),
substring.Regexp(`RealmSwift.framework`), regex.MustCompile(`RealmSwift.framework`),
substring.Regexp(`gitattributes$`), regex.MustCompile(`gitattributes$`),
substring.Regexp(`gitignore$`), regex.MustCompile(`gitignore$`),
substring.Regexp(`gitmodules$`), regex.MustCompile(`gitmodules$`),
substring.Regexp(`(^|/)gradlew$`), regex.MustCompile(`(^|/)gradlew$`),
substring.Regexp(`(^|/)gradlew\.bat$`), regex.MustCompile(`(^|/)gradlew\.bat$`),
substring.Regexp(`(^|/)gradle/wrapper/`), regex.MustCompile(`(^|/)gradle/wrapper/`),
substring.Regexp(`(^|/)mvnw$`), regex.MustCompile(`(^|/)mvnw$`),
substring.Regexp(`(^|/)mvnw\.cmd$`), regex.MustCompile(`(^|/)mvnw\.cmd$`),
substring.Regexp(`(^|/)\.mvn/wrapper/`), regex.MustCompile(`(^|/)\.mvn/wrapper/`),
substring.Regexp(`-vsdoc\.js$`), regex.MustCompile(`-vsdoc\.js$`),
substring.Regexp(`\.intellisense\.js$`), regex.MustCompile(`\.intellisense\.js$`),
substring.Regexp(`(^|/)jquery([^.]*)\.validate(\.unobtrusive)?\.js$`), regex.MustCompile(`(^|/)jquery([^.]*)\.validate(\.unobtrusive)?\.js$`),
substring.Regexp(`(^|/)jquery([^.]*)\.unobtrusive\-ajax\.js$`), regex.MustCompile(`(^|/)jquery([^.]*)\.unobtrusive\-ajax\.js$`),
substring.Regexp(`(^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$`), regex.MustCompile(`(^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$`),
substring.Regexp(`^[Pp]ackages\/.+\.\d+\/`), regex.MustCompile(`^[Pp]ackages\/.+\.\d+\/`),
substring.Regexp(`(^|/)extjs/.*?\.js$`), regex.MustCompile(`(^|/)extjs/.*?\.js$`),
substring.Regexp(`(^|/)extjs/.*?\.xml$`), regex.MustCompile(`(^|/)extjs/.*?\.xml$`),
substring.Regexp(`(^|/)extjs/.*?\.txt$`), regex.MustCompile(`(^|/)extjs/.*?\.txt$`),
substring.Regexp(`(^|/)extjs/.*?\.html$`), regex.MustCompile(`(^|/)extjs/.*?\.html$`),
substring.Regexp(`(^|/)extjs/.*?\.properties$`), regex.MustCompile(`(^|/)extjs/.*?\.properties$`),
substring.Regexp(`(^|/)extjs/.sencha/`), regex.MustCompile(`(^|/)extjs/.sencha/`),
substring.Regexp(`(^|/)extjs/docs/`), regex.MustCompile(`(^|/)extjs/docs/`),
substring.Regexp(`(^|/)extjs/builds/`), regex.MustCompile(`(^|/)extjs/builds/`),
substring.Regexp(`(^|/)extjs/cmd/`), regex.MustCompile(`(^|/)extjs/cmd/`),
substring.Regexp(`(^|/)extjs/examples/`), regex.MustCompile(`(^|/)extjs/examples/`),
substring.Regexp(`(^|/)extjs/locale/`), regex.MustCompile(`(^|/)extjs/locale/`),
substring.Regexp(`(^|/)extjs/packages/`), regex.MustCompile(`(^|/)extjs/packages/`),
substring.Regexp(`(^|/)extjs/plugins/`), regex.MustCompile(`(^|/)extjs/plugins/`),
substring.Regexp(`(^|/)extjs/resources/`), regex.MustCompile(`(^|/)extjs/resources/`),
substring.Regexp(`(^|/)extjs/src/`), regex.MustCompile(`(^|/)extjs/src/`),
substring.Regexp(`(^|/)extjs/welcome/`), regex.MustCompile(`(^|/)extjs/welcome/`),
substring.Regexp(`(^|/)html5shiv\.js$`), regex.MustCompile(`(^|/)html5shiv\.js$`),
substring.Regexp(`^[Tt]ests?/fixtures/`), regex.MustCompile(`^[Tt]ests?/fixtures/`),
substring.Regexp(`^[Ss]pecs?/fixtures/`), regex.MustCompile(`^[Ss]pecs?/fixtures/`),
substring.Regexp(`(^|/)cordova([^.]*)\.js$`), regex.MustCompile(`(^|/)cordova([^.]*)\.js$`),
substring.Regexp(`(^|/)cordova\-\d\.\d(\.\d)?\.js$`), regex.MustCompile(`(^|/)cordova\-\d\.\d(\.\d)?\.js$`),
substring.Regexp(`foundation(\..*)?\.js$`), regex.MustCompile(`foundation(\..*)?\.js$`),
substring.Regexp(`^Vagrantfile$`), regex.MustCompile(`^Vagrantfile$`),
substring.Regexp(`.[Dd][Ss]_[Ss]tore$`), regex.MustCompile(`.[Dd][Ss]_[Ss]tore$`),
substring.Regexp(`^vignettes/`), regex.MustCompile(`^vignettes/`),
substring.Regexp(`^inst/extdata/`), regex.MustCompile(`^inst/extdata/`),
substring.Regexp(`octicons.css`), regex.MustCompile(`octicons.css`),
substring.Regexp(`sprockets-octicons.scss`), regex.MustCompile(`sprockets-octicons.scss`),
substring.Regexp(`(^|/)activator$`), regex.MustCompile(`(^|/)activator$`),
substring.Regexp(`(^|/)activator\.bat$`), regex.MustCompile(`(^|/)activator\.bat$`),
substring.Regexp(`proguard.pro`), regex.MustCompile(`proguard.pro`),
substring.Regexp(`proguard-rules.pro`), regex.MustCompile(`proguard-rules.pro`),
substring.Regexp(`^puphpet/`), regex.MustCompile(`^puphpet/`),
substring.Regexp(`(^|/)\.google_apis/`), regex.MustCompile(`(^|/)\.google_apis/`),
substring.Regexp(`^Jenkinsfile$`), regex.MustCompile(`^Jenkinsfile$`),
) }

2
go.mod
View File

@ -5,7 +5,5 @@ go 1.14
require ( require (
github.com/go-enry/go-oniguruma v1.2.0 github.com/go-enry/go-oniguruma v1.2.0
github.com/stretchr/testify v1.3.0 github.com/stretchr/testify v1.3.0
github.com/toqueteos/trie v1.0.0 // indirect
gopkg.in/toqueteos/substring.v1 v1.0.2
gopkg.in/yaml.v2 v2.2.8 gopkg.in/yaml.v2 v2.2.8
) )

4
go.sum
View File

@ -8,11 +8,7 @@ github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/toqueteos/trie v1.0.0 h1:8i6pXxNUXNRAqP246iibb7w/pSFquNTQ+uNfriG7vlk=
github.com/toqueteos/trie v1.0.0/go.mod h1:Ywk48QhEqhU1+DwhMkJ2x7eeGxDHiGkAdc9+0DYcbsM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/toqueteos/substring.v1 v1.0.2 h1:urLqCeMm6x/eTuQa1oZerNw8N1KNOIp5hD5kGL7lFsE=
gopkg.in/toqueteos/substring.v1 v1.0.2/go.mod h1:Eb2Z1UYehlVK8LYW2WBVR2rwbujsz3aX8XDrM1vbNew=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -1,9 +1,10 @@
package data package data
import "gopkg.in/toqueteos/substring.v1" import "github.com/go-enry/go-enry/v2/regex"
var DocumentationMatchers = substring.Or( var DocumentationMatchers = []regex.EnryRegexp{
{{range $regexp := . -}} {{range $regexp := . -}}
substring.Regexp(`{{ $regexp }}`), regex.MustCompile(`{{ $regexp }}`),
{{end -}} {{end -}}
) }

View File

@ -1,9 +1,9 @@
package data package data
import "gopkg.in/toqueteos/substring.v1" import "github.com/go-enry/go-enry/v2/regex"
var VendorMatchers = substring.Or( var VendorMatchers = []regex.EnryRegexp{
{{range $regexp := . -}} {{range $regexp := . -}}
substring.Regexp(`{{ $regexp }}`), regex.MustCompile(`{{ $regexp }}`),
{{end -}} {{end -}}
) }

View File

@ -3,24 +3,24 @@
package data package data
import "gopkg.in/toqueteos/substring.v1" import "github.com/go-enry/go-enry/v2/regex"
var DocumentationMatchers = substring.Or( var DocumentationMatchers = []regex.EnryRegexp{
substring.Regexp(`^[Dd]ocs?/`), regex.MustCompile(`^[Dd]ocs?/`),
substring.Regexp(`(^|/)[Dd]ocumentation/`), regex.MustCompile(`(^|/)[Dd]ocumentation/`),
substring.Regexp(`(^|/)[Gg]roovydoc/`), regex.MustCompile(`(^|/)[Gg]roovydoc/`),
substring.Regexp(`(^|/)[Jj]avadoc/`), regex.MustCompile(`(^|/)[Jj]avadoc/`),
substring.Regexp(`^[Mm]an/`), regex.MustCompile(`^[Mm]an/`),
substring.Regexp(`^[Ee]xamples/`), regex.MustCompile(`^[Ee]xamples/`),
substring.Regexp(`^[Dd]emos?/`), regex.MustCompile(`^[Dd]emos?/`),
substring.Regexp(`(^|/)inst/doc/`), regex.MustCompile(`(^|/)inst/doc/`),
substring.Regexp(`(^|/)CHANGE(S|LOG)?(\.|$)`), regex.MustCompile(`(^|/)CHANGE(S|LOG)?(\.|$)`),
substring.Regexp(`(^|/)CONTRIBUTING(\.|$)`), regex.MustCompile(`(^|/)CONTRIBUTING(\.|$)`),
substring.Regexp(`(^|/)COPYING(\.|$)`), regex.MustCompile(`(^|/)COPYING(\.|$)`),
substring.Regexp(`(^|/)INSTALL(\.|$)`), regex.MustCompile(`(^|/)INSTALL(\.|$)`),
substring.Regexp(`(^|/)LICEN[CS]E(\.|$)`), regex.MustCompile(`(^|/)LICEN[CS]E(\.|$)`),
substring.Regexp(`(^|/)[Ll]icen[cs]e(\.|$)`), regex.MustCompile(`(^|/)[Ll]icen[cs]e(\.|$)`),
substring.Regexp(`(^|/)README(\.|$)`), regex.MustCompile(`(^|/)README(\.|$)`),
substring.Regexp(`(^|/)[Rr]eadme(\.|$)`), regex.MustCompile(`(^|/)[Rr]eadme(\.|$)`),
substring.Regexp(`^[Ss]amples?/`), regex.MustCompile(`^[Ss]amples?/`),
) }

View File

@ -3,167 +3,167 @@
package data package data
import "gopkg.in/toqueteos/substring.v1" import "github.com/go-enry/go-enry/v2/regex"
var VendorMatchers = substring.Or( var VendorMatchers = []regex.EnryRegexp{
substring.Regexp(`(^|/)cache/`), regex.MustCompile(`(^|/)cache/`),
substring.Regexp(`^[Dd]ependencies/`), regex.MustCompile(`^[Dd]ependencies/`),
substring.Regexp(`(^|/)dist/`), regex.MustCompile(`(^|/)dist/`),
substring.Regexp(`^deps/`), regex.MustCompile(`^deps/`),
substring.Regexp(`(^|/)configure$`), regex.MustCompile(`(^|/)configure$`),
substring.Regexp(`(^|/)config.guess$`), regex.MustCompile(`(^|/)config.guess$`),
substring.Regexp(`(^|/)config.sub$`), regex.MustCompile(`(^|/)config.sub$`),
substring.Regexp(`(^|/)aclocal.m4`), regex.MustCompile(`(^|/)aclocal.m4`),
substring.Regexp(`(^|/)libtool.m4`), regex.MustCompile(`(^|/)libtool.m4`),
substring.Regexp(`(^|/)ltoptions.m4`), regex.MustCompile(`(^|/)ltoptions.m4`),
substring.Regexp(`(^|/)ltsugar.m4`), regex.MustCompile(`(^|/)ltsugar.m4`),
substring.Regexp(`(^|/)ltversion.m4`), regex.MustCompile(`(^|/)ltversion.m4`),
substring.Regexp(`(^|/)lt~obsolete.m4`), regex.MustCompile(`(^|/)lt~obsolete.m4`),
substring.Regexp(`dotnet-install\.(ps1|sh)$`), regex.MustCompile(`dotnet-install\.(ps1|sh)$`),
substring.Regexp(`cpplint.py`), regex.MustCompile(`cpplint.py`),
substring.Regexp(`node_modules/`), regex.MustCompile(`node_modules/`),
substring.Regexp(`(^|/)\.yarn/releases/`), regex.MustCompile(`(^|/)\.yarn/releases/`),
substring.Regexp(`(^|/)_esy$`), regex.MustCompile(`(^|/)_esy$`),
substring.Regexp(`bower_components/`), regex.MustCompile(`bower_components/`),
substring.Regexp(`^rebar$`), regex.MustCompile(`^rebar$`),
substring.Regexp(`erlang.mk`), regex.MustCompile(`erlang.mk`),
substring.Regexp(`Godeps/_workspace/`), regex.MustCompile(`Godeps/_workspace/`),
substring.Regexp(`(^|/)testdata/`), regex.MustCompile(`(^|/)testdata/`),
substring.Regexp(`.indent.pro`), regex.MustCompile(`.indent.pro`),
substring.Regexp(`(\.|-)min\.(js|css)$`), regex.MustCompile(`(\.|-)min\.(js|css)$`),
substring.Regexp(`([^\s]*)import\.(css|less|scss|styl)$`), regex.MustCompile(`([^\s]*)import\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)bootstrap([^.]*)\.(js|css|less|scss|styl)$`), regex.MustCompile(`(^|/)bootstrap([^.]*)\.(js|css|less|scss|styl)$`),
substring.Regexp(`(^|/)custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$`), regex.MustCompile(`(^|/)custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$`),
substring.Regexp(`(^|/)font-?awesome\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)font-?awesome\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)font-?awesome/.*\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)font-?awesome/.*\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)foundation\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)foundation\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)normalize\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)normalize\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)skeleton\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)skeleton\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)[Bb]ourbon/.*\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)[Bb]ourbon/.*\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)animate\.(css|less|scss|styl)$`), regex.MustCompile(`(^|/)animate\.(css|less|scss|styl)$`),
substring.Regexp(`(^|/)materialize\.(css|less|scss|styl|js)$`), regex.MustCompile(`(^|/)materialize\.(css|less|scss|styl|js)$`),
substring.Regexp(`(^|/)select2/.*\.(css|scss|js)$`), regex.MustCompile(`(^|/)select2/.*\.(css|scss|js)$`),
substring.Regexp(`(^|/)bulma\.(css|sass|scss)$`), regex.MustCompile(`(^|/)bulma\.(css|sass|scss)$`),
substring.Regexp(`(3rd|[Tt]hird)[-_]?[Pp]arty/`), regex.MustCompile(`(3rd|[Tt]hird)[-_]?[Pp]arty/`),
substring.Regexp(`vendors?/`), regex.MustCompile(`vendors?/`),
substring.Regexp(`extern(al)?/`), regex.MustCompile(`extern(al)?/`),
substring.Regexp(`(^|/)[Vv]+endor/`), regex.MustCompile(`(^|/)[Vv]+endor/`),
substring.Regexp(`^debian/`), regex.MustCompile(`^debian/`),
substring.Regexp(`run.n$`), regex.MustCompile(`run.n$`),
substring.Regexp(`bootstrap-datepicker/`), regex.MustCompile(`bootstrap-datepicker/`),
substring.Regexp(`(^|/)jquery([^.]*)\.js$`), regex.MustCompile(`(^|/)jquery([^.]*)\.js$`),
substring.Regexp(`(^|/)jquery\-\d\.\d+(\.\d+)?\.js$`), regex.MustCompile(`(^|/)jquery\-\d\.\d+(\.\d+)?\.js$`),
substring.Regexp(`(^|/)jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$`), regex.MustCompile(`(^|/)jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$`),
substring.Regexp(`(^|/)jquery\.(ui|effects)\.([^.]*)\.(js|css)$`), regex.MustCompile(`(^|/)jquery\.(ui|effects)\.([^.]*)\.(js|css)$`),
substring.Regexp(`jquery.fn.gantt.js`), regex.MustCompile(`jquery.fn.gantt.js`),
substring.Regexp(`jquery.fancybox.(js|css)`), regex.MustCompile(`jquery.fancybox.(js|css)`),
substring.Regexp(`fuelux.js`), regex.MustCompile(`fuelux.js`),
substring.Regexp(`(^|/)jquery\.fileupload(-\w+)?\.js$`), regex.MustCompile(`(^|/)jquery\.fileupload(-\w+)?\.js$`),
substring.Regexp(`jquery.dataTables.js`), regex.MustCompile(`jquery.dataTables.js`),
substring.Regexp(`bootbox.js`), regex.MustCompile(`bootbox.js`),
substring.Regexp(`pdf.worker.js`), regex.MustCompile(`pdf.worker.js`),
substring.Regexp(`(^|/)slick\.\w+.js$`), regex.MustCompile(`(^|/)slick\.\w+.js$`),
substring.Regexp(`(^|/)Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$`), regex.MustCompile(`(^|/)Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$`),
substring.Regexp(`leaflet.draw-src.js`), regex.MustCompile(`leaflet.draw-src.js`),
substring.Regexp(`leaflet.draw.css`), regex.MustCompile(`leaflet.draw.css`),
substring.Regexp(`Control.FullScreen.css`), regex.MustCompile(`Control.FullScreen.css`),
substring.Regexp(`Control.FullScreen.js`), regex.MustCompile(`Control.FullScreen.js`),
substring.Regexp(`leaflet.spin.js`), regex.MustCompile(`leaflet.spin.js`),
substring.Regexp(`wicket-leaflet.js`), regex.MustCompile(`wicket-leaflet.js`),
substring.Regexp(`.sublime-project`), regex.MustCompile(`.sublime-project`),
substring.Regexp(`.sublime-workspace`), regex.MustCompile(`.sublime-workspace`),
substring.Regexp(`.vscode`), regex.MustCompile(`.vscode`),
substring.Regexp(`(^|/)prototype(.*)\.js$`), regex.MustCompile(`(^|/)prototype(.*)\.js$`),
substring.Regexp(`(^|/)effects\.js$`), regex.MustCompile(`(^|/)effects\.js$`),
substring.Regexp(`(^|/)controls\.js$`), regex.MustCompile(`(^|/)controls\.js$`),
substring.Regexp(`(^|/)dragdrop\.js$`), regex.MustCompile(`(^|/)dragdrop\.js$`),
substring.Regexp(`(.*?)\.d\.ts$`), regex.MustCompile(`(.*?)\.d\.ts$`),
substring.Regexp(`(^|/)mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$`), regex.MustCompile(`(^|/)mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$`),
substring.Regexp(`(^|/)dojo\.js$`), regex.MustCompile(`(^|/)dojo\.js$`),
substring.Regexp(`(^|/)MochiKit\.js$`), regex.MustCompile(`(^|/)MochiKit\.js$`),
substring.Regexp(`(^|/)yahoo-([^.]*)\.js$`), regex.MustCompile(`(^|/)yahoo-([^.]*)\.js$`),
substring.Regexp(`(^|/)yui([^.]*)\.js$`), regex.MustCompile(`(^|/)yui([^.]*)\.js$`),
substring.Regexp(`(^|/)ckeditor\.js$`), regex.MustCompile(`(^|/)ckeditor\.js$`),
substring.Regexp(`(^|/)tiny_mce([^.]*)\.js$`), regex.MustCompile(`(^|/)tiny_mce([^.]*)\.js$`),
substring.Regexp(`(^|/)tiny_mce/(langs|plugins|themes|utils)`), regex.MustCompile(`(^|/)tiny_mce/(langs|plugins|themes|utils)`),
substring.Regexp(`(^|/)ace-builds/`), regex.MustCompile(`(^|/)ace-builds/`),
substring.Regexp(`(^|/)fontello(.*?)\.css$`), regex.MustCompile(`(^|/)fontello(.*?)\.css$`),
substring.Regexp(`(^|/)MathJax/`), regex.MustCompile(`(^|/)MathJax/`),
substring.Regexp(`(^|/)Chart\.js$`), regex.MustCompile(`(^|/)Chart\.js$`),
substring.Regexp(`(^|/)[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo)`), regex.MustCompile(`(^|/)[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo)`),
substring.Regexp(`(^|/)shBrush([^.]*)\.js$`), regex.MustCompile(`(^|/)shBrush([^.]*)\.js$`),
substring.Regexp(`(^|/)shCore\.js$`), regex.MustCompile(`(^|/)shCore\.js$`),
substring.Regexp(`(^|/)shLegacy\.js$`), regex.MustCompile(`(^|/)shLegacy\.js$`),
substring.Regexp(`(^|/)angular([^.]*)\.js$`), regex.MustCompile(`(^|/)angular([^.]*)\.js$`),
substring.Regexp(`(^|\/)d3(\.v\d+)?([^.]*)\.js$`), regex.MustCompile(`(^|\/)d3(\.v\d+)?([^.]*)\.js$`),
substring.Regexp(`(^|/)react(-[^.]*)?\.js$`), regex.MustCompile(`(^|/)react(-[^.]*)?\.js$`),
substring.Regexp(`(^|/)flow-typed/.*\.js$`), regex.MustCompile(`(^|/)flow-typed/.*\.js$`),
substring.Regexp(`(^|/)modernizr\-\d\.\d+(\.\d+)?\.js$`), regex.MustCompile(`(^|/)modernizr\-\d\.\d+(\.\d+)?\.js$`),
substring.Regexp(`(^|/)modernizr\.custom\.\d+\.js$`), regex.MustCompile(`(^|/)modernizr\.custom\.\d+\.js$`),
substring.Regexp(`(^|/)knockout-(\d+\.){3}(debug\.)?js$`), regex.MustCompile(`(^|/)knockout-(\d+\.){3}(debug\.)?js$`),
substring.Regexp(`(^|/)docs?/_?(build|themes?|templates?|static)/`), regex.MustCompile(`(^|/)docs?/_?(build|themes?|templates?|static)/`),
substring.Regexp(`(^|/)admin_media/`), regex.MustCompile(`(^|/)admin_media/`),
substring.Regexp(`(^|/)env/`), regex.MustCompile(`(^|/)env/`),
substring.Regexp(`^fabfile\.py$`), regex.MustCompile(`^fabfile\.py$`),
substring.Regexp(`^waf$`), regex.MustCompile(`^waf$`),
substring.Regexp(`^.osx$`), regex.MustCompile(`^.osx$`),
substring.Regexp(`\.xctemplate/`), regex.MustCompile(`\.xctemplate/`),
substring.Regexp(`\.imageset/`), regex.MustCompile(`\.imageset/`),
substring.Regexp(`(^|/)Carthage/`), regex.MustCompile(`(^|/)Carthage/`),
substring.Regexp(`(^|/)Sparkle/`), regex.MustCompile(`(^|/)Sparkle/`),
substring.Regexp(`Crashlytics.framework/`), regex.MustCompile(`Crashlytics.framework/`),
substring.Regexp(`Fabric.framework/`), regex.MustCompile(`Fabric.framework/`),
substring.Regexp(`BuddyBuildSDK.framework/`), regex.MustCompile(`BuddyBuildSDK.framework/`),
substring.Regexp(`Realm.framework`), regex.MustCompile(`Realm.framework`),
substring.Regexp(`RealmSwift.framework`), regex.MustCompile(`RealmSwift.framework`),
substring.Regexp(`gitattributes$`), regex.MustCompile(`gitattributes$`),
substring.Regexp(`gitignore$`), regex.MustCompile(`gitignore$`),
substring.Regexp(`gitmodules$`), regex.MustCompile(`gitmodules$`),
substring.Regexp(`(^|/)gradlew$`), regex.MustCompile(`(^|/)gradlew$`),
substring.Regexp(`(^|/)gradlew\.bat$`), regex.MustCompile(`(^|/)gradlew\.bat$`),
substring.Regexp(`(^|/)gradle/wrapper/`), regex.MustCompile(`(^|/)gradle/wrapper/`),
substring.Regexp(`(^|/)mvnw$`), regex.MustCompile(`(^|/)mvnw$`),
substring.Regexp(`(^|/)mvnw\.cmd$`), regex.MustCompile(`(^|/)mvnw\.cmd$`),
substring.Regexp(`(^|/)\.mvn/wrapper/`), regex.MustCompile(`(^|/)\.mvn/wrapper/`),
substring.Regexp(`-vsdoc\.js$`), regex.MustCompile(`-vsdoc\.js$`),
substring.Regexp(`\.intellisense\.js$`), regex.MustCompile(`\.intellisense\.js$`),
substring.Regexp(`(^|/)jquery([^.]*)\.validate(\.unobtrusive)?\.js$`), regex.MustCompile(`(^|/)jquery([^.]*)\.validate(\.unobtrusive)?\.js$`),
substring.Regexp(`(^|/)jquery([^.]*)\.unobtrusive\-ajax\.js$`), regex.MustCompile(`(^|/)jquery([^.]*)\.unobtrusive\-ajax\.js$`),
substring.Regexp(`(^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$`), regex.MustCompile(`(^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$`),
substring.Regexp(`^[Pp]ackages\/.+\.\d+\/`), regex.MustCompile(`^[Pp]ackages\/.+\.\d+\/`),
substring.Regexp(`(^|/)extjs/.*?\.js$`), regex.MustCompile(`(^|/)extjs/.*?\.js$`),
substring.Regexp(`(^|/)extjs/.*?\.xml$`), regex.MustCompile(`(^|/)extjs/.*?\.xml$`),
substring.Regexp(`(^|/)extjs/.*?\.txt$`), regex.MustCompile(`(^|/)extjs/.*?\.txt$`),
substring.Regexp(`(^|/)extjs/.*?\.html$`), regex.MustCompile(`(^|/)extjs/.*?\.html$`),
substring.Regexp(`(^|/)extjs/.*?\.properties$`), regex.MustCompile(`(^|/)extjs/.*?\.properties$`),
substring.Regexp(`(^|/)extjs/.sencha/`), regex.MustCompile(`(^|/)extjs/.sencha/`),
substring.Regexp(`(^|/)extjs/docs/`), regex.MustCompile(`(^|/)extjs/docs/`),
substring.Regexp(`(^|/)extjs/builds/`), regex.MustCompile(`(^|/)extjs/builds/`),
substring.Regexp(`(^|/)extjs/cmd/`), regex.MustCompile(`(^|/)extjs/cmd/`),
substring.Regexp(`(^|/)extjs/examples/`), regex.MustCompile(`(^|/)extjs/examples/`),
substring.Regexp(`(^|/)extjs/locale/`), regex.MustCompile(`(^|/)extjs/locale/`),
substring.Regexp(`(^|/)extjs/packages/`), regex.MustCompile(`(^|/)extjs/packages/`),
substring.Regexp(`(^|/)extjs/plugins/`), regex.MustCompile(`(^|/)extjs/plugins/`),
substring.Regexp(`(^|/)extjs/resources/`), regex.MustCompile(`(^|/)extjs/resources/`),
substring.Regexp(`(^|/)extjs/src/`), regex.MustCompile(`(^|/)extjs/src/`),
substring.Regexp(`(^|/)extjs/welcome/`), regex.MustCompile(`(^|/)extjs/welcome/`),
substring.Regexp(`(^|/)html5shiv\.js$`), regex.MustCompile(`(^|/)html5shiv\.js$`),
substring.Regexp(`^[Tt]ests?/fixtures/`), regex.MustCompile(`^[Tt]ests?/fixtures/`),
substring.Regexp(`^[Ss]pecs?/fixtures/`), regex.MustCompile(`^[Ss]pecs?/fixtures/`),
substring.Regexp(`(^|/)cordova([^.]*)\.js$`), regex.MustCompile(`(^|/)cordova([^.]*)\.js$`),
substring.Regexp(`(^|/)cordova\-\d\.\d(\.\d)?\.js$`), regex.MustCompile(`(^|/)cordova\-\d\.\d(\.\d)?\.js$`),
substring.Regexp(`foundation(\..*)?\.js$`), regex.MustCompile(`foundation(\..*)?\.js$`),
substring.Regexp(`^Vagrantfile$`), regex.MustCompile(`^Vagrantfile$`),
substring.Regexp(`.[Dd][Ss]_[Ss]tore$`), regex.MustCompile(`.[Dd][Ss]_[Ss]tore$`),
substring.Regexp(`^vignettes/`), regex.MustCompile(`^vignettes/`),
substring.Regexp(`^inst/extdata/`), regex.MustCompile(`^inst/extdata/`),
substring.Regexp(`octicons.css`), regex.MustCompile(`octicons.css`),
substring.Regexp(`sprockets-octicons.scss`), regex.MustCompile(`sprockets-octicons.scss`),
substring.Regexp(`(^|/)activator$`), regex.MustCompile(`(^|/)activator$`),
substring.Regexp(`(^|/)activator\.bat$`), regex.MustCompile(`(^|/)activator\.bat$`),
substring.Regexp(`proguard.pro`), regex.MustCompile(`proguard.pro`),
substring.Regexp(`proguard-rules.pro`), regex.MustCompile(`proguard-rules.pro`),
substring.Regexp(`^puphpet/`), regex.MustCompile(`^puphpet/`),
substring.Regexp(`(^|/)\.google_apis/`), regex.MustCompile(`(^|/)\.google_apis/`),
substring.Regexp(`^Jenkinsfile$`), regex.MustCompile(`^Jenkinsfile$`),
) }

View File

@ -6,6 +6,7 @@ import (
"strings" "strings"
"github.com/go-enry/go-enry/v2/data" "github.com/go-enry/go-enry/v2/data"
"github.com/go-enry/go-enry/v2/regex"
) )
const binSniffLen = 8000 const binSniffLen = 8000
@ -46,7 +47,7 @@ func GetMIMEType(path string, language string) string {
// IsDocumentation returns whether or not path is a documentation path. // IsDocumentation returns whether or not path is a documentation path.
func IsDocumentation(path string) bool { func IsDocumentation(path string) bool {
return data.DocumentationMatchers.Match(path) return matchRegexSlice(data.DocumentationMatchers, path)
} }
// IsDotFile returns whether or not path has dot as a prefix. // IsDotFile returns whether or not path has dot as a prefix.
@ -57,12 +58,12 @@ func IsDotFile(path string) bool {
// IsVendor returns whether or not path is a vendor path. // IsVendor returns whether or not path is a vendor path.
func IsVendor(path string) bool { func IsVendor(path string) bool {
return data.VendorMatchers.Match(path) return matchRegexSlice(data.VendorMatchers, path)
} }
// IsTest returns whether or not path is a test path. // IsTest returns whether or not path is a test path.
func IsTest(path string) bool { func IsTest(path string) bool {
return data.TestMatchers.Match(path) return matchRegexSlice(data.TestMatchers, path)
} }
// IsBinary detects if data is a binary value based on: // IsBinary detects if data is a binary value based on:
@ -91,3 +92,13 @@ func GetColor(language string) string {
return "#cccccc" return "#cccccc"
} }
func matchRegexSlice(exprs []regex.EnryRegexp, str string) bool {
for _, expr := range exprs {
if expr.MatchString(str) {
return true
}
}
return false
}