mirror of
https://github.com/mgechev/revive.git
synced 2024-11-28 08:49:11 +02:00
67c83886d7
* fisrt working version of late-return rule * late-update: adds doc * renames to early-return * fix rule failure condition * fix alphabetical sorting of early-return
63 lines
1.1 KiB
Go
63 lines
1.1 KiB
Go
// Test of empty-blocks.
|
|
|
|
package fixtures
|
|
|
|
func earlyRet() bool {
|
|
if cond { // MATCH /if c {...} else {... return } can be simplified to if !c { ... return } .../
|
|
println()
|
|
println()
|
|
println()
|
|
} else {
|
|
return false
|
|
}
|
|
|
|
if cond { //MATCH /if c {...} else {... return } can be simplified to if !c { ... return } .../
|
|
println()
|
|
} else {
|
|
return false
|
|
}
|
|
|
|
if cond { //MATCH /if c { } else {... return} can be simplified to if !c { ... return }/
|
|
} else {
|
|
return false
|
|
}
|
|
|
|
if cond {
|
|
println()
|
|
} else if cond { //MATCH /if c { } else {... return} can be simplified to if !c { ... return }/
|
|
} else {
|
|
return false
|
|
}
|
|
|
|
if cond {
|
|
println()
|
|
} else if cond { //MATCH /if c {...} else {... return } can be simplified to if !c { ... return } .../
|
|
println()
|
|
} else {
|
|
return false
|
|
}
|
|
|
|
// Case already covered by golint
|
|
if cond {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
|
|
if cond { //MATCH /if c {...} else {... return } can be simplified to if !c { ... return } .../
|
|
println()
|
|
println()
|
|
println()
|
|
} else {
|
|
return false
|
|
}
|
|
|
|
if cond {
|
|
println()
|
|
println()
|
|
println()
|
|
} else {
|
|
println()
|
|
}
|
|
}
|