mirror of
https://github.com/mgechev/revive.git
synced 2024-11-24 08:32:22 +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" }] ```
23 lines
663 B
Go
23 lines
663 B
Go
// Test that dot imports are flagged.
|
|
|
|
package fixtures
|
|
|
|
import (
|
|
. "context" // in allowedPackages (standard library => just the name without full path)
|
|
. "errors" // in allowedPackages (standard library => just the name without full path)
|
|
. "fmt" // MATCH /should not use dot imports/
|
|
"math/rand"
|
|
tmplt "text/template"
|
|
|
|
. "github.com/BurntSushi/toml" // in allowedPackages (not in the standard library)
|
|
)
|
|
|
|
var _ Stringer // from "fmt"
|
|
var _ = New("fake error")
|
|
var _ = Background()
|
|
|
|
var _ = Position{} // check a package not in the standard library
|
|
|
|
var _ = rand.Rand{} // check non-alias package
|
|
var _ = tmplt.Template{} // check alias package
|