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

IDE-251 Fix all detekt warnings #5003

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions catroid/config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ complexity:
threshold: 80
LongParameterList:
active: true
threshold: 6
functionThreshold: 8
constructorThreshold: 8
ignoreDefaultParameters: false
MethodOverloading:
active: true
threshold: 2
threshold: 6
NestedBlockDepth:
active: true
threshold: 4
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -100,7 +100,7 @@ class BrickContextMenuTest(
arrayOf(WhenNfcBrick(), false, false),
arrayOf(WhenRaspiPinChangedBrick(), false, false),
arrayOf(WhenTouchDownBrick(), false, false)
)
)
}

@Before
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -79,14 +79,18 @@ class DeleteImportedSpriteTest {
baseActivityTestRule.launchActivity()
Intents.init()

expectedIntent = AllOf.allOf(IntentMatchers.hasExtra(
ProjectListActivity.IMPORT_LOCAL_INTENT,
baseActivityTestRule.activity.getString(R.string.import_sprite_from_project_launcher)
))
expectedIntent = AllOf.allOf(
IntentMatchers.hasExtra(
ProjectListActivity.IMPORT_LOCAL_INTENT,
baseActivityTestRule.activity.getString(R.string.import_sprite_from_project_launcher)
)
)

val resultData = Intent()
resultData.putExtra(ProjectListActivity.IMPORT_LOCAL_INTENT,
localProject.directory.absoluteFile.absolutePath)
resultData.putExtra(
ProjectListActivity.IMPORT_LOCAL_INTENT,
localProject.directory.absoluteFile.absolutePath
)

val result = Instrumentation.ActivityResult(Activity.RESULT_OK, resultData)
Intents.intending(expectedIntent).respondWith(result)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -52,11 +52,11 @@ class ScreenshotSaverTest(private val name: String, private val fileName: String
@JvmStatic
@Parameterized.Parameters(name = "{0}")
fun data() = listOf(
arrayOf("VALID", "valid.png", true),
arrayOf("NULL", null, false),
arrayOf("WHITESPACES", " ", false),
arrayOf("ILLEGAL_CHARACTERS", "|\\?*<\":>+[]/'", false)
)
arrayOf("VALID", "valid.png", true),
arrayOf("NULL", null, false),
arrayOf("WHITESPACES", " ", false),
arrayOf("ILLEGAL_CHARACTERS", "|\\?*<\":>+[]/'", false)
)

private const val NUMBER_OF_COLORS = 4
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -103,8 +103,14 @@ class BrickSearchTest {
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
viewMatcher.perform(pressKey(KeyEvent.KEYCODE_ENTER))
InstrumentationRegistry.getInstrumentation().waitForIdleSync()
Espresso.onData(Matchers.allOf(Matchers.`is`(Matchers.instanceOf
(bricks[index] as Class<*>?))))
Espresso.onData(
Matchers.allOf(
Matchers.`is`(
Matchers.instanceOf
(bricks[index] as Class<*>?)
)
)
)
.inAdapterView(BrickPrototypeListMatchers.isBrickPrototypeView())
.atPosition(0)
.check(matches(isDisplayed()))
Expand Down Expand Up @@ -237,13 +243,13 @@ class BrickSearchTest {
)
}

fun ensureKeyboardIsClosed() {
private fun ensureKeyboardIsClosed() {
if (isKeyboardVisible()) {
hideKeyboard()
}
}

fun hideKeyboard() {
private fun hideKeyboard() {
Espresso.onView(ViewMatchers.isRoot()).perform(ViewActions.closeSoftKeyboard())
}
@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -115,13 +115,9 @@ class AssertEqualsBrickTest {

private fun handleConstraints(action: ViewAction, constraints: Matcher<View>): ViewAction {
return object : ViewAction {
override fun getConstraints(): Matcher<View> {
return constraints
}
override fun getConstraints(): Matcher<View> = constraints

override fun getDescription(): String {
return action.description
}
override fun getDescription(): String = action.description

override fun perform(uiController: UiController?, view: View?) {
action.perform(uiController, view)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -67,12 +67,12 @@ class StartListeningStageTest {
@Before
fun setUp() {
createProject(javaClass.simpleName)
textToSpeech = TextToSpeech(ApplicationProvider.getApplicationContext(), TextToSpeech.OnInitListener
{ status ->
if (status == TextToSpeech.SUCCESS) {
textToSpeech.language = Locale.US
textToSpeech =
TextToSpeech(ApplicationProvider.getApplicationContext()) { status ->
if (status == TextToSpeech.SUCCESS) {
textToSpeech.language = Locale.US
}
}
})
baseActivityTestRule.launchActivity(null)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catroid: An on-device visual programming system for Android devices
* Copyright (C) 2010-2022 The Catrobat Team
* Copyright (C) 2010-2024 The Catrobat Team
* (<http://developer.catrobat.org/credits>)
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -111,8 +111,8 @@ class TextDetectionResourceTest {

val script = UiTestUtils.createProjectAndGetStartScript("TextDetectionResourceTest")
.also {
it.addBrick(SetSizeToBrick(formula))
}
it.addBrick(SetSizeToBrick(formula))
}
lastBrickInScript = ScriptEvaluationGateBrick.appendToScript(script)
}

Expand Down
Loading