mirror of
https://github.com/mgechev/revive.git
synced 2024-11-28 08:49:11 +02:00
9a2eab34f1
Add the ability to allow list of packages to be dot imported. Add a new don-imports configuration: * `allowedPackages`: (string) comma-separated list of allowed dot import packages Example: ```toml [rule.dot-imports] arguments = [{ allowedPackages = "github.com/onsi/ginkgo/v2,github.com/onsi/gomega" }] ```
19 lines
351 B
Go
19 lines
351 B
Go
package test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mgechev/revive/lint"
|
|
"github.com/mgechev/revive/rule"
|
|
)
|
|
|
|
func TestDotImports(t *testing.T) {
|
|
args := []any{map[string]any{
|
|
"allowedPackages": []any{"errors", "context", "github.com/BurntSushi/toml"},
|
|
}}
|
|
|
|
testRule(t, "import-dot", &rule.DotImportsRule{}, &lint.RuleConfig{
|
|
Arguments: args,
|
|
})
|
|
}
|