Skip to content

Commit 0420ca0

Browse files
committed
Exclude built-in function calls from code inspection
1 parent 610372d commit 0420ca0

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/main/kotlin/org/domaframework/doma/intellij/inspection/sql/inspector/SqlBindVariableValidInspector.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class SqlBindVariableValidInspector : LocalInspectionTool() {
158158

159159
override fun visitElPrimaryExpr(element: SqlElPrimaryExpr) {
160160
super.visitElPrimaryExpr(element)
161-
if (!element.isFirstElement()) return
161+
if (!element.isFirstElement() || element.prevSibling?.elementType == SqlTypes.AT_SIGN) return
162162
val file = element.containingFile ?: return
163163
val project = element.project
164164

src/test/testData/src/main/resources/META-INF/doma/example/dao/EmployeeSummaryDao/bindVariableInFunctionParameters.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ FROM user u
77
WHERE p.employee_id = /* employee.employeeParam(employee.<error descr="The field or method [dist] does not exist in the class [Employee]">dist</error>, employee.employeeId) */0
88
AND p.base_rank = /* employee.employeeParam(user.userId, <error descr="The bind variable [count] does not exist in the Dao method [bindVariableInFunctionParameters]">count</error>) */0
99
AND p.employee_id = /* employee.employeeParam(employee.<error descr="The field or method [dist] does not exist in the class [Employee]">dist</error>, <error descr="The bind variable [rank] does not exist in the Dao method [bindVariableInFunctionParameters]">rank</error>) */0
10+
OR flag = /* @authUser() */false
1011
/*%end */

0 commit comments

Comments
 (0)