all: imp lint, names, tests
This commit is contained in:
parent
284f8c7cc0
commit
87bad8c1c2
|
@ -74,7 +74,14 @@
|
|||
|
||||
set -e -f -u -x
|
||||
|
||||
make VERBOSE=1 go-deps go-tools go-lint go-test
|
||||
make\
|
||||
GOMAXPROCS=1\
|
||||
VERBOSE=1\
|
||||
go-deps go-tools go-lint
|
||||
|
||||
make\
|
||||
VERBOSE=1\
|
||||
go-test
|
||||
'final-tasks':
|
||||
- 'clean'
|
||||
'requirements':
|
||||
|
|
|
@ -61,7 +61,7 @@ func (g *idGenerator) fix(flts []FilterYAML) {
|
|||
}
|
||||
|
||||
log.Info(
|
||||
"filtering: warning: filter at index %d has duplicated id %d; reassigning to %d",
|
||||
"filtering: warning: filter at index %d has duplicate id %d; reassigning to %d",
|
||||
i,
|
||||
id,
|
||||
newID,
|
||||
|
|
|
@ -3,7 +3,9 @@ package filtering
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/aghalg"
|
||||
"github.com/AdguardTeam/AdGuardHome/internal/filtering/rulelist"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestIDGenerator_Fix(t *testing.T) {
|
||||
|
@ -77,13 +79,10 @@ func TestIDGenerator_Fix(t *testing.T) {
|
|||
func assertUniqueIDs(t testing.TB, flts []FilterYAML) {
|
||||
t.Helper()
|
||||
|
||||
set := map[rulelist.URLFilterID]struct{}{}
|
||||
uc := aghalg.UniqChecker[rulelist.URLFilterID]{}
|
||||
for _, f := range flts {
|
||||
id := f.ID
|
||||
if _, ok := set[id]; ok {
|
||||
t.Errorf("duplicated id %d", id)
|
||||
}
|
||||
|
||||
set[id] = struct{}{}
|
||||
uc.Add(f.ID)
|
||||
}
|
||||
|
||||
assert.NoError(t, uc.Validate())
|
||||
}
|
||||
|
|
|
@ -584,7 +584,7 @@ var resultHandlers = map[string]logEntryHandler{
|
|||
return nil
|
||||
}
|
||||
|
||||
id64, err := n.Int64()
|
||||
id, err := n.Int64()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -595,7 +595,7 @@ var resultHandlers = map[string]logEntryHandler{
|
|||
l++
|
||||
}
|
||||
|
||||
ent.Result.Rules[l-1].FilterListID = rulelist.URLFilterID(id64)
|
||||
ent.Result.Rules[l-1].FilterListID = rulelist.URLFilterID(id)
|
||||
|
||||
return nil
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue