labml icon indicating copy to clipboard operation
labml copied to clipboard

HEREDOC parse error & warning on SQL string with no substitution

Open RichardGrossman opened this issue 9 years ago • 2 comments

: parse error on value "<<" (tLSHFT) | Could not parse /Users/[etc]

Furthermore, this SQL string has no substitutions. def specialquery query =<<~SQL.gsub(/[\s\t]\n/, ' ').strip select i., pi., p., p.id as "product_id"

from product_ingredients pi
join ingredients i on pi.ingredient_id = i.id
join products p on pi.product_id = p.id
order by
p.description,
pi.product_id,
i.name
SQL

@report = Ingredient.find_by_sql(query)

RichardGrossman avatar Mar 28 '17 20:03 RichardGrossman

Hi Richard,

The <<~ syntax is not supported yet: https://github.com/seattlerb/ruby_parser/issues/218

If there is a parsing error on the <<~ heredoc, then Brakeman can't be warning about it, and I was not able to reproduce a warning using the <<- syntax.

Please provide the warning message.

presidentbeef avatar Mar 28 '17 22:03 presidentbeef

Going to close this. Please re-open if you can provide more information.

presidentbeef avatar Apr 27 '17 14:04 presidentbeef