Skip to content

Commit

Permalink
Fix handling multi-line messages from cfn-lint, again
Browse files Browse the repository at this point in the history
The previous check was not robust enough because an error message might
have a bunch of colons(`:`)
  • Loading branch information
Graham42 committed Feb 17, 2021
1 parent 9352591 commit 4eaf99b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions errorformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
function parse(line) {
// Future: Accept new error format strings
// lint-me.json:218:7:218:34:E3001:Invalid resource attribute foo for resource bar
let parts = line.split(":");
if (parts.length < 6) {
// Check for a file name then a colon, then 4 sets of numbers separated by
// colons. We could be more strict with the pattern but this should be good
// enough.
if (!/^[^:]+:(\d+:){4}/.test(line)) {
throw new Error(`Line is not in expected parseable format: '${line}'`);
}
let parts = line.split(":");
/** @type {ErrorFormat} */
let err = {
fileName: parts[0],
Expand Down

0 comments on commit 4eaf99b

Please sign in to comment.