Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depguard: adjust phrasing #2921

Merged
merged 1 commit into from Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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