Closed dweaver33 closed 2 years ago
Seems related this: https://github.com/sqlfluff/sqlfluff-github-actions/issues/15
So maybe not an issue here?
Not sure, your JSON seems valid... 🤔
We are using JSON.parse
(nothing fancy) and I can confirm that the following is running fine:
const result = JSON.parse(`[
{
"file": "models/linting_test.sql",
"line": 9,
"start_column": 5,
"end_column": 5,
"title": "SQLFluff",
"message": "L003: Indent expected and not found compared to line #4",
"annotation_level": "failure"
},
{
"file": "models/linting_test.sql",
"line": 10,
"start_column": 5,
"end_column": 5,
"title": "SQLFluff",
"message": "L003: Indent expected and not found compared to line #4",
"annotation_level": "failure"
},
{
"file": "models/linting_test.sql",
"line": 14,
"start_column": 5,
"end_column": 5,
"title": "SQLFluff",
"message": "L036: Select targets should be on a new line unless there is only one select target.",
"annotation_level": "failure"
},
{
"file": "models/linting_test.sql",
"line": 15,
"start_column": 5,
"end_column": 5,
"title": "SQLFluff",
"message": "L003: Indent expected and not found compared to line #10",
"annotation_level": "failure"
},
{
"file": "models/linting_test.sql",
"line": 16,
"start_column": 5,
"end_column": 5,
"title": "SQLFluff",
"message": "L003: Indent expected and not found compared to line #10",
"annotation_level": "failure"
},
{
"file": "models/linting_test.sql",
"line": 18,
"start_column": 15,
"end_column": 15,
"title": "SQLFluff",
"message": "L009: Files must end with a single trailing newline.",
"annotation_level": "failure"
}
]`)
console.log({result})
Might be an encoding issue or an invalid character somewhere (non-breaking space, zero-width space...). For reference, here's the relevant code:
Hi @Mogztter, I actually ended up fixing this by implementing the fix described here: https://github.com/sqlfluff/sqlfluff-github-actions/issues/15#issuecomment-1030598058
Seems like it might be more of a dbt issue.
I'm getting the error
SyntaxError: Unexpected token : in JSON at position 2
when running against the following JSON: