The analyzer has detected a possible typo: the code contains an identifier (local variable, field, parameter, or function) that should likely be replaced with a different identifier. This finding is based on the presence of a structurally similar code snippet that may have been used as a template when creating the current one.
The example N1:
if currentUser != nil
{
updateProfile(currentUser)
sendNotification(currentUser)
}
if newUser != nil
{
updateProfile(newUser)
sendNotification(currentUser)
}
In the second if statement, the currentUser variable should be replaced with newUser. The code can be fixed in the following way:
if currentUser != nil
{
updateProfile(currentUser)
sendNotification(currentUser)
}
if newUser != nil
{
updateProfile(newUser)
sendNotification(newUser)
}
The example N2:
if FindMin(xCoords) < FindMin(yCoords) {
minBoundary = FindMin(xCoords)
} else {
minBoundary = FindMin(yCoords)
}
if FindMax(xCoords) < FindMax(yCoords) {
maxBoundary = FindMin(yCoords) // <=
} else {
maxBoundary = FindMax(xCoords)
}
In the then branch of the second if statement, FindMax should be called instead of FindMin. The code can be fixed in the following way:
if FindMin(xCoords) < FindMin(yCoords) {
minBoundary = FindMin(xCoords)
} else {
minBoundary = FindMin(yCoords)
}
if FindMax(xCoords) < FindMax(yCoords) {
maxBoundary = FindMax(yCoords)
} else {
maxBoundary = FindMax(xCoords)
}
Was this page helpful?
Your message has been sent. We will email you at
If you do not see the email in your inbox, please check if it is filtered to one of the following folders: