MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / validateFile

Method validateFile

cmd/gosqlx/cmd/watch.go:200–221  ·  view source on GitHub ↗

validateFile validates a single file and displays results

(filename string, timestamp string)

Source from the content-addressed store, hash-verified

198
199// validateFile validates a single file and displays results
200func (fw *FileWatcher) validateFile(filename string, timestamp string) {
201 if fw.opts.ValidatorOpts == nil {
202 return
203 }
204
205 validator := NewValidator(fw.opts.Out, fw.opts.Err, *fw.opts.ValidatorOpts)
206 fileResult := validator.validateFile(filename)
207
208 if fileResult.Error != nil {
209 fmt.Fprintf(fw.opts.Err, "[%s] %s %s - %v\n",
210 timestamp, colorRed("✗"), filename, fileResult.Error)
211 return
212 }
213
214 if fileResult.Valid {
215 fmt.Fprintf(fw.opts.Out, "[%s] %s %s - Valid\n",
216 timestamp, colorGreen("✓"), filename)
217 } else {
218 fmt.Fprintf(fw.opts.Out, "[%s] %s %s - Invalid\n",
219 timestamp, colorRed("✗"), filename)
220 }
221}
222
223// formatFile formats a single file and displays results
224func (fw *FileWatcher) formatFile(filename string, timestamp string) {

Callers 2

processFileMethod · 0.95
processAllFilesMethod · 0.95

Calls 4

validateFileMethod · 0.95
colorRedFunction · 0.85
colorGreenFunction · 0.85
NewValidatorFunction · 0.70

Tested by

no test coverage detected