Commit 7863f931 authored by Aaron Wells's avatar Aaron Wells Committed by Gerrit Code Review
Browse files

Reduce false positives in syntax checket for unbracketed SQL tables.

This one gets me a lot of false positives, so I'm changing the message to explain
that it's triggered by the words "from" and "join", and make it so that it doesn't
perform this check on lines that are probably comments

Change-Id: I5d1acc5eed0a31acc0a570b9bdac564ca514707f
parent 13fe5005
......@@ -79,9 +79,11 @@ while (<>) {
bad_line("a require_once statement should look like a function call, ".
"without a space between the keyword and the bracket.", $_);
}
if (/\b(from|join)\s[^({]/i) {
bad_line("this sql table is not surrounded by curly braces {}, ".
"or is not an anonymous inner select", $_);
# The word "from" or "join" on a line that is probably not a comment
# (because it's not preceeded by // or *). Note that (?!pattern) is a
# negative look-ahead assertion; /foo(?!bar)/ matches a foo not followed by bar
if (m#^(?!\s*(//|\*)).*?\b(from|join)\s[^({]#i) {
bad_line("presence of SQL keyword \"from\" or \"join\" suggests this line may contain a SQL table not surrounded by curly braces {}", $_);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment