1
0
mirror of https://github.com/mgechev/revive.git synced 2025-11-27 22:18:41 +02:00

Add white & black lists for var-naming

This PR introduces a white & black lists of initialisms for the
`var-naming` rule.

Now the rule can be configured with:

```toml
[rule.var-naming]
  arguments = [["ID"], ["VM", "BAR"]]
```

This way, the linter will ignore `customId` but will throw on `customVm` or `customBar`.

Fix #41
This commit is contained in:
mgechev
2018-09-15 14:33:28 -07:00
parent 8d6642ccea
commit 90f51530cc
9 changed files with 87 additions and 50 deletions

View File

@@ -275,7 +275,7 @@ func TestLintName(t *testing.T) {
{"IEEE802_16Bit", "IEEE802_16Bit"},
}
for _, test := range tests {
got := lint.Name(test.name)
got := lint.Name(test.name, nil, nil)
if got != test.want {
t.Errorf("lintName(%q) = %q, want %q", test.name, got, test.want)
}