(parserRes *runtimev1.Resource)
| 234 | } |
| 235 | |
| 236 | func 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 | |
| 263 | func outputResult(ch *cmdutil.Helper, result *ValidationResult, outputFormat printer.Format, outputFile string) error { |
| 264 | // Write JSON to file if requested |
no test coverage detected