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

Fix invalid syntaxes in test code #5446

Merged
merged 1 commit into from Oct 19, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -171,7 +171,7 @@ class CognitiveComplexitySpec {
fun `does not increment on just a condition`() {
val code = compileContentForTest(
"""
fun test(cond_ Boolean) = !cond
fun test(cond: Boolean) = !cond
""".trimIndent()
)

Expand All @@ -185,7 +185,7 @@ class CognitiveComplexitySpec {
fun `adds one for just a &&`() {
val code = compileContentForTest(
"""
fun test(cond_ Boolean) = !cond && !cond
fun test(cond: Boolean) = !cond && !cond
""".trimIndent()
)

Expand All @@ -196,7 +196,7 @@ class CognitiveComplexitySpec {
fun `adds only one for repeated &&`() {
val code = compileContentForTest(
"""
fun test(cond_ Boolean) = !cond && !cond && !cond
fun test(cond: Boolean) = !cond && !cond && !cond
""".trimIndent()
)

Expand All @@ -207,7 +207,7 @@ class CognitiveComplexitySpec {
fun `adds one per logical alternate operator`() {
val code = compileContentForTest(
"""
fun test(cond_ Boolean) = !cond && !cond || cond
fun test(cond: Boolean) = !cond && !cond || cond
""".trimIndent()
)

Expand All @@ -218,7 +218,7 @@ class CognitiveComplexitySpec {
fun `adds one per logical alternate operator with like operators in between`() {
val code = compileContentForTest(
"""
fun test(cond_ Boolean) {
fun test(cond: Boolean) {
if ( // +1
!cond
&& !cond && !cond // +1
Expand All @@ -236,7 +236,7 @@ class CognitiveComplexitySpec {
fun `adds one for negated but similar operators`() {
val code = compileContentForTest(
"""
fun test(cond_ Boolean) {
fun test(cond: Boolean) {
if ( // +1
!cond
&& !(cond && cond) // +2
Expand All @@ -252,7 +252,7 @@ class CognitiveComplexitySpec {
fun `adds only one for a negated chain of similar operators`() {
val code = compileContentForTest(
"""
fun test(cond_ Boolean) {
fun test(cond: Boolean) {
if ( // +1
!cond
&& !(cond && cond && cond) // +2
Expand All @@ -268,7 +268,7 @@ class CognitiveComplexitySpec {
fun `adds one for every negated similar operator chain`() {
val code = compileContentForTest(
"""
fun test(cond_ Boolean) {
fun test(cond: Boolean) {
if ( // +1
!cond
&& !(cond && cond && cond) // +2
Expand Down
Expand Up @@ -47,7 +47,7 @@ class CyclomaticComplexitySpec {
fun `counts while, continue and break`() {
val code = compileContentForTest(
"""
fun test(i_ Int) {
fun test(i: Int) {
var j = i
while(true) { // 1
if (j == 5) { // 1
Expand Down