Repository: mgechev/revive (go)

Issue:
Rule 'var-naming' should allow Fuzz_xxx()
**Is your feature request related to a problem? Please describe.**
In Go 1.18, [fuzzing is officially supported](https://go.dev/doc/fuzz/). FuzzXxx should be treated as same as TestXxx, BenchmarkXxx, ExampleXxx, which can use underscore(`_`) in the function name.
For example, if you are developing `big.Int` and add a fuzz test to `big.Int.SetString`, the test function's name will be `FuzzInt_SetString`.

**Describe the solution you'd like**
I haven't tested it, but I think adding a condition [here](https://github.com/mgechev/revive/blob/v1.1.2/rule/var-naming.go#L144) would be enough.

Pull request description:
fix #622 (Rule 'var-naming' should allow Fuzz_xxx)
Closes #622 


Patch:
diff --git a/rule/var-naming.go b/rule/var-naming.go
index 49db020..1de8608 100644
--- a/rule/var-naming.go
+++ b/rule/var-naming.go
@@ -145,7 +145,12 @@ func (w *lintNames) Visit(n ast.Node) ast.Visitor {
 			}
 		}
 	case *ast.FuncDecl:
-		if w.file.IsTest() && (strings.HasPrefix(v.Name.Name, "Example") || strings.HasPrefix(v.Name.Name, "Test") || strings.HasPrefix(v.Name.Name, "Benchmark")) {
+		funcName := v.Name.Name
+		if w.file.IsTest() &&
+			(strings.HasPrefix(funcName, "Example") ||
+				strings.HasPrefix(funcName, "Test") ||
+				strings.HasPrefix(funcName, "Benchmark") ||
+				strings.HasPrefix(funcName, "Fuzz")) {
 			return w
 		}
 


Test patch:
diff --git a/test/var-naming_test.go b/test/var-naming_test.go
index 2d0bf75..b6ccd41 100644
--- a/test/var-naming_test.go
+++ b/test/var-naming_test.go
@@ -11,4 +11,6 @@ func TestVarNaming(t *testing.T) {
 	testRule(t, "var-naming", &rule.VarNamingRule{}, &lint.RuleConfig{
 		Arguments: []interface{}{[]interface{}{"ID"}, []interface{}{"VM"}},
 	})
+
+	testRule(t, "var-naming_test", &rule.VarNamingRule{}, &lint.RuleConfig{})
 }
diff --git a/testdata/var-naming_test.go b/testdata/var-naming_test.go
new file mode 100644
index 0000000..dadf61d
--- /dev/null
+++ b/testdata/var-naming_test.go
@@ -0,0 +1,12 @@
+// Test for name linting.
+
+// Package pkg_with_underscores ...
+package varnaming_test
+
+var var_name int // MATCH /don't use underscores in Go names; var var_name should be varName/
+
+func Test_ATest()           {}
+func Example_AnExample()    {}
+func Benchmark_ABenchmark() {}
+
+func Fuzz_AFuzz() {}