Skip to content

Commit

Permalink
migrate common processor code to internal
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
  • Loading branch information
wagoodman committed Nov 21, 2024
1 parent 109081c commit c105cc0
Show file tree
Hide file tree
Showing 45 changed files with 72 additions and 72 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion pkg/process/processors/github_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/anchore/grype-db/pkg/data"
testUtils "github.com/anchore/grype-db/pkg/process/tests"
testUtils "github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/processors/match_exclusion_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/anchore/grype-db/pkg/data"
testUtils "github.com/anchore/grype-db/pkg/process/tests"
testUtils "github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/processors/msrc_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/anchore/grype-db/pkg/data"
testUtils "github.com/anchore/grype-db/pkg/process/tests"
testUtils "github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/processors/nvd_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/anchore/grype-db/pkg/data"
testUtils "github.com/anchore/grype-db/pkg/process/tests"
testUtils "github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/processors/os_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/anchore/grype-db/pkg/data"
testUtils "github.com/anchore/grype-db/pkg/process/tests"
testUtils "github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v1/transformers/github/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package github

import (
"github.com/anchore/grype-db/pkg/data"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/process/v1/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v1/transformers/github/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
testUtils "github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v1/transformers/nvd/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
testUtils "github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v1/transformers/nvd/unique_pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/umisama/go-cpe"

"github.com/anchore/grype-db/internal/log"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/provider/unmarshal/nvd"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v1/transformers/os/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"

"github.com/anchore/grype-db/pkg/data"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/process/v1/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v1/transformers/os/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
testUtils "github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v1"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v2/transformers/github/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package github

import (
"github.com/anchore/grype-db/pkg/data"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/process/v2/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v2"
Expand Down
8 changes: 4 additions & 4 deletions pkg/process/v2/transformers/github/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
"github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v2"
)
Expand Down Expand Up @@ -69,7 +69,7 @@ func TestParseGitHubEntry(t *testing.T) {

f, err := os.Open("test-fixtures/github-github-python-1.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.GitHubAdvisoryEntries(f)
assert.NoError(t, err)
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestDefaultVersionFormatNpmGitHubEntry(t *testing.T) {

f, err := os.Open("test-fixtures/github-github-npm-0.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.GitHubAdvisoryEntries(f)
assert.NoError(t, err)
Expand Down Expand Up @@ -155,7 +155,7 @@ func TestDefaultVersionFormatNpmGitHubEntry(t *testing.T) {
func TestFilterWithdrawnEntries(t *testing.T) {
f, err := os.Open("test-fixtures/github-withdrawn.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.GitHubAdvisoryEntries(f)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/process/v2/transformers/nvd/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
"github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v2"
)

func TestUnmarshalVulnerabilitiesEntries(t *testing.T) {
f, err := os.Open("test-fixtures/unmarshal-test.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.NvdVulnerabilityEntries(f)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v2/transformers/nvd/unique_pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/umisama/go-cpe"

"github.com/anchore/grype-db/internal/log"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/provider/unmarshal/nvd"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v2/transformers/os/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"

"github.com/anchore/grype-db/pkg/data"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/process/v2/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v2"
Expand Down
4 changes: 2 additions & 2 deletions pkg/process/v2/transformers/os/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
"github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v2"
)

func TestUnmarshalVulnerabilitiesEntries(t *testing.T) {
f, err := os.Open("test-fixtures/unmarshal-test.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.OSVulnerabilityEntries(f)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v3/transformers/github/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package github

import (
"github.com/anchore/grype-db/pkg/data"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/process/v3/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v3"
Expand Down
10 changes: 5 additions & 5 deletions pkg/process/v3/transformers/github/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
"github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v3"
)

func TestUnmarshalGitHubEntries(t *testing.T) {
f, err := os.Open("test-fixtures/github-github-python-0.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.GitHubAdvisoryEntries(f)
require.NoError(t, err)
Expand Down Expand Up @@ -92,7 +92,7 @@ func TestParseGitHubEntry(t *testing.T) {

f, err := os.Open("test-fixtures/github-github-python-1.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.GitHubAdvisoryEntries(f)
require.NoError(t, err)
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestDefaultVersionFormatNpmGitHubEntry(t *testing.T) {

f, err := os.Open("test-fixtures/github-github-npm-0.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.GitHubAdvisoryEntries(f)
require.NoError(t, err)
Expand Down Expand Up @@ -184,7 +184,7 @@ func TestDefaultVersionFormatNpmGitHubEntry(t *testing.T) {
func TestFilterWithdrawnEntries(t *testing.T) {
f, err := os.Open("test-fixtures/github-withdrawn.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.GitHubAdvisoryEntries(f)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v3/transformers/msrc/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"

"github.com/anchore/grype-db/pkg/data"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/process/v3/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v3"
Expand Down
6 changes: 3 additions & 3 deletions pkg/process/v3/transformers/msrc/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
"github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v3"
)

func TestUnmarshalMsrcVulnerabilities(t *testing.T) {
f, err := os.Open("test-fixtures/microsoft-msrc-0.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.MSRCVulnerabilityEntries(f)
require.NoError(t, err)
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestParseMSRCEntry(t *testing.T) {

f, err := os.Open("test-fixtures/microsoft-msrc-0.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.MSRCVulnerabilityEntries(f)
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions pkg/process/v3/transformers/nvd/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
"github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v3"
)

func TestUnmarshalNVDVulnerabilitiesEntries(t *testing.T) {
f, err := os.Open("test-fixtures/unmarshal-test.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.NvdVulnerabilityEntries(f)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v3/transformers/nvd/unique_pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/umisama/go-cpe"

"github.com/anchore/grype-db/internal/log"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/provider/unmarshal/nvd"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v3/transformers/os/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"

"github.com/anchore/grype-db/pkg/data"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/process/v3/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v3"
Expand Down
8 changes: 4 additions & 4 deletions pkg/process/v3/transformers/os/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

testUtils "github.com/anchore/grype-db/pkg/process/tests"
"github.com/anchore/grype-db/pkg/process/internal/tests"
"github.com/anchore/grype-db/pkg/process/v3/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v3"
Expand All @@ -17,7 +17,7 @@ import (
func TestUnmarshalOSVulnerabilitiesEntries(t *testing.T) {
f, err := os.Open("test-fixtures/unmarshal-test.json")
require.NoError(t, err)
defer testUtils.CloseFile(f)
defer tests.CloseFile(f)

entries, err := unmarshal.OSVulnerabilityEntries(f)
require.NoError(t, err)
Expand All @@ -27,7 +27,7 @@ func TestUnmarshalOSVulnerabilitiesEntries(t *testing.T) {
}

func TestParseVulnerabilitiesEntry(t *testing.T) {
tests := []struct {
tc := []struct {
name string
numEntries int
fixture string
Expand Down Expand Up @@ -493,7 +493,7 @@ func TestParseVulnerabilitiesEntry(t *testing.T) {
},
}

for _, test := range tests {
for _, test := range tc {
t.Run(test.name, func(t *testing.T) {
f, err := os.Open(test.fixture)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/process/v4/transformers/github/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"

"github.com/anchore/grype-db/pkg/data"
"github.com/anchore/grype-db/pkg/process/common"
"github.com/anchore/grype-db/pkg/process/internal/common"
"github.com/anchore/grype-db/pkg/process/v4/transformers"
"github.com/anchore/grype-db/pkg/provider/unmarshal"
grypeDB "github.com/anchore/grype/grype/db/v4"
Expand Down
Loading

0 comments on commit c105cc0

Please sign in to comment.