mirror of
https://github.com/github/codeql.git
synced 2026-04-22 23:35:14 +02:00
Adjust alert message
This commit is contained in:
@@ -11,9 +11,11 @@
|
||||
|
||||
import java
|
||||
|
||||
from StringReplaceAllCall replaceAllCall
|
||||
from StringReplaceAllCall replaceAllCall, StringLiteral firstArg
|
||||
where
|
||||
firstArg = replaceAllCall.getArgument(0) and
|
||||
//only contains characters that could be a simple string
|
||||
replaceAllCall.getArgument(0).(StringLiteral).getValue().regexpMatch("^[a-zA-Z0-9]+$")
|
||||
firstArg.getValue().regexpMatch("^[a-zA-Z0-9]+$")
|
||||
select replaceAllCall,
|
||||
"Call to 'replaceAll' uses an argument comprised of plain string characters only."
|
||||
"This call to 'replaceAll' should be a call `replace` as its $@ is not a regular expression.",
|
||||
firstArg, "first argument"
|
||||
|
||||
@@ -1 +1 @@
|
||||
| Test.java:4:14:4:36 | replaceAll(...) | Call to 'replaceAll' uses an argument comprised of plain string characters only. |
|
||||
| Test.java:4:14:4:36 | replaceAll(...) | This call to 'replaceAll' should be a call `replace` as its $@ is not a regular expression. | Test.java:4:28:4:30 | "t" | first argument |
|
||||
|
||||
Reference in New Issue
Block a user