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

SONARKT-429 Fix UTs on Windows with autocrlf true #522

Merged
Merged
Changes from 1 commit
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 @@ -16,6 +16,7 @@
*/
package org.sonarsource.kotlin.plugin

import org.assertj.core.api.Assert
import org.assertj.core.api.Assertions
import org.junit.jupiter.api.Test
import org.sonar.api.SonarEdition
Expand All @@ -38,7 +39,11 @@ internal class KotlinRulesDefinitionTest {
.isEqualTo("Identical expressions should not be used on both sides of a binary operator")
Assertions.assertThat(rule.type()).isEqualTo(RuleType.BUG)
Assertions.assertThat(rule.scope()).isEqualTo(RuleScope.ALL)
Assertions.assertThat(rule.htmlDescription()).startsWith("<h2>Why is this an issue?</h2>\n<p>Using the same value on both sides")
val htmlDescription = rule.htmlDescription()?.lines();
Copy link
Contributor

@leveretka leveretka Jan 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is safe to use !! here and get rid of nullability. As we don't expect description to be null and if it is it wili fail accordingly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I have also removed the unnecessary ;.

Assertions.assertThat(htmlDescription?.getOrNull(0))
.startsWith("<h2>Why is this an issue?</h2>")
Assertions.assertThat(htmlDescription?.getOrNull(1))
.startsWith("<p>Using the same value on both sides")
val ruleWithConfig = repository.rule("S100")
val param = ruleWithConfig!!.param("format")
Assertions.assertThat(param!!.defaultValue()).isEqualTo("^[a-zA-Z][a-zA-Z0-9]*$")
Expand Down
Loading