File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ func (h *Hound) New() bool {
33
33
34
34
err = h .parseConfig (config )
35
35
if err != nil {
36
- return false
36
+ panic ( err )
37
37
}
38
38
39
39
return true
Original file line number Diff line number Diff line change @@ -201,6 +201,24 @@ index 000000..000000 000000
201
201
t .Logf ("Did pass" )
202
202
}
203
203
}
204
+
205
+ // Should fail when invalid Yaml is detected
206
+ {
207
+ badConfig := []byte (`
208
+ warn:
209
+ - 'string without a closing single quote
210
+ fail:
211
+ - 'some other string'
212
+ skip:
213
+ - '/bad.go
214
+ ` )
215
+
216
+ if err := hound .parseConfig (badConfig ); err != nil {
217
+ t .Logf ("Did not parse" )
218
+ } else {
219
+ t .Fatalf ("Should not parse" )
220
+ }
221
+ }
204
222
}
205
223
206
224
func getDiff (t * testing.T , diffContents string ) (string , * diff.Hunk ) {
Original file line number Diff line number Diff line change @@ -13,14 +13,21 @@ import (
13
13
)
14
14
15
15
var (
16
- version = "0.5.2 "
16
+ version = "0.5.3 "
17
17
showVersion = flag .Bool ("v" , false , "Show version" )
18
18
noColor = flag .Bool ("no-color" , false , "Disable color output" )
19
19
config = flag .String ("config" , ".githound.yml" , "Hound config file" )
20
20
bin = flag .String ("bin" , "git" , "Executable binary to use for git command" )
21
21
)
22
22
23
23
func main () {
24
+ defer func () {
25
+ if r := recover (); r != nil {
26
+ color .Red (fmt .Sprintf ("error: %s\n " , r ))
27
+ os .Exit (1 )
28
+ }
29
+ }()
30
+
24
31
flag .Parse ()
25
32
26
33
if * showVersion {
You can’t perform that action at this time.
0 commit comments