1
0
mirror of https://github.com/mgechev/revive.git synced 2025-03-17 20:57:58 +02:00

resolve #867: remove k[A-Z][A-Za-z\d]*$ sub-rule from var-naming (#871)

This commit is contained in:
Martins Irbe 2023-08-16 12:23:29 +01:00 committed by GitHub
parent 16871ed55f
commit 19a95d9a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 11 deletions

View File

@ -141,15 +141,6 @@ func (w *lintNames) check(id *ast.Ident, thing string) {
})
return
}
if len(id.Name) > 2 && id.Name[0] == 'k' && id.Name[1] >= 'A' && id.Name[1] <= 'Z' {
should := string(id.Name[1]+'a'-'A') + id.Name[2:]
w.onFailure(lint.Failure{
Failure: fmt.Sprintf("don't use leading k in Go names; %s %s should be %s", thing, id.Name, should),
Confidence: 0.8,
Node: id,
Category: "naming",
})
}
should := lint.Name(id.Name, w.whitelist, w.blacklist)
if id.Name == should {

View File

@ -57,8 +57,7 @@ func f_it() { // MATCH /don't use underscores in Go names; func f_it should be f
// Common styles in other languages that don't belong in Go.
const (
CPP_CONST = 1 // MATCH /don't use ALL_CAPS in Go names; use CamelCase/
kLeadingKay = 2 // MATCH /don't use leading k in Go names; const kLeadingKay should be leadingKay/
CPP_CONST = 1 // MATCH /don't use ALL_CAPS in Go names; use CamelCase/
HTML = 3 // okay; no underscore
X509B = 4 // ditto