From d637e69903535e69551476d546750275246321c0 Mon Sep 17 00:00:00 2001 From: Caitlin Elfring Date: Tue, 8 Sep 2020 18:46:14 -0400 Subject: [PATCH] s/warn/warning/ --- README.md | 10 +++++----- example.yaml | 2 +- pkg/config/testdata/good.yaml | 2 +- pkg/printer/simple_test.go | 2 +- pkg/result/fileresult_test.go | 2 +- pkg/result/result_test.go | 2 +- pkg/rule/severity.go | 6 +++--- pkg/rule/severity_test.go | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index c0026349..8fce9c3c 100644 --- a/README.md +++ b/README.md @@ -134,16 +134,16 @@ This can be something like `**/*.go`, or a space-separated list of filenames. ```bash $ woke test.txt -test.txt:2:2-11: `Blacklist` may be insensitive, use `denylist`, `blocklist` instead (warn) +test.txt:2:2-11: `Blacklist` may be insensitive, use `denylist`, `blocklist` instead (warning) * Blacklist ^ -test.txt:3:2-12: `White-list` may be insensitive, use `allowlist` instead (warn) +test.txt:3:2-12: `White-list` may be insensitive, use `allowlist` instead (warning) * White-list ^ -test.txt:4:2-11: `whitelist` may be insensitive, use `allowlist` instead (warn) +test.txt:4:2-11: `whitelist` may be insensitive, use `allowlist` instead (warning) * whitelist ^ -test.txt:5:2-11: `blacklist` may be insensitive, use `denylist`, `blocklist` instead (warn) +test.txt:5:2-11: `blacklist` may be insensitive, use `denylist`, `blocklist` instead (warning) * blacklist ^ ``` @@ -154,7 +154,7 @@ You can also provide text to `woke` via stdin ```bash $ echo "This has whitelist from stdin" | woke --stdin -/dev/stdin:1:9-18: `whitelist` may be insensitive, use `allowlist` instead (warn) +/dev/stdin:1:9-18: `whitelist` may be insensitive, use `allowlist` instead (warning) This has whitelist from stdin ^ ``` diff --git a/example.yaml b/example.yaml index 0326e1d7..8ca9bef8 100644 --- a/example.yaml +++ b/example.yaml @@ -18,4 +18,4 @@ rules: alternatives: - denylist - blocklist - severity: warn + severity: warning diff --git a/pkg/config/testdata/good.yaml b/pkg/config/testdata/good.yaml index e7e2be0f..ba429918 100644 --- a/pkg/config/testdata/good.yaml +++ b/pkg/config/testdata/good.yaml @@ -8,7 +8,7 @@ rules: - rule1 alternatives: - alt-rule1 - severity: warn + severity: warning - name: rule2 terms: diff --git a/pkg/printer/simple_test.go b/pkg/printer/simple_test.go index 217b9ace..1e33dfae 100644 --- a/pkg/printer/simple_test.go +++ b/pkg/printer/simple_test.go @@ -43,6 +43,6 @@ func TestSimple_Print(t *testing.T) { got := captureOutput(func() { assert.NoError(t, p.Print(res)) }) - expected := fmt.Sprintf("foo.txt:1:6: [warn] %s\n", res.Results[0].Reason()) + expected := fmt.Sprintf("foo.txt:1:6: [warning] %s\n", res.Results[0].Reason()) assert.Equal(t, expected, got) } diff --git a/pkg/result/fileresult_test.go b/pkg/result/fileresult_test.go index 6ba8831e..ac09f7d2 100644 --- a/pkg/result/fileresult_test.go +++ b/pkg/result/fileresult_test.go @@ -11,7 +11,7 @@ import ( func TestFileResult_String(t *testing.T) { rs := FindResults(&rule.WhitelistRule, "my/file", "this has the term whitelist", 1) fr := FileResults{Filename: "my/file", Results: rs} - assert.Equal(t, "my/file\n my/file:1:18-my/file:1:27 warn `whitelist` may be insensitive, use `allowlist` instead", fr.String()) + assert.Equal(t, "my/file\n my/file:1:18-my/file:1:27 warning `whitelist` may be insensitive, use `allowlist` instead", fr.String()) rs = FindResults(&rule.WhitelistRule, "my/file", "this has no rule violations", 1) fr = FileResults{Filename: "my/file", Results: rs} diff --git a/pkg/result/result_test.go b/pkg/result/result_test.go index d5118a92..2269e496 100644 --- a/pkg/result/result_test.go +++ b/pkg/result/result_test.go @@ -12,7 +12,7 @@ func TestFindResults(t *testing.T) { rs := FindResults(&rule.WhitelistRule, "my/file", "this has the term whitelist", 1) assert.Len(t, rs, 1) assert.Equal(t, rs[0].Reason(), rs[0].Rule.Reason(rs[0].Violation)) - assert.Equal(t, rs[0].String(), fmt.Sprintf(" my/file:1:18-my/file:1:27 warn %s", rs[0].Reason())) + assert.Equal(t, rs[0].String(), fmt.Sprintf(" my/file:1:18-my/file:1:27 warning %s", rs[0].Reason())) rs = FindResults(&rule.WhitelistRule, "my/file", "this has no rule violations", 1) assert.Len(t, rs, 0) diff --git a/pkg/rule/severity.go b/pkg/rule/severity.go index 929c31d1..48f5d172 100644 --- a/pkg/rule/severity.go +++ b/pkg/rule/severity.go @@ -12,7 +12,7 @@ const ( // SevError translates to Error // This will be the default severity SevError Severity = iota - // SevWarn translates to Warn + // SevWarn translates to Warning SevWarn // SevInfo translates to Info SevInfo @@ -23,7 +23,7 @@ func NewSeverity(s string) Severity { switch s { case SevInfo.String(): return SevInfo - case "warning": + case "warn": return SevWarn case SevWarn.String(): return SevWarn @@ -34,7 +34,7 @@ func NewSeverity(s string) Severity { } func (s Severity) String() string { - vals := [...]string{"error", "warn", "info"} + vals := [...]string{"error", "warning", "info"} if int(s) > len(vals) { return vals[len(vals)-1] } diff --git a/pkg/rule/severity_test.go b/pkg/rule/severity_test.go index dabc2209..518fbfd9 100644 --- a/pkg/rule/severity_test.go +++ b/pkg/rule/severity_test.go @@ -33,7 +33,7 @@ func TestSeverity_Colorize(t *testing.T) { input Severity expected string }{ - {SevWarn, "\x1b[33mwarn\x1b[0m"}, + {SevWarn, "\x1b[33mwarning\x1b[0m"}, {SevError, "\x1b[31merror\x1b[0m"}, {SevInfo, "\x1b[32minfo\x1b[0m"}, {Severity(999), "\x1b[32minfo\x1b[0m"},