MCPcopy Create free account
hub / github.com/rilldata/rill / parseErrorsFromParser

Function parseErrorsFromParser

cli/cmd/validate/validate.go:236–261  ·  view source on GitHub ↗
(parserRes *runtimev1.Resource)

Source from the content-addressed store, hash-verified

234}
235
236func parseErrorsFromParser(parserRes *runtimev1.Resource) []ParseError {
237 if parserRes == nil || parserRes.GetProjectParser() == nil {
238 return nil
239 }
240
241 var parseErrors []ParseError
242 for _, e := range parserRes.GetProjectParser().State.ParseErrors {
243 if e == nil {
244 continue
245 }
246 pe := ParseError{
247 Message: e.Message,
248 FilePath: e.FilePath,
249 }
250 if e.StartLocation != nil {
251 pe.StartLine = e.StartLocation.Line
252 }
253 if e.Warning {
254 pe.Level = "warning"
255 } else {
256 pe.Level = "error"
257 }
258 parseErrors = append(parseErrors, pe)
259 }
260 return parseErrors
261}
262
263func outputResult(ch *cmdutil.Helper, result *ValidationResult, outputFormat printer.Format, outputFile string) error {
264 // Write JSON to file if requested

Callers 1

buildValidationResultFunction · 0.85

Calls 1

GetProjectParserMethod · 0.80

Tested by

no test coverage detected