Commit Graph

603 Commits

Author SHA1 Message Date
Alexander Bezzubov
172486906a
ci: force git to use LF on win to pass tests on linguist samples
This mitigates the problem that tokenizer uses regex
that matches platform-specific line endings

TestPlan:
 - go test ./internal/code-generator/generator \
	-run Test_GeneratorTestSuite -testify.m TestTokenizerOnATS

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-29 23:23:56 +02:00
Alexander Bezzubov
3ea961e5ab
generator: change-detector tests on EOL-dependant sample
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-29 23:23:56 +02:00
Alexander Bezzubov
9be0211f04
generator: skip symlinks on *nix and win
As Git on win does not support symlinks [1], we have to hard-code
the paths to fils under ./samples/ in Linguist codebase that are
known to be a symlink.

 1. https://github.com/git-for-windows/git/wiki/Symbolic-Links

TestPlan:
 - go test ./internal/code-generator/generator -run Test_GeneratorTestSuite

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-29 23:23:56 +02:00
Alexander Bezzubov
9c082eb2d4
ci: add ENRY_DEBUG flag
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-29 19:35:49 +02:00
Alexander Bezzubov
78eee0cf7e
generator: flag to debug building of bayesian classifier
It seems that reading ./samples/ from Linguist consumes
a different number of files from filesystem on different OSes.

This change adds ENRY_DEBUG env var to print some debug output
about calculations of token stats from  samples.

TestPlan:
 - ENRY_DEBUG=1 go test -v ./internal/code-generator/generator \
	-run Test_GeneratorTestSuite -testify.m TestGenerationFiles

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-29 19:35:49 +02:00
Alexander
b78e4423f0
generator: drop platform-specific separator
Co-Authored-By: Lauris BH <lauris@nix.lv>
2020-03-25 19:27:46 +01:00
Alexander Bezzubov
3a5f4b2db1
generator: mode debug output in case of failure
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-25 14:20:26 +01:00
Alexander Bezzubov
b0f94ad693
generator: CLI tool fix to support win paths
On Win `make code-generate` produces unreasonable
Bayesian classifier weights from Linguist samples
silently, failing only the final classification tests.

TestPlan:
 - go test ./internal/code-generator/... \
    -run Test_GeneratorTestSuite -testify.m TestGenerationFiles

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-25 14:00:24 +01:00
Alexander Bezzubov
78d8f43a88
tokenizer: hide flex-based impl, avoid build failures on win
TestPlan:
 - go test -run TestTokenize ./internal/tokenizer
 - go test -tags flex -run TestTokenize ./internal/tokenizer
   (shold fail as default fixtures are from regex-based tokenizer)
2020-03-19 19:58:48 +01:00
Alexander Bezzubov
1ab8148c10
test: fix platform-depenent paths in tests
Test Plan:
 - go test ./internal/code-generator/... -run Test_GeneratorTestSuite -testify.m TestGenerationFiles
2020-03-19 19:47:22 +01:00
Alexander Bezzubov
e32a70a784
tokenizer: fix a bug and regenerate the code \w latest Go
See https://github.com/bzz/enry/pull/4 for details.

Test Plan:
 - go test ./...
2020-03-19 19:08:21 +01:00
Máximo Cuadros
e08125d7ee
ci: add oniguruma tests 2020-03-19 17:43:40 +01:00
Máximo Cuadros
98cd5cf5e8
ci: based on github actions 2020-03-19 17:38:22 +01: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
Alexander
697929e149
Merge pull request #248 from bzz/go-api-surface
go: reduce API surface
2019-10-29 19:13:48 +01:00
Alexander
4d5ca8b9a6
Merge pull request #247 from bzz/doc-update
doc: cleanup and simplify
2019-10-29 18:27:02 +01:00
Alexander Bezzubov
aa40f75657
go doc: minor improvements and clarifications
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-29 18:26:19 +01:00
Alexander Bezzubov
fa097f4ed4
go: remove Classifier from API
Even more reduces public API surface by
hiding un-used Classifier API for providing
a pre-trained classifier weights.

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-29 18:20:33 +01:00
Alexander Bezzubov
3f0c4e182b
go: reduce API surface
Don't export defaultClassifier

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-29 18:14:43 +01:00
Alexander Bezzubov
c7272bd4f1
address review feedback
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-29 18:11:35 +01:00
Alexander Bezzubov
324cb1d7c9
doc: cleanup and simplify
Make it shorter and more structured, update ToC
remove ref from links, etc

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-29 15:49:16 +01:00
Alexander
a4c166cc04
Merge pull request #245 from bzz/initial-cffi-python-bindings
Initial cffi bindings for python
2019-10-28 14:07:29 +01:00
Alexander
31878fe4e1
Merge pull request #242 from creachadair/maint
Update MAINTAINERS, add CODEOWNERS.
2019-10-14 19:55:55 +02:00
Alexander Bezzubov
6cf5bf2ca4
python: expose is_vendor()
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-14 19:38:33 +02:00
Alexander Bezzubov
be583cad06
python: add dependencies
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-14 19:38:33 +02:00
Alexander Bezzubov
cff9c07009
python: expose language_by_filename()
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-14 19:38:33 +02:00
Alexander Bezzubov
ee7a0f1139
python: initial impl of bindings using cFFI
A PoC that exposes single function
`enry.language_by_extension()` and a small
number of helpers to deal with string
coversion between Go<->C<->Python.

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-14 19:38:33 +02:00
M. J. Fromberger
6a6a3cc26e
Merge pull request #244 from creachadair/installdoc
docs: Update CLI installation instructions.
2019-10-07 09:44:23 -07:00
M. J. Fromberger
bf29b9a924 Use conditional composition instead of sequential.
Signed-off-by: M. J. Fromberger <michael.j.fromberger@gmail.com>
2019-10-07 09:39:07 -07:00
M. J. Fromberger
7763fcde19 docs: Update CLI installation instructions.
Fixes #243. The default behaviour for `go get` has changed slightly and we now
need to either provide a module context or disable modules for installation to
work correctly.

Also remove a now-obsolete reference to the source{d} engine CLI.

Signed-off-by: M. J. Fromberger <michael.j.fromberger@gmail.com>
2019-10-07 08:34:50 -07:00
M. J. Fromberger
23327afe9c Update MAINTAINERS, add CODEOWNERS.
Part of bblfsh/bblfshd#307.

Signed-off-by: M. J. Fromberger <michael.j.fromberger@gmail.com>
2019-09-13 11:49:03 -07:00
M. J. Fromberger
fd3c31c313
Merge pull request #240 from creachadair/whats-up-doc
Addresses #239. The `go get` command fetches the command-line tool, and does not match the import path for the library. To make things more clear:

1. Mention explicitly that `go get` fetches the CLI. Also, to avoid potential
   issues with pre-modules Go versions, do the fetch in /tmp.

2. Include an import path explicitly in the source examples.

3. Mention explicitly how to import enry into a modules build.
2019-08-08 11:14:44 -07:00
M. J. Fromberger
e9af1d7187 Improve download and usage examples in README.md.
Addresses #239. The `go get` command fetches the command-line tool, and does
not match the import path for the library. To make things more clear:

1. Mention explicitly that `go get` fetches the CLI. Also, to avoid potential
   issues with pre-modules Go versions, do the fetch in /tmp.

2. Include an import path explicitly in the source examples.

3. Mention explicitly how to import enry into a modules build.

Signed-off-by: M. J. Fromberger <michael.j.fromberger@gmail.com>
2019-08-07 12:04:41 -07:00
Alexander
3c3ea9a95e
Merge pull request #238 from bzz/hotfix-docs
Hotfix: typo in docs
2019-08-07 18:07:56 +02:00
Alexander Bezzubov
9bd22dae54
doc: fix typo in MD link
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-08-06 17:22:11 +02:00
Alexander
f608f8d773
Merge pull request #234 from lafriks/feat/update_linguist
Sync to linguist v7.5.1
2019-08-06 17:16:57 +02:00
Lauris Bukšis-Haberkorns
4e3e15e80d
Sync to linguist v7.5.1
Signed-off-by: Lauris BH <lauris@nix.lv>
2019-08-06 17:18:01 +03:00
Alexander
21b48ffc4a
Merge pull request #235 from bzz/doc-update
doc: some long-deserved love to the documentation
2019-08-06 12:00:31 +02:00
Alexander
5ce5a65ddf
Merge pull request #237 from lafriks/feat/osascript_lang
Improve shebang detection for osascript when language is specified with -l argument
2019-08-06 11:59:10 +02:00
Alexander Bezzubov
e1fbfaea60
doc: code review feedback
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-08-06 11:57:34 +02:00
Alexander
1723ec0c10
Merge pull request #236 from lafriks/feat/ignore_regex
Improve detection of unsupported regexp syntax
2019-08-05 21:35:47 +02:00
Lauris Bukšis-Haberkorns
a4cf6d2ef1
If osascript is called with argument -l it could be different language so do not relay on it
Signed-off-by: Lauris Bukšis-Haberkorns <lauris@nix.lv>
2019-08-05 22:28:51 +03:00
Lauris Bukšis-Haberkorns
2f5526ddba
Improve detection of unsupported regexp syntax
Signed-off-by: Lauris Bukšis-Haberkorns <lauris@nix.lv>
2019-08-05 22:24:03 +03:00
Alexander Bezzubov
85641846f8
doc: add documentation some ❤️
- add ToC
 - hide less relevant section under th #misc
 - update examples
 - clarify linguist sync practice

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-08-05 12:42:16 +02:00
Alexander
ee9d089406
Merge pull request #233 from lafriks/feat/lang_colors
Implement getting HTML color code for languages
2019-07-29 17:32:55 +02:00
Alexander
643f82c24c
Merge pull request #232 from bzz/fix-import-modules
Fix: import comment pointing to the latest module version
2019-07-29 17:32:39 +02: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
0b4d32dfe2
fix: custom import path comment points to latest module
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-07-08 09:16:59 +02:00
Alexander
6ccf0b6bd1
Merge pull request #227 from bzz/ci-fix-cgo-tests
CI: fix cgo profiles
2019-05-08 22:25:49 +02:00