Debian Codegraph @

licensedb/dataset_test.go

raw symbols SCIP
1 package licensedbscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb`/
2
3 import (
4 "fmtscip-go gomod github.com/golang/go/src go1.18 fmt/"
5 "osscip-go gomod github.com/golang/go/src go1.18 os/"
6 "syncscip-go gomod github.com/golang/go/src go1.18 sync/"
7 "testingscip-go gomod github.com/golang/go/src go1.18 testing/"
8
9 "github.com/go-enry/go-license-detector/v4/licensedb/apiscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/api`/"
10 "github.com/go-enry/go-license-detector/v4/licensedb/filerscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/"
11
12 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.8.0 `github.com/stretchr/testify/assert`/"
13 )
14
15 func TestDatasetscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb`/TestDataset().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) {
16 rootFiler, err := filerscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/.FromZIPscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/FromZIP().("dataset.zip")
17 assertscip-go gomod github.com/stretchr/testify v1.8.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.8.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
18 defer rootFiler.Closescip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/Filer#Close.()
19 projects, err := rootFiler.ReadDirscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/Filer#ReadDir.("")
20 assertscip-go gomod github.com/stretchr/testify v1.8.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.8.0 `github.com/stretchr/testify/assert`/Nil().(t, err)
21 licenses := map[string]map[string]apiscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/api`/.Matchscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/api`/Match#{}
22 mutex := syncscip-go gomod github.com/golang/go/src go1.18 sync/.Mutexscip-go gomod github.com/golang/go/src go1.18 sync/Mutex#{}
23 wg := syncscip-go gomod github.com/golang/go/src go1.18 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.18 sync/WaitGroup#{}
24 wg.Addscip-go gomod github.com/golang/go/src go1.18 sync/WaitGroup#Add().(len(projects))
25 for _, project := range projects {
26 go func(project filerscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/.Filescip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/File#) {
27 defer wg.Donescip-go gomod github.com/golang/go/src go1.18 sync/WaitGroup#Done().()
28 myLicenses, _ := Detectscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb`/Detect().(filerscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/.NestFilerscip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/NestFiler().(rootFiler, project.Namescip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/File#Name.))
29 if len(myLicenses) > 0 {
30 mutex.Lockscip-go gomod github.com/golang/go/src go1.18 sync/Mutex#Lock().()
31 licenses[project.Namescip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/File#Name.] = myLicenses
32 mutex.Unlockscip-go gomod github.com/golang/go/src go1.18 sync/Mutex#Unlock().()
33 }
34 }(project)
35 }
36 wg.Waitscip-go gomod github.com/golang/go/src go1.18 sync/WaitGroup#Wait().()
37 assertscip-go gomod github.com/stretchr/testify v1.8.0 `github.com/stretchr/testify/assert`/.Truescip-go gomod github.com/stretchr/testify v1.8.0 `github.com/stretchr/testify/assert`/True().(t, len(licenses) >= 893)
38 // the rest len(projects) - 902 do not contain any license information
39 fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().("%d %d %d%%\n", len(licenses), 902, (100*len(licenses))/902)
40 if osscip-go gomod github.com/golang/go/src go1.18 os/.Getenvscip-go gomod github.com/golang/go/src go1.18 os/Getenv().("LICENSE_TEST_DEBUG") != "" {
41 for _, project := range projects {
42 if _, exists := licenses[project.Namescip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/File#Name.]; !exists {
43 println(project.Namescip-go gomod github.com/go-enry/go-license-detector/v4 . `github.com/go-enry/go-license-detector/v4/licensedb/filer`/File#Name.)
44 }
45 }
46 }
47 }