Skip to content

Commit

Permalink
refactor: fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
Chao-Ma5566 committed Apr 26, 2024
1 parent 307621d commit c187edb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cmd/sigo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func run(definition pdef, logs logs) {
}

sink := infra.NewJSONLineSink(os.Stdout)

var debugger sigo.Debugger

if logs.info != "" {
Expand All @@ -156,7 +156,6 @@ func run(definition pdef, logs logs) {
}

var cpuProfiler interface{ Stop() }

if logs.profiling {
cpuProfiler = profile.Start(profile.ProfilePath("."))
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/sigo/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func Anonymize(source RecordSource, factory GeneralizerFactory,
generalizer := factory.New(k, l, dim, source.QuasiIdentifer())
count := 0
records := []Record{}

log.Info().Msg("Reading source")

for source.Next() {
Expand All @@ -43,6 +44,7 @@ func Anonymize(source RecordSource, factory GeneralizerFactory,

validator := NewFloat64DataValidator(records, source.QuasiIdentifer())
err := validator.Validation()

if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions pkg/sigo/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,8 @@ func TestDataValidatorShouldReturnErrorWithNullValue(t *testing.T) {

func TestDataValidatorShouldReturnErrorWithList(t *testing.T) {
t.Parallel()

//nolint: go-golangci-lint
sourceText := `{"fruit":[0,1],"taille":[1,2],"poids":[1,2],"meurtre":0,"natation":[0,1],"course":[0,1],"voltige":[0,1],"animal":"souris"}
{"fruit":[0,1],"taille":[1,2],"poids":[1,2],"meurtre":0,"natation":[0,1],"course":[0,1],"voltige":[0,1],"animal":"saumon"}
{"fruit":[0,1],"taille":[1,2],"poids":[1,2],"meurtre":1,"natation":[0,1],"course":[0,1],"voltige":[0,1],"animal":"chouette"}
{"fruit":[0,1],"taille":[1,2],"poids":null,"meurtre":0,"natation":[0,1],"course":[0,1],"voltige":[0,1],"animal":"canard"}
{"fruit":[0,1],"taille":[3,3],"poids":[3,4],"meurtre":1,"natation":[0,1],"course":[0,1],"voltige":[0,1],"animal":"loup"}
Expand Down
3 changes: 2 additions & 1 deletion pkg/sigo/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func NewFloat64DataValidator(records []Record, quasiIdentifers []string) Float64
return Float64DataValidator{records: records, quasiIdentifers: quasiIdentifers}
}

// nolint: cyclop
func (v Float64DataValidator) Validation() error {
for _, record := range v.records {
row := record.Row()
Expand All @@ -44,8 +43,10 @@ func (v Float64DataValidator) Validation() error {
return err
}

//nolint: gocritic
switch t := row[key].(type) {
case bool:
//nolint: goerr113
err := fmt.Errorf("unsupported type: %T", t)

return err
Expand Down

0 comments on commit c187edb

Please sign in to comment.