mirror of
https://github.com/mgechev/revive.git
synced 2024-11-30 08:57:07 +02:00
db6c522a37
* 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 * clean-up * draft working version * cleaner version + more informative messages * adds check on struct field names * fix config.go * clean master * new ADS rule: newerr * ADS-print working version * ads-print final version * ads-lost-err working version * confusing-namming: fix tests * removes ads-* rules * rule unreachable-code * unreachable-code refactored version * skip corner case of mandatory return
38 lines
688 B
Go
38 lines
688 B
Go
package fixtures
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
func foo() int {
|
|
log.Fatalf("%s", "About to fail") // ignore
|
|
return 0 // MATCH /unreachable code after this statement/
|
|
return 1
|
|
Println("unreachable")
|
|
}
|
|
|
|
func f() {
|
|
fmt.Println("Hello, playground")
|
|
if true {
|
|
return // MATCH /unreachable code after this statement/
|
|
Println("unreachable")
|
|
os.Exit(2) // ignore
|
|
Println("also unreachable")
|
|
}
|
|
return // MATCH /unreachable code after this statement/
|
|
fmt.Println("Bye, playground")
|
|
}
|
|
|
|
func g() {
|
|
fmt.Println("Hello, playground")
|
|
if true {
|
|
return // ignore if next stmt is labeled
|
|
label:
|
|
os.Exit(2) // ignore
|
|
}
|
|
|
|
fmt.Println("Bye, playground")
|
|
}
|