Check names of func/method arguments.
diff --git a/lint.go b/lint.go
index add19b9..dffff3f 100644
--- a/lint.go
+++ b/lint.go
@@ -280,6 +280,23 @@
return true
}
check(v.Name, "func")
+
+ checkList := func(fl *ast.FieldList, thing string) {
+ if fl == nil {
+ return
+ }
+ for _, f := range fl.List {
+ for _, id := range f.Names {
+ check(id, thing)
+ }
+ }
+ }
+ thing := "func"
+ if v.Recv != nil {
+ thing = "method"
+ }
+ checkList(v.Type.Params, thing+" parameter")
+ checkList(v.Type.Results, thing+" result")
case *ast.GenDecl:
if v.Tok == token.IMPORT {
return true
diff --git a/testdata/names.go b/testdata/names.go
index f38a694..e923980 100644
--- a/testdata/names.go
+++ b/testdata/names.go
@@ -26,3 +26,8 @@
HTML = 3 // okay; no underscore
X509B = 4 // ditto
)
+
+func f(bad_name int) {} // MATCH /underscore.*func parameter.*bad_name/
+func g() (no_way int) {} // MATCH /underscore.*func result.*no_way/
+func (t *t_wow) f(more_under string) {} // MATCH /underscore.*method parameter.*more_under/
+func (t *t_wow) g() (still_more string) {} // MATCH /underscore.*method result.*still_more/