Skip to content

Commit

Permalink
depguard: adjust phrasing (golangci#2921)
Browse files Browse the repository at this point in the history
  • Loading branch information
cory-miller authored and SeigeC committed Apr 4, 2023
1 parent 1639a60 commit 829dffb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
@@ -1,6 +1,6 @@
linters-settings:
depguard:
list-type: blacklist
list-type: denylist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
Expand Down
6 changes: 3 additions & 3 deletions pkg/golinters/depguard.go
Expand Up @@ -122,7 +122,7 @@ func newGuardian(settings *config.DepGuardSettings) (*guardian, error) {
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 {
noMessagePackages := make(map[string]bool)
for _, pkg := range dg.Packages {
Expand Down Expand Up @@ -164,9 +164,9 @@ func (g guardian) run(loadConfig *loader.Config, prog *loader.Program, pass *ana
}

func (g guardian) createMsg(pkgName string) string {
msgSuffix := "is in the blacklist"
msgSuffix := "is in the denylist"
if g.ListType == depguard.LTWhitelist {
msgSuffix = "is not in the whitelist"
msgSuffix = "is not in the allowlist"
}

var userSuppliedMsgSuffix string
Expand Down
4 changes: 2 additions & 2 deletions test/testdata/depguard.go
Expand Up @@ -3,8 +3,8 @@
package testdata

import (
"compress/gzip" // ERROR "`compress/gzip` is in the blacklist"
"log" // ERROR "`log` is in the blacklist: don't use log"
"compress/gzip" // ERROR "`compress/gzip` is in the denylist"
"log" // ERROR "`log` is in the denylist: don't use log"
)

func SpewDebugInfo() {
Expand Down
8 changes: 4 additions & 4 deletions test/testdata/depguard_additional_guards.go
Expand Up @@ -3,10 +3,10 @@
package testdata

import (
"compress/gzip" // ERROR "`compress/gzip` is in the blacklist"
"fmt" // ERROR "`fmt` is in the blacklist"
"log" // ERROR "`log` is in the blacklist: don't use log"
"strings" // ERROR "`strings` is in the blacklist: disallowed in additional guard"
"compress/gzip" // ERROR "`compress/gzip` is in the denylist"
"fmt" // ERROR "`fmt` is in the denylist"
"log" // ERROR "`log` is in the denylist: don't use log"
"strings" // ERROR "`strings` is in the denylist: disallowed in additional guard"
)

func SpewDebugInfo() {
Expand Down

0 comments on commit 829dffb

Please sign in to comment.