depguard: adjust phrasing (#2921)
This commit is contained in:
parent
4b218e664c
commit
ae2a968805
@ -1,6 +1,6 @@
|
|||||||
linters-settings:
|
linters-settings:
|
||||||
depguard:
|
depguard:
|
||||||
list-type: blacklist
|
list-type: denylist
|
||||||
packages:
|
packages:
|
||||||
# logging is allowed only by logutils.Log, logrus
|
# logging is allowed only by logutils.Log, logrus
|
||||||
# is allowed to use only in logutils package
|
# is allowed to use only in logutils package
|
||||||
|
@ -122,7 +122,7 @@ func newGuardian(settings *config.DepGuardSettings) (*guardian, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the list type was a blacklist the packages with error messages should be included in the blacklist package list
|
// if the list type was a denylist the packages with error messages should be included in the denylist package list
|
||||||
if dg.ListType == depguard.LTBlacklist {
|
if dg.ListType == depguard.LTBlacklist {
|
||||||
noMessagePackages := make(map[string]bool)
|
noMessagePackages := make(map[string]bool)
|
||||||
for _, pkg := range dg.Packages {
|
for _, pkg := range dg.Packages {
|
||||||
@ -164,9 +164,9 @@ func (g guardian) run(loadConfig *loader.Config, prog *loader.Program, pass *ana
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g guardian) createMsg(pkgName string) string {
|
func (g guardian) createMsg(pkgName string) string {
|
||||||
msgSuffix := "is in the blacklist"
|
msgSuffix := "is in the denylist"
|
||||||
if g.ListType == depguard.LTWhitelist {
|
if g.ListType == depguard.LTWhitelist {
|
||||||
msgSuffix = "is not in the whitelist"
|
msgSuffix = "is not in the allowlist"
|
||||||
}
|
}
|
||||||
|
|
||||||
var userSuppliedMsgSuffix string
|
var userSuppliedMsgSuffix string
|
||||||
|
4
test/testdata/depguard.go
vendored
4
test/testdata/depguard.go
vendored
@ -3,8 +3,8 @@
|
|||||||
package testdata
|
package testdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"compress/gzip" // ERROR "`compress/gzip` is in the blacklist"
|
"compress/gzip" // ERROR "`compress/gzip` is in the denylist"
|
||||||
"log" // ERROR "`log` is in the blacklist: don't use log"
|
"log" // ERROR "`log` is in the denylist: don't use log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SpewDebugInfo() {
|
func SpewDebugInfo() {
|
||||||
|
8
test/testdata/depguard_additional_guards.go
vendored
8
test/testdata/depguard_additional_guards.go
vendored
@ -3,10 +3,10 @@
|
|||||||
package testdata
|
package testdata
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"compress/gzip" // ERROR "`compress/gzip` is in the blacklist"
|
"compress/gzip" // ERROR "`compress/gzip` is in the denylist"
|
||||||
"fmt" // ERROR "`fmt` is in the blacklist"
|
"fmt" // ERROR "`fmt` is in the denylist"
|
||||||
"log" // ERROR "`log` is in the blacklist: don't use log"
|
"log" // ERROR "`log` is in the denylist: don't use log"
|
||||||
"strings" // ERROR "`strings` is in the blacklist: disallowed in additional guard"
|
"strings" // ERROR "`strings` is in the denylist: disallowed in additional guard"
|
||||||
)
|
)
|
||||||
|
|
||||||
func SpewDebugInfo() {
|
func SpewDebugInfo() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user