|
|
@ -47,7 +47,10 @@ var lintCommand = &cobra.Command{
|
|
|
|
RunE: lintCmd,
|
|
|
|
RunE: lintCmd,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var flagStrict bool
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
|
|
|
|
lintCommand.Flags().BoolVarP(&flagStrict, "strict", "", false, "fail on lint warnings")
|
|
|
|
RootCommand.AddCommand(lintCommand)
|
|
|
|
RootCommand.AddCommand(lintCommand)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -59,6 +62,13 @@ func lintCmd(cmd *cobra.Command, args []string) error {
|
|
|
|
paths = args
|
|
|
|
paths = args
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var lowestTolerance int
|
|
|
|
|
|
|
|
if flagStrict {
|
|
|
|
|
|
|
|
lowestTolerance = support.WarningSev
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
lowestTolerance = support.ErrorSev
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var total int
|
|
|
|
var total int
|
|
|
|
var failures int
|
|
|
|
var failures int
|
|
|
|
for _, path := range paths {
|
|
|
|
for _, path := range paths {
|
|
|
@ -77,7 +87,7 @@ func lintCmd(cmd *cobra.Command, args []string) error {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
total = total + 1
|
|
|
|
total = total + 1
|
|
|
|
if linter.HighestSeverity >= support.ErrorSev {
|
|
|
|
if linter.HighestSeverity >= lowestTolerance {
|
|
|
|
failures = failures + 1
|
|
|
|
failures = failures + 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|