mirror of
https://github.com/gojp/goreportcard.git
synced 2026-02-08 14:29:06 +08:00
Add threshold option in goreportcard-cli
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"github.com/gojp/goreportcard/check"
|
||||
)
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
var (
|
||||
dir = flag.String("d", ".", "Root directory of your Go application")
|
||||
verbose = flag.Bool("v", false, "Verbose output")
|
||||
th = flag.Float64("t", 0, "Threshold of failure command")
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -36,4 +38,8 @@ func main() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if result.Average*100 < *th {
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user