Gerrit Bot has uploaded this change for review.
Switch to a more inclusive language
This commit changes various parts in the code that feel
very odd for someone who actually stutters. We are linting
for something bad and considering it as harmful. So let's
switch to a wording that is more technical and less
"high school yard"-like.
Change-Id: Ibf64feaef1a4f6b2c13e7dced4fd3e447249468e
GitHub-Last-Rev: 0e7d63c960c31d7d02b5c8bd219584b52833e7f1
GitHub-Pull-Request: golang/lint#507
---
M lint.go
R testdata/repetition.go
2 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/lint.go b/lint.go
index 7d813e0..6e7ead4 100644
--- a/lint.go
+++ b/lint.go
@@ -472,14 +472,12 @@
const docCommentsLink = styleGuideBase + "#doc-comments"
-// lintExported examines the exported names.
-// It complains if any required doc comments are missing,
-// or if they are not of the right form. The exact rules are in
-// lintFuncDoc, lintTypeDoc and lintValueSpecDoc; this function
-// also tracks the GenDecl structure being traversed to permit
-// doc comments for constants to be on top of the const block.
-// It also complains if the names stutter when combined with
-// the package name.
+// lintExported examines the exported names. It complains if any required doc
+// comments are missing, or if they are not of the right form. The exact rules
+// are in lintFuncDoc, lintTypeDoc and lintValueSpecDoc; this function also
+// tracks the GenDecl structure being traversed to permit doc comments for
+// constants to be on top of the const block. It also complains if the names
+// are repetitive when combined with the package name.
func (f *file) lintExported() {
if f.isTest() {
return
@@ -502,9 +500,9 @@
case *ast.FuncDecl:
f.lintFuncDoc(v)
if v.Recv == nil {
- // Only check for stutter on functions, not methods.
+ // Only check for repetitives on functions, not methods.
// Method names are not used package-qualified.
- f.checkStutter(v.Name, "func")
+ f.checkRepetition(v.Name, "func")
}
// Don't proceed inside funcs.
return false
@@ -515,7 +513,7 @@
doc = lastGen.Doc
}
f.lintTypeDoc(v, doc)
- f.checkStutter(v.Name, "type")
+ f.checkRepetition(v.Name, "type")
// Don't proceed inside types.
return false
case *ast.ValueSpec:
@@ -935,16 +933,16 @@
}
}
-func (f *file) checkStutter(id *ast.Ident, thing string) {
+func (f *file) checkRepetition(id *ast.Ident, thing string) {
pkg, name := f.f.Name.Name, id.Name
if !ast.IsExported(name) {
// unexported name
return
}
- // A name stutters if the package name is a strict prefix
+ // A name is repetitive if the package name is a strict prefix
// and the next character of the name starts a new word.
if len(name) <= len(pkg) {
- // name is too short to stutter.
+ // name is too short to be repetitive.
// This permits the name to be the same as the package name.
return
}
@@ -953,10 +951,10 @@
}
// We can assume the name is well-formed UTF-8.
// If the next rune after the package name is uppercase or an underscore
- // the it's starting a new word and thus this name stutters.
+ // the it's starting a new word and thus this name is repetitive.
rem := name[len(pkg):]
if next, _ := utf8.DecodeRuneInString(rem); next == '_' || unicode.IsUpper(next) {
- f.errorf(id, 0.8, link(styleGuideBase+"#package-names"), category("naming"), "%s name will be used as %s.%s by other packages, and that stutters; consider calling this %s", thing, pkg, name, rem)
+ f.errorf(id, 0.8, link(styleGuideBase+"#package-names"), category("naming"), "%s name will be used as %s.%s by other packages. This is repetitive; consider calling this %s", thing, pkg, name, rem)
}
}
diff --git a/testdata/stutter.go b/testdata/repetition.go
similarity index 95%
rename from testdata/stutter.go
rename to testdata/repetition.go
index 3e6b13e..2430bc8 100644
--- a/testdata/stutter.go
+++ b/testdata/repetition.go
@@ -1,4 +1,4 @@
-// Test of stuttery names.
+// Test of repetetive names.
// Package donut ...
package donut
To view, visit change 290510. To unsubscribe, or for help writing mail filters, visit settings.
Gerrit Bot uploaded patch set #2 to this change.
Switch to a more inclusive language
This commit changes various parts in the code that feel
very odd for someone who actually stutters. We are linting
for something bad and considering it as harmful. So let's
switch to a wording that is more technical and less
"high school yard"-like.
Change-Id: Ibf64feaef1a4f6b2c13e7dced4fd3e447249468e
GitHub-Last-Rev: e4c560611ea9235e5574d5ee013e78dddea3f615
GitHub-Pull-Request: golang/lint#507
---
M lint.go
R testdata/repetition.go
2 files changed, 17 insertions(+), 19 deletions(-)
To view, visit change 290510. To unsubscribe, or for help writing mail filters, visit settings.
Daniel Martí abandoned this change.
To view, visit change 290510. To unsubscribe, or for help writing mail filters, visit settings.