Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLI-1644 SLI-1642 Release 10.11.1 #1195

Merged
merged 4 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ import java.nio.file.Path

interface VcsRepo {
fun electBestMatchingServerBranchForCurrentHead(mainBranchName: String, allBranchNames: Set<String>): String?
fun isBranchMatchingCurrentHead(branch: String): Boolean
fun getGitDir(): Path?
}
9 changes: 9 additions & 0 deletions git/src/main/kotlin/org/sonarlint/intellij/git/GitRepo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ class GitRepo(private val repo: GitRepository, private val project: Project) : V
}
}

override fun isBranchMatchingCurrentHead(branch: String): Boolean {
return try {
return repo.currentBranchName == branch
} catch (e: Exception) {
SonarLintConsole.get(project).error("Couldn't compare branches", e)
false
}
}

override fun getGitDir(): Path? {
return try {
repo.root.toNioPath()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=10.12-SNAPSHOT
version=10.11.1-SNAPSHOT
riderBuildVersion=RD-2022.3.1
clionBuildVersion=CL-2022.3.1
clionResharperBuildVersion=RD-2024.1
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
sonarlint-core = "10.7.0.79135"
sonarlint-core = "10.7.1.79142"

sonar-java = "8.4.0.37032"
sonar-javascript = "10.16.0.27621"
Expand Down
55 changes: 35 additions & 20 deletions src/main/java/org/sonarlint/intellij/SonarLintIntelliJClient.kt
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,21 @@ object SonarLintIntelliJClient : SonarLintRpcClientDelegate {
return repo.electBestMatchingServerBranchForCurrentHead(mainBranchName, allBranchesNames) ?: mainBranchName
}

override fun matchProjectBranch(
configurationScopeId: String, branchNameToMatch: String, cancelChecker: SonarLintCancelChecker
): Boolean {
val repositoriesEPs = VcsRepoProvider.EP_NAME.extensionList
val repositories = BackendService.findModule(configurationScopeId)?.let { module ->
matchSonarModule(module, repositoriesEPs)
} ?: run {
BackendService.findProject(configurationScopeId)?.let { project ->
matchSonarProject(project, repositoriesEPs)
}
} ?: return false
val repo = repositories.first()
return repo.isBranchMatchingCurrentHead(branchNameToMatch)
}

private fun matchSonarModule(module: Module, repositoriesEPs: List<VcsRepoProvider>): List<VcsRepo>? {
val repositories = computeOnPooledThread(module.project, "Match Sonar Project Branch Task") {
repositoriesEPs.mapNotNull { it.getRepoFor(module) }.toList()
Expand Down Expand Up @@ -674,19 +689,17 @@ object SonarLintIntelliJClient : SonarLintRpcClientDelegate {
override fun listFiles(configScopeId: String): List<ClientFileDto> {
val timeStart = System.currentTimeMillis()
val listClientFiles = BackendService.findModule(configScopeId)?.let { module ->
computeOnPooledThread(module.project, "Listing All Module Files") { listModuleFiles(module, configScopeId) }
listModuleFiles(module, configScopeId)
} ?: findProject(configScopeId)?.let { project ->
computeOnPooledThread(project, "Listing All Project Files") {
val listProjectFiles = listProjectFiles(project, configScopeId)
val listProjectFiles = listProjectFiles(project, configScopeId)

if (isRider()) {
computeRiderSharedConfiguration(project, configScopeId)?.let {
listProjectFiles.add(it)
}
if (isRider()) {
computeRiderSharedConfiguration(project, configScopeId)?.let {
listProjectFiles.add(it)
}

listProjectFiles
}

listProjectFiles
}
?: emptyList()
val timeEnd = System.currentTimeMillis()
Expand Down Expand Up @@ -790,17 +803,19 @@ object SonarLintIntelliJClient : SonarLintRpcClientDelegate {
fileContent = computeReadActionSafely(project) { getFileContent(file) }
}
return try {
ClientFileDto(
uri,
Paths.get(relativePath),
configScopeId,
computeReadActionSafely(project) { isTestSources(file, project) },
file.charset.name(),
Paths.get(file.path),
fileContent,
language,
true
)
computeReadActionSafely(file, project) {
ClientFileDto(
uri,
Paths.get(relativePath),
configScopeId,
isTestSources(file, project),
file.charset.name(),
Paths.get(file.path),
fileContent,
language,
true
)
}
} catch (e: IOException) {
GlobalLogOutput.get().logError("Error while computing ClientFileDto", e)
null
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@

<change-notes><![CDATA[
<ul>
<li>10.11.1 - Allow to open AI fix suggestions coming from SonarQube or SonarCloud. Avoid a rare issue when VFS is closed.</li>
<li>10.11 - Optimize the triggering of analysis and automatically cancel redundant ones. Avoid an error related to the .gitignore file. Fix an issue where a custom Node.js path would not be considered. Optimize SonarLint initialization performance and reduce the file system cache usage. Improve error feedback with Connected Mode. 1 new PHP rule. 7 new Python rules related to PyTorch. Bug fixes, fewer FPs and improvements for many languages.</li>
<li>10.10 - Improve SonarLint performance and optimize memory usage. Refactor thread management to avoid UI freezes. Avoid errors of type 'No file to analyze'. Support detection of Micronaut configuration issues. 6 new JS/TS rules. Introduce new INFO and BLOCKER severities. Improve UI feedback when lacking permission with SonarQube or SonarCloud. Bug fixes, fewer FPs and improvements for many languages.</li>
<li>10.9 - Support analysis of Helm files. Improve analysis consistency on Rider. 7 new C++23 rules and C++23 support. Bug fixes, fewer FPs and improvements for many languages.</li>
Expand Down
Loading