Skip to content

Commit

Permalink
s/warn/warning/
Browse files Browse the repository at this point in the history
  • Loading branch information
caitlinelfring committed Sep 8, 2020
1 parent 7cc2ff2 commit d637e69
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
^
```
Expand All @@ -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
^
```
Expand Down
2 changes: 1 addition & 1 deletion example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ rules:
alternatives:
- denylist
- blocklist
severity: warn
severity: warning
2 changes: 1 addition & 1 deletion pkg/config/testdata/good.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rules:
- rule1
alternatives:
- alt-rule1
severity: warn
severity: warning

- name: rule2
terms:
Expand Down
2 changes: 1 addition & 1 deletion pkg/printer/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion pkg/result/fileresult_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion pkg/result/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions pkg/rule/severity.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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]
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rule/severity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit d637e69

Please sign in to comment.