Skip to content

Commit ae2a968

Browse files
authored
depguard: adjust phrasing (#2921)
1 parent 4b218e6 commit ae2a968

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

.golangci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
linters-settings:
22
depguard:
3-
list-type: blacklist
3+
list-type: denylist
44
packages:
55
# logging is allowed only by logutils.Log, logrus
66
# is allowed to use only in logutils package

pkg/golinters/depguard.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ func newGuardian(settings *config.DepGuardSettings) (*guardian, error) {
122122
return nil, err
123123
}
124124

125-
// if the list type was a blacklist the packages with error messages should be included in the blacklist package list
125+
// if the list type was a denylist the packages with error messages should be included in the denylist package list
126126
if dg.ListType == depguard.LTBlacklist {
127127
noMessagePackages := make(map[string]bool)
128128
for _, pkg := range dg.Packages {
@@ -164,9 +164,9 @@ func (g guardian) run(loadConfig *loader.Config, prog *loader.Program, pass *ana
164164
}
165165

166166
func (g guardian) createMsg(pkgName string) string {
167-
msgSuffix := "is in the blacklist"
167+
msgSuffix := "is in the denylist"
168168
if g.ListType == depguard.LTWhitelist {
169-
msgSuffix = "is not in the whitelist"
169+
msgSuffix = "is not in the allowlist"
170170
}
171171

172172
var userSuppliedMsgSuffix string

test/testdata/depguard.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
package testdata
44

55
import (
6-
"compress/gzip" // ERROR "`compress/gzip` is in the blacklist"
7-
"log" // ERROR "`log` is in the blacklist: don't use log"
6+
"compress/gzip" // ERROR "`compress/gzip` is in the denylist"
7+
"log" // ERROR "`log` is in the denylist: don't use log"
88
)
99

1010
func SpewDebugInfo() {

test/testdata/depguard_additional_guards.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
package testdata
44

55
import (
6-
"compress/gzip" // ERROR "`compress/gzip` is in the blacklist"
7-
"fmt" // ERROR "`fmt` is in the blacklist"
8-
"log" // ERROR "`log` is in the blacklist: don't use log"
9-
"strings" // ERROR "`strings` is in the blacklist: disallowed in additional guard"
6+
"compress/gzip" // ERROR "`compress/gzip` is in the denylist"
7+
"fmt" // ERROR "`fmt` is in the denylist"
8+
"log" // ERROR "`log` is in the denylist: don't use log"
9+
"strings" // ERROR "`strings` is in the denylist: disallowed in additional guard"
1010
)
1111

1212
func SpewDebugInfo() {

0 commit comments

Comments
 (0)