Skip to content

Commit

Permalink
Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nquinquenel committed Oct 3, 2024
1 parent 368bd88 commit 5846ac4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package org.sonarlint.intellij.rider

import com.intellij.openapi.module.Module
import com.intellij.openapi.project.guessProjectDir
import com.intellij.openapi.vfs.VirtualFile
import com.jetbrains.rider.projectView.workspace.ProjectModelEntity
import com.jetbrains.rider.projectView.workspace.ProjectModelEntityVisitor
Expand All @@ -37,11 +36,6 @@ class RiderFilesContributor : FilesContributor {
// List files in Solution
filesInContentRoots.addAll(listFilesInSolution(module))

// List files in project dir, sometimes not all files are found via the previous method
filesInContentRoots.addAll(
module.project.guessProjectDir()?.children?.filter { !it.isDirectory && it.isValid }?.toSet() ?: emptySet()
)

return filesInContentRoots
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import org.sonarlint.intellij.analysis.RunningAnalysesTracker
import org.sonarlint.intellij.common.analysis.FilesContributor
import org.sonarlint.intellij.common.ui.ReadActionUtils.Companion.computeReadActionSafely
import org.sonarlint.intellij.common.ui.SonarLintConsole
import org.sonarlint.intellij.common.util.FileUtils.Companion.isFileValidForSonarLintWithExtensiveChecks
import org.sonarlint.intellij.common.util.SonarLintUtils.getService
import org.sonarlint.intellij.common.util.SonarLintUtils.isRider
import org.sonarlint.intellij.common.vcs.VcsRepo
Expand Down Expand Up @@ -796,7 +797,12 @@ object SonarLintIntelliJClient : SonarLintRpcClientDelegate {

// useful for Rider where the files to find are not located in content roots
private fun listFilesInProjectBaseDir(project: Project): Set<VirtualFile> {
return project.guessProjectDir()?.children?.filter { !it.isDirectory && it.isValid }?.toSet() ?: return emptySet()
return project.guessProjectDir()?.children?.filter {
!it.isDirectory && it.isValid && isFileValidForSonarLintWithExtensiveChecks(
it,
project
)
}?.toSet() ?: return emptySet()
}

override fun didChangeTaintVulnerabilities(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ import org.sonarlint.intellij.core.BackendService
import org.sonarlint.intellij.finding.issue.LiveIssue
import org.sonarlint.intellij.fs.VirtualFileEvent
import org.sonarlint.intellij.trigger.TriggerType
import org.sonarlint.intellij.util.ProjectUtils
import org.sonarlint.intellij.util.SonarLintAppUtils
import org.sonarlint.intellij.util.getDocument
import org.sonarsource.sonarlint.core.rpc.protocol.common.IssueSeverity
import org.sonarsource.sonarlint.core.rpc.protocol.common.RuleType
import org.sonarsource.sonarlint.plugin.api.module.file.ModuleFileEvent

@Disabled("Symbolic link check from SLCORE does not work with temp files")
class StandaloneModeMediumTests : AbstractSonarLintLightTests() {
private val diamondQuickFix = "SonarLint: Replace with <>"

Expand Down Expand Up @@ -144,7 +143,7 @@ class StandaloneModeMediumTests : AbstractSonarLintLightTests() {
}

@Test
@Disabled("Error: ENOENT: no such file or directory, scandir '/src'")
@Disabled("Provider \"temp\" not installed")
fun should_analyze_js_in_yaml_file() {
val fileToAnalyze = sendFileToBackend("src/lambda.yaml")

Expand Down Expand Up @@ -313,7 +312,7 @@ class StandaloneModeMediumTests : AbstractSonarLintLightTests() {
}

@Test
@Disabled("Ignored file still analyzed")
@Disabled("Provider \"temp\" not installed")
fun should_find_secrets_excluding_vcs_ignored_files() {
sendFileToBackend("src/devenv.js")
val fileToAnalyzeIgnored = sendFileToBackend("src/devenv_ignored.js")
Expand Down Expand Up @@ -492,7 +491,7 @@ class StandaloneModeMediumTests : AbstractSonarLintLightTests() {
}

val onTheFlyFindingsHolder = getService(project, AnalysisSubmitter::class.java).onTheFlyFindingsHolder
val issues = ProjectUtils.getAllFiles(project).toList().map {
val issues = SonarLintAppUtils.visitAndAddAllFilesForProject(project).toList().map {
onTheFlyFindingsHolder.getIssuesForFile(it)
}.toList().flatten()
return issues
Expand Down

0 comments on commit 5846ac4

Please sign in to comment.