@@ -68,7 +68,6 @@ func (c cond) requireArgs(args ...interface{}) {
6868 } else if v .Field (i ).String () != "" {
6969 warn (c .Type + ":" , "specifying unnecessary argument '" + vType .Field (i ).Name + "'" )
7070 }
71-
7271 }
7372}
7473
@@ -103,6 +102,13 @@ func runCheck(cond cond) bool {
103102 not := "Not"
104103 condFunc := ""
105104 negation := false
105+
106+ // Ensure that condition type is a valid length
107+ if len (cond .Type ) <= len (not ) {
108+ fail (`Condition type "` + cond .Type + `" is not long enough to be valid` )
109+ return false
110+ }
111+
106112 condEnding := cond .Type [len (cond .Type )- len (not ) : len (cond .Type )]
107113 if condEnding == not {
108114 negation = true
@@ -125,6 +131,11 @@ func runCheck(cond cond) bool {
125131 }
126132
127133 debug ("Result is" , result , "and error is" , err )
134+
135+ if verboseEnabled && ! err .IsNil () {
136+ warn (condFunc , "returned an error:" , err )
137+ }
138+
128139 return err .IsNil () && result
129140}
130141
@@ -164,8 +175,7 @@ func (c cond) DirContains() (bool, error) {
164175 files = append (files , path )
165176 }
166177 if len (files ) > 10000 {
167- fail ("Recursive indexing has exceeded limit, erroring out." )
168- return errors .New ("Indexed too many files in recursive search" )
178+ return errors .New ("attempted to index too many files in recursive search" )
169179 }
170180 return nil
171181 })
@@ -206,7 +216,6 @@ func (c cond) FileContains() (bool, error) {
206216 for _ , line := range strings .Split (fileContent , "\n " ) {
207217 found , err = regexp .Match (c .Value , []byte (line ))
208218 if err != nil {
209- fail ("There's an error with your regular expression for FileContains: " + err .Error ())
210219 return false , err
211220 }
212221 if found {
0 commit comments