Commit Graph

663 Commits

Author SHA1 Message Date
Alex Bezzubov
f206e152e6 test: refactor and simplify TestLinguistSamples
test plan
 - go test -run '^Test_EnryOnLinguistCorpus$' github.com/go-enry/go-enry/v2
2023-03-03 23:14:06 +01:00
github-actions
afe3bdf45a Updated Linguist to v7.23.0 2023-03-03 14:07:28 +01:00
Alex
0e58945703
Merge pull request #151 from go-enry/distinguish-re-syntax
Syntax-aware regexp generation for configurable engines
2023-03-03 13:57:49 +01:00
Alex Bezzubov
8246efecce heuristics regexp engine configurable #3, adapt IsVendor optimization & tests
Regex collation optimization for IsVendor now fails gracefully.
Tests that are affected by non-RE2 syntax are explicitly marked.
2023-02-16 17:55:57 +01:00
Alex Bezzubov
8df9e1ecf2 code-gen: improve ability to debug failures
Code generation failres were hard to identify and undertand

 * avoid unnececary re-formating & memory allocation
 * return clear formatting errors
2023-02-16 17:47:44 +01:00
Alex Bezzubov
6d99af7bbc doc: reformat & clarify 2023-02-16 17:46:23 +01:00
Alex Bezzubov
319e630aaf code-gen: syntax-aware generation of vendor regex 2023-01-19 19:50:22 +01:00
Alex Bezzubov
3aeb9879da heuristics regexp engine configurable #2, skip rules at runtime 2023-01-19 19:50:22 +01:00
Alex Bezzubov
d8913b00e9 code-gen: re-generate code & fixtures 2022-12-25 22:37:52 +01:00
Alex Bezzubov
5e590f3554 code-gen: make content heuristics regexp engine configurable & generation syntax-aware 2022-12-25 22:37:52 +01:00
Alex Bezzubov
0b92f97b9c code-gen: refactoring, re-use function map in templates 2022-12-25 22:37:52 +01:00
Alex Bezzubov
454c78a59f test: bump testify version for better err msg on panic 2022-12-25 22:37:52 +01:00
Alex
ef6c17997c
Merge pull request #152 from go-enry/fix-oniguruma-ci
Fix oniguruma profile on CI
2022-12-25 22:36:42 +01:00
Alex Bezzubov
a139863ceb ci: fix oniguruma profile 2022-12-25 22:33:02 +01:00
Alex
a9296f134c
Merge pull request #149 from go-enry/improve-gen-tests
Generator tests: add readable text diff output
2022-12-18 19:32:15 +01:00
Alex Bezzubov
c0176b04e7 gen-test: don't expose diff + attributions 2022-12-12 20:48:35 +01:00
Alex Bezzubov
c79c32f525 gen-test: add readable text diff output
test plan:
 * go test -run '^Test_GeneratorTestSuite$' \
	-testify.m '^(TestGenerationFiles)$' \
	github.com/go-enry/go-enry/v2/internal/code-generator/generator
2022-12-03 18:55:48 +01:00
Alex
669ec497ef
Merge pull request #134 from jsoref/spelling
Spelling
2022-12-03 18:48:31 +01:00
Alex
2059129b5e
Merge branch 'master' into spelling 2022-12-03 10:48:23 +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
e46c9e749e
Merge pull request #148 from go-enry/upd-ci-go
ci: bump Go versions to two latest ones
2022-12-02 10:11:06 +01:00
Alex Bezzubov
2c708f0b6c gen: re-generate aliases & test fixture for go 1.19 2022-12-02 09:55:50 +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
476e74d827 ci: bump Go versions to two latest ones
test plan: CI is green
2022-12-01 22:33:00 +01:00
Alex Bezzubov
f4051b0f16 gen: re-generated vendors using build-time optimization 2022-12-01 22:16:54 +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
Alex
fcb9ea7e45
Merge pull request #146 from go-enry/more-api-tests
test: cover GetLanguageByContent confusing edge cases
2022-12-01 22:15:53 +01:00
Alex Bezzubov
86cae02425 test: cover GetLanguageByContent confusing edge cases
And clarify documentation wording, based on discussion
at https://github.com/go-enry/go-enry/issues/145

test plan:
 * go test -run '^Test_EnryTestSuite$' -testify.m '^(TestGetLanguageByContent)$' ./...
2022-12-01 22:10:01 +01:00
Alex
a243a1fde8
Merge pull request #144 from go-enry/refactoring-tests
Refactoring tests
2022-12-01 22:06:00 +01:00
Alex Bezzubov
6be1ebe9d6 test: fail fast on suite setup/teardown 2022-12-01 22:00:58 +01:00
Alex Bezzubov
43475949cc test: limit linguist repo history size 2022-12-01 22:00:58 +01:00
Alex Bezzubov
a93364ec79 refactoring: add separate test suite for linguist samples/fixtures 2022-12-01 22:00:58 +01:00
Alex Bezzubov
bb7a81ede4 refactoring: unify, extract&reuse maybeCloneLinguist() 2022-12-01 22:00:58 +01:00
Alex Bezzubov
a3304aa121 refactoring: move public constant/types to enry.go
Also re-arrange public API functions to have the same order
as they are in tests.
2022-12-01 22:00:58 +01:00
Alex
a1d6d88745
Merge pull request #147 from go-enry/fix-ci-python
ci: fix Python profile after ubuntu-latest 20.04->22.04 update
2022-12-01 22:00:15 +01:00
Alex Bezzubov
fd9e1c3b63 ci: fix Python profile after ubuntu-latest 20.04->22.04 update
Github has changed the ubuntu-latest runner and it does not ship
Python 3.6 any more ¯\_(ツ)_/¯

See https://github.com/actions/setup-python/issues/544#issuecomment-1320295576

test plan:
 * CI profile for python is green
2022-11-29 22:58:56 +01:00
Alex
fdf062436b
Merge pull request #142 from go-enry/refactor-vendor-regexp-optimization
IsVendor: refactor RE collation optimization
2022-10-27 11:27:55 +02:00
Alex
7388633b02
Merge pull request #141 from go-enry/improve-test-and-codegen
Small improvements in test and code generation
2022-10-27 11:27:38 +02:00
Alex
6e3306a9f7
Merge pull request #140 from go-enry/improve-docs
Improve documentation
2022-10-27 11:27:29 +02:00
Alex Bezzubov
95f30f0db4 IsVendor: refactor RE collation optimization
The same optimization still happens during package initialization
at runtime, but an effort was made to make it more transparent and
self-documented.

Both the test & the benchmark were updated.

Old version (usefull for benchmark) was

```go
func IsVendor(filename string) bool {
	for _, matcher := range data.VendorMatchers {
		if matcher.MatchString(filename) {
			return true
		}
	}
	return false
}
```

Test plan:
 * go test -run ^TestIsVendor$ github.com/go-enry/go-enry/v2
2022-10-23 15:19:53 +02:00
Alex Bezzubov
5683b2e7f8 test: refactored to clarify Linguist cloning logic on codegen 2022-10-23 11:07:50 +02:00
Alex Bezzubov
3feb720575 code-gen: fail fast
Stop the code generation process early if any of its
generators fail rather than skipping it with the log message.
2022-10-23 10:56:01 +02:00
Alex Bezzubov
e4cc955976 doc: improve wording in dev section w.r.t env vars 2022-10-23 10:47:17 +02:00
Alex Bezzubov
b33717cc4f doc: mention linguist sync automation 2022-10-23 10:42:10 +02:00
Josh Soref
fb3939de28 spelling: without
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-10-06 13:25:49 -04:00
Josh Soref
bc13e29685 spelling: unnecessary
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-10-06 13:25:49 -04:00
Josh Soref
53b48a4669 spelling: through
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-10-06 13:25:49 -04:00
Josh Soref
bc7767728d spelling: syntax
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-10-06 13:25:49 -04:00
Josh Soref
500fa07895 spelling: structure
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-10-06 13:25:49 -04:00
Josh Soref
d4d3d66352 spelling: skipping
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-10-06 13:25:49 -04:00