Skip to content

Commit 2f6c92a

Browse files
committed
refactor
1 parent 7e67db5 commit 2f6c92a

10 files changed

Lines changed: 651 additions & 1411 deletions

internal/validate/vsa/file_retriever.go

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,12 @@ package vsa
1818

1919
import (
2020
"context"
21-
"encoding/json"
2221
"fmt"
2322

2423
"github.com/spf13/afero"
2524
)
2625

27-
// FileVSARetriever implements VSARetriever for file-based VSA records
28-
type FileVSARetriever struct {
29-
fs afero.Fs
30-
}
31-
32-
// NewFileVSARetriever creates a new file-based VSA retriever
33-
func NewFileVSARetriever(fs afero.Fs) *FileVSARetriever {
34-
return &FileVSARetriever{fs: fs}
35-
}
36-
37-
// RetrieveVSA reads VSA records from a file
38-
func (f *FileVSARetriever) RetrieveVSA(ctx context.Context, vsaPath string) ([]VSARecord, error) {
39-
data, err := afero.ReadFile(f.fs, vsaPath)
40-
if err != nil {
41-
return nil, fmt.Errorf("failed to read VSA file: %w", err)
42-
}
43-
44-
var records []VSARecord
45-
if err := json.Unmarshal(data, &records); err != nil {
46-
return nil, fmt.Errorf("failed to parse VSA file: %w", err)
47-
}
48-
49-
return records, nil
50-
}
26+
// FileVSARetriever removed - no longer used by current implementation
5127

5228
// FileVSADataRetriever implements VSADataRetriever for file-based VSA files
5329
type FileVSADataRetriever struct {
@@ -65,6 +41,11 @@ func NewFileVSADataRetriever(fs afero.Fs, vsaPath string) *FileVSADataRetriever
6541

6642
// RetrieveVSAData reads and returns VSA data as a string
6743
func (f *FileVSADataRetriever) RetrieveVSAData(ctx context.Context) (string, error) {
44+
// Validate file path
45+
if f.vsaPath == "" {
46+
return "", fmt.Errorf("failed to read VSA file: file path is empty")
47+
}
48+
6849
// Read VSA file
6950
data, err := afero.ReadFile(f.fs, f.vsaPath)
7051
if err != nil {

internal/validate/vsa/file_retriever_test.go

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)