Alex Bezzubov
5e590f3554
code-gen: make content heuristics regexp engine configurable & generation syntax-aware
2022-12-25 22:37:52 +01:00
Alex
a8344728a7
Merge pull request #143 from go-enry/re-collation-at-codegen
...
Move venrod RE collation at codegen
2022-12-02 10:11:39 +01:00
Alex Bezzubov
375b301238
code-gen: reformat template for go 1.19
...
https://tip.golang.org/doc/go1.19#go-doc with introduction of
https://tip.golang.org/doc/comment has broken the code generator tests.
2022-12-02 09:55:50 +01:00
Alex Bezzubov
ede9e478fe
IsVendor: move RE collation to code generation phase
...
test plan:
* go test -run '^TestIsVendor$' github.com/go-enry/go-enry/v2
2022-12-01 22:16:44 +01:00
Luke Francl
02878b9c9f
Rename CodemirrorMode to CodeMirrorMode
...
It is a bit of a Rubyism to translate "CodeMirror Mode" into "codemirror_mode".
This is more in line with Go practices.
2021-10-12 16:18:33 -07:00
Luke Francl
b6b72c6c08
Add documentation to LanguageInfo struct fields
...
These are adapted from https://github.com/github/linguist/blob/master/lib/linguist/languages.yml
2021-10-12 16:13:59 -07:00
Luke Francl
6212f1fcb4
Remove name -> LanguageInfo mapping per code review
...
The GetLanguageInfo method is now implemented in terms of GetLanguageInfoByID.
This is possible because you can use GetLanguageID to get the ID for a language.
2021-10-12 13:29:39 -07:00
Luke Francl
6279d53f66
clean up whitespace in template
2021-10-11 14:20:25 -07:00
Luke Francl
b248b21349
Expose LanguageInfo with all Linguist data
...
As discussed in https://github.com/go-enry/go-enry/issues/54 , this provides an
API for accessing a LanguageInfo struct which is populated with all the data
from the Linguist YAML source file. Functions are provided to access the
LanguageInfo by name or ID.
The other top-level functions like GetLanguageExtensions, GetLanguageGroup, etc.
could in principle be implemented using this structure, which would simplify the
code generation. But that would be a big change so I didn't do any of that.
Perhaps in the next major version something like that would make sense.
2021-10-11 13:32:29 -07:00
Luke Francl
eb043e80a8
Add GetLanguageID function
...
The Linguist-defined language IDs are important to our use case because they are
used as database identifiers. This adds a new generator to extract the language
IDs into a map and uses that to implement GetLanguageID.
Because one language has the ID 0, there is no way to tell if a language name is
found or not. If desired, we could add this by returning (string, bool) from
GetLanguageID. But none of the other functions that take language names do this,
so I didn't want to introduce it here.
2021-04-13 11:49:21 -07:00
Máximo Cuadros
29bc0a181b
data: replace substring package with regex package
2020-04-15 17:27:48 +02:00
Lauris BH
97a26011a9
Return group color if language has none
2020-03-31 09:30:27 +03:00
Lauris BH
9030d3671b
sync to the latest github/linguist v7.9.0
2020-03-30 01:25:57 +03:00
Máximo Cuadros
84efad7693
*: module rename to go-enry/go-enry/v4
2020-03-19 17:31:29 +01:00
Alexander Bezzubov
bc5e031cee
Drop src-d org ref except for issues
...
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-19 14:04:36 +01:00
Lauris Bukšis-Haberkorns
25b29ebdc4
Implement getting color code for languages
...
Signed-off-by: Lauris Bukšis-Haberkorns <lauris@nix.lv>
2019-07-19 23:59:46 +03:00
Alexander Bezzubov
6a5f37e9e2
modules: prepare for v2 release
...
- update go.mod \w v2
- update all import paths
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-04-14 21:28:12 +02:00
Alexander Bezzubov
20c6d2845a
build: gopkg.in -> github.com imports
...
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-04-12 11:49:16 +02:00
Alexander
3499750785
Sync to linguist 7.2.0: heuristics.yml support ( #189 )
...
Sync \w Github Linguist v7.2.0
Includes new way of handling `heuristics.yml` and
all `./data/*` re-generated using Github Linguist [v7.2.0](https://github.com/github/linguist/releases/tag/v7.2.0 )
release tag.
- many new languages
- better vendoring detection
- update doc on update&known issues.
2019-02-14 12:47:45 +01:00
Denys Smirnov
7eafe024af
write a canonical header for machine-generated files
...
Signed-off-by: Denys Smirnov <denys@sourced.tech>
2018-04-30 12:57:39 +03:00
David Paz
ea819f58c2
Renamed mime to mimeType
2017-07-18 12:46:29 +02:00
David Paz
632422db69
Added pending untracked files
2017-07-18 12:46:29 +02:00
Manuel Carmona
2045abfa41
use of gopkg.in/toqueteos/substring.v1 in content.go to improve GetLanguagesByContent performance
2017-07-13 08:21:09 +02:00
David Paz
3f2248084e
Moved commit.go to data directory
2017-06-28 11:22:42 +02:00
David Paz
7e827e47ef
moved generated data to data subpackage
2017-06-28 08:31:11 +02:00
Manuel Carmona
b7d4be5fdd
commit against tests run is fixed
...
renamed tmpLinguist to repoLinguist and SimpleLinguistTestSuite to EnryTestSuit in common_test.go
changed receiver's name for TestSuites to 's'
fixed comments
2017-06-26 15:35:53 +02:00
Manuel Carmona
1fc8cf7a5d
changes to improve detection accuracy
2017-06-15 10:07:22 +02:00
Manuel Carmona
ba53e10c7b
renamed package and cli to enry
2017-06-13 14:18:23 +02:00
Máximo Cuadros
3a470f617c
project renamed to enry
2017-06-08 09:27:27 +02:00
Manuel Carmona
0d5dff1979
changes in the API, ready to version 2
2017-06-06 11:30:23 +02:00
Manuel Carmona
5b304524d1
Rearranged code
2017-06-02 09:33:55 +02:00
Manuel Carmona
fcf30a07c8
Added frequencies.go generation
2017-05-29 12:19:37 +02:00
Manuel Carmona
45314b4903
Added all the necessary to do GetLanguageByAlias functionality works
2017-05-08 11:34:00 +02:00
Manuel Carmona
6f3ad6d30d
separated GetLanguageType and languagesType map in different files due to a better generation files
2017-05-03 12:17:54 +02:00
Manuel Carmona
cbf44205e0
fixed GetLanguageType to return Unknown when language is not found in languagesType map
2017-05-03 10:48:28 +02:00
Manuel Carmona
664afe48d4
fixed GetLanguageByContent returned value when there is not a function matcher for the extension
2017-05-03 10:37:34 +02:00
Manuel Carmona
f63a25d794
all related to extension strategy renamed to reference it
2017-04-27 17:32:42 +02:00
Manuel Carmona
645bdd7331
added filenames_map.go generation
...
languagesByFilename now is a map[string]string
2017-04-27 17:30:57 +02:00
Manuel Carmona
f45efec5fb
GetLanguageType and Type constants have comments now
...
type.go comments generated from type.go.tmpl
2017-04-27 16:40:28 +02:00
Manuel Carmona
c6d74bca66
added shebang functionality
...
fixed autogenerated comment
changed constant types names
GetLanguageByShebang doesn't print errors
languageInfo struct change to have only necessary fields
GetLanguageByShebang has a comment now
2017-04-27 16:40:08 +02:00
Manuel Carmona
2644a7c8da
added interpreters_map.go generation
...
fixed Interpreters comment
2017-04-27 16:39:54 +02:00
Manuel Carmona
c08b85120d
created 'type Type int' for type.go generation
2017-04-17 12:08:54 +02:00
Manuel Carmona
b277944b2a
fixed constant iotas
2017-04-17 12:00:50 +02:00
Manuel Carmona
ef39403555
added type.go generation
2017-04-17 11:55:29 +02:00
Manuel Carmona
ca3ae587f3
added documentation_matchers.go generation
2017-04-17 11:52:11 +02:00
Manuel Carmona
e998b0ff2e
regexp for vendored files and directories are generated in vendor_matchers.go
2017-04-07 09:27:40 +02:00
Manuel Carmona
13e7886a02
Added utils.go generation
2017-04-06 17:31:17 +02:00
Manuel Carmona
03c71a9b93
move content.go generation to internal
2017-04-05 18:15:27 +02:00
Manuel Carmona
665b7475e3
code generation move to internal/code-generator
2017-04-05 17:49:58 +02:00