v: 9.9
SonarQube is not detecting hard-coded record ids in some cases. We came across a file which had hard-coded record id present inside a for loop. SonarLint also failed in detecting the issue.
The code has a similar structure:
for(Account acc:[select … where id in :idList and recordTypeId='0000000000
When I tested the record id by assigning it to a string variable outside the loop, sonarlint successfully detected the issue.
for(Address add:[select id, name, var1__c, var2__c, var3__c,recordtypeid from address where recordtypeId=‘###############’ and account.recordtypeId=‘###############’ LIMIT 49999 FOR UPDATE]){
//Business code
}
The false negative is happening at both SonarLint and SonarQube levels