Skip to content

Commit

Permalink
(WIP) comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Godin committed Oct 22, 2024
1 parent 3bdce99 commit a594fb9
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import org.sonarsource.kotlin.api.frontend.KotlinFileContext
private const val COROUTINE_SCOPE = "kotlinx.coroutines.CoroutineScope"
private const val MESSAGE = "Extension functions on CoroutineScope should not be suspending."

@org.sonarsource.kotlin.api.frontend.K1only("easy?")
@org.sonarsource.kotlin.api.frontend.K1only("easy? try next")
@Rule(key = "S6312")
class CoroutineScopeFunSuspendingCheck : AbstractCheck() {
override fun visitNamedFunction(function: KtNamedFunction, kotlinFileContext: KotlinFileContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import org.sonarsource.kotlin.api.checks.AbstractCheck
import org.sonarsource.kotlin.api.checks.annotatedElement
import org.sonarsource.kotlin.api.frontend.KotlinFileContext

@org.sonarsource.kotlin.api.frontend.K1only("easy?")
@org.sonarsource.kotlin.api.frontend.K1only("easy? try next")
@Rule(key = "S1133")
class DeprecatedCodeCheck : AbstractCheck() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import org.sonar.check.Rule
import org.sonarsource.kotlin.api.checks.AbstractCheck
import org.sonarsource.kotlin.api.frontend.KotlinFileContext

//@K1only
@org.sonarsource.kotlin.api.frontend.K1only("rewritten, but K2 differs")
@Rule(key = "S1874")
class DeprecatedCodeUsedCheck : AbstractCheck() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import org.sonarsource.kotlin.api.visiting.analyze

private val JAVA_CLASS_KEYWORDS = listOf("java", "javaClass")

@org.sonarsource.kotlin.api.frontend.K1only("easy?")
@org.sonarsource.kotlin.api.frontend.K1only("rewritten, but K2 differs")
@Rule(key = "S6202")
class IsInstanceMethodCheck : CallAbstractCheck() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.sonarsource.kotlin.api.checks.isFunctionalInterface
import org.sonarsource.kotlin.api.checks.merge
import org.sonarsource.kotlin.api.frontend.KotlinFileContext

@org.sonarsource.kotlin.api.frontend.K1only("easy?")
@org.sonarsource.kotlin.api.frontend.K1only("easy? try next")
@Rule(key = "S6516")
class SamConversionCheck : AbstractCheck() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private val lazyInitializationMatcher = FunMatcher(
definingSupertype = "kotlin"
)

@org.sonarsource.kotlin.api.frontend.K1only("easy?")
@org.sonarsource.kotlin.api.frontend.K1only("easy? try next")
@Rule(key = "S6515")
class SingletonPatternCheck : AbstractCheck() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@ internal class KotlinSensorTest : AbstractSensorTest() {
assertThat(issues).hasSize(2)
}

/**
* ```
* java.lang.IllegalStateException: Resolution is not performed
* at org.jetbrains.kotlin.analysis.api.descriptors.CliFe10AnalysisFacade.orThrowResolutionNotPerformedError(CliFe10AnalysisFacade.kt:78)
* at org.jetbrains.kotlin.analysis.api.descriptors.CliFe10AnalysisFacade.getAnalysisContext(CliFe10AnalysisFacade.kt:52)
* at org.jetbrains.kotlin.analysis.api.descriptors.CliFe10AnalysisFacade.getAnalysisContext(CliFe10AnalysisFacade.kt:41)
* at org.jetbrains.kotlin.analysis.api.descriptors.KaFe10SessionProvider.getAnalysisSession(KaFe10SessionProvider.kt:24)
* at org.sonarsource.kotlin.api.visiting.KotlinFileVisitor.scan(KotlinFileVisitor.kt:57)
* ```
*
* TODO try to mock analyzeDeclarations in TopDownAnalyzerFacadeForJVM which is after analysisHandlerExtensions
*/
@org.junit.jupiter.api.Disabled
@Test
fun `Ensure compiler crashes during BindingContext generation don't crash engine`() {
context.setCanSkipUnchangedFiles(false)
Expand Down

0 comments on commit a594fb9

Please sign in to comment.