Skip to content

Commit

Permalink
Improve flow step navigation
Browse files Browse the repository at this point in the history
Flow steps can belong to different parts of the same line.
This commit makes selections more precise by including column information from the SARIF step data.
  • Loading branch information
wwong committed Mar 12, 2024
1 parent 9c09263 commit 7f28832
Show file tree
Hide file tree
Showing 2 changed files with 175 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ import com.intellij.openapi.components.Service
import com.intellij.util.alsoIfNull
import java.net.HttpURLConnection
import java.net.URL
import java.util.Comparator
import java.util.TreeMap
import java.util.*


@Service(Service.Level.PROJECT)
Expand Down Expand Up @@ -134,7 +133,13 @@ class SarifService {
val element = Leaf(
leafName = result.message.text ?: "",
address = "${result.locations[0].physicalLocation.artifactLocation.uri}:${result.locations[0].physicalLocation.region.startLine}",
steps = result.codeFlows?.get(0)?.threadFlows?.get(0)?.locations?.map { "${it.location.physicalLocation.artifactLocation.uri}:${it.location.physicalLocation.region.startLine}" }
steps = result.codeFlows?.get(0)?.threadFlows?.get(0)?.locations?.map {
"${it.location.physicalLocation.artifactLocation.uri}:" +
"${it.location.physicalLocation.region.startLine}:" +
"${it.location.physicalLocation.region.startColumn}:" +
"${it.location.physicalLocation.region.endLine}:" +
"${it.location.physicalLocation.region.endColumn}"
}
?: listOf(),
location = result.locations[0].physicalLocation.artifactLocation.uri,
ruleId = result.ruleId,
Expand Down
Loading

0 comments on commit 7f28832

Please sign in to comment.