1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-10 03:17:11 +02:00
revive/fixtures/confusing-naming1.go
chavacava 443bfc9e0b New rule: Confusing naming (#16)
* Adds rule superfluous-else (an extension of indent-error-flow)

* Fix superfluous-else rule struct namming.

* Adds superfuous-else rule to the rules table

* Adds confusing-naming rule

* adds multifile test

* [WIP] fix multiple file test

* draft solution for detecting confusing-names through multiple files

* [WIP] confusing-name multiple files

* draft working version

* cleaner version + more informative messages

* adds check on struct field names

* confusing-namming: fix tests
2018-07-02 12:05:20 +10:00

63 lines
1.1 KiB
Go

// Test of confusing-naming rule.
// Package pkg ...
package pkg
type foo struct{}
func (t foo) aFoo() {
return
}
func (t *foo) AFoo() { // MATCH /Method 'AFoo' differs only by capitalization to method 'aFoo' in the same source file/
return
}
type bar struct{}
func (t *bar) aBar() {
return
}
func (t *bar) aFoo() { // Should not warn
return
}
func aGlobal() {
}
func AGlobal() { // MATCH /Method 'AGlobal' differs only by capitalization to function 'aGlobal' in the same source file/
}
func ABar() { // Should not warn
}
func aFoo() { // Should not warn
}
func (t foo) ABar() { // Should not warn
return
}
func (t bar) ABar() { // MATCH /Method 'ABar' differs only by capitalization to method 'aBar' in the same source file/
return
}
func x() {}
type tFoo struct {
asd string
aSd int // MATCH /Field 'aSd' differs only by capitalization to other field in the struct type tFoo/
qwe, asD bool // MATCH /Field 'asD' differs only by capitalization to other field in the struct type tFoo/
zxc float32
}
type tBar struct {
asd string
qwe bool
zxc float32
}