Skip to content

Commit cfba5b3

Browse files
pocmomergify[bot]
authored andcommitted
Fix or suppress warnings from new detekt version.
1 parent 315f105 commit cfba5b3

File tree

9 files changed

+30
-19
lines changed

9 files changed

+30
-19
lines changed

components/browser/engine-gecko/src/main/java/mozilla/components/browser/engine/gecko/prompt/GeckoPromptDelegate.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ typealias AC_FILE_FACING_MODE = PromptRequest.File.FacingMode
6060
/**
6161
* Gecko-based PromptDelegate implementation.
6262
*/
63+
@Suppress("LargeClass")
6364
internal class GeckoPromptDelegate(private val geckoEngineSession: GeckoEngineSession) :
6465
PromptDelegate {
6566

components/browser/menu/src/main/java/mozilla/components/browser/menu/item/BrowserMenuHighlightableItem.kt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,14 @@ class BrowserMenuHighlightableItem(
165165
return when (highlight) {
166166
is BrowserMenuHighlight.HighPriority -> base.copy(
167167
text = highlight.label ?: label,
168-
end = if (highlight.endImageResource == NO_ID) null else DrawableMenuIcon(
169-
context,
170-
highlight.endImageResource
171-
),
168+
end = if (highlight.endImageResource == NO_ID) {
169+
null
170+
} else {
171+
DrawableMenuIcon(
172+
context,
173+
highlight.endImageResource
174+
)
175+
},
172176
effect = HighPriorityHighlightEffect(
173177
backgroundTint = highlight.backgroundTint
174178
)

components/browser/state/src/main/java/mozilla/components/browser/state/reducer/TabListReducer.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ internal object TabListReducer {
1515
/**
1616
* [TabListAction] Reducer function for modifying the list of [TabSessionState] objects in [BrowserState.tabs].
1717
*/
18+
@Suppress("LongMethod")
1819
fun reduce(state: BrowserState, action: TabListAction): BrowserState {
1920
return when (action) {
2021
is TabListAction.AddTabAction -> {

components/concept/sync/src/main/java/mozilla/components/concept/sync/Devices.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,9 @@ interface DeviceConstellation : Observable<AccountEventsObserver> {
102102

103103
/**
104104
* Describes current device and other devices in the constellation.
105-
*
106-
* TODO: currentDevice should not be nullable.
107-
* See https://github.com/mozilla-mobile/android-components/issues/8768
108105
*/
106+
// N.B.: currentDevice should not be nullable.
107+
// See https://github.com/mozilla-mobile/android-components/issues/8768
109108
data class ConstellationState(val currentDevice: Device?, val otherDevices: List<Device>)
110109

111110
/**

components/feature/app-links/src/main/java/mozilla/components/feature/app/links/AppLinksInterceptor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class AppLinksInterceptor(
5757
alwaysDeniedSchemes = alwaysDeniedSchemes),
5858
private val launchFromInterceptor: Boolean = false
5959
) : RequestInterceptor {
60-
60+
@Suppress("ComplexMethod")
6161
override fun onLoadRequest(
6262
engineSession: EngineSession,
6363
uri: String,

components/feature/prompts/src/main/java/mozilla/components/feature/prompts/dialog/SaveLoginDialogFragment.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,13 @@ internal class SaveLoginDialogFragment : PromptDialogFragment() {
338338
}
339339
is Result.CanBeUpdated -> {
340340
setViewState(
341-
headline = if (result.foundLogin.username.isEmpty()) context?.getString(
342-
R.string.mozac_feature_prompt_login_add_username_headline
343-
) else context?.getString(R.string.mozac_feature_prompt_login_update_headline),
341+
headline = if (result.foundLogin.username.isEmpty()) {
342+
context?.getString(
343+
R.string.mozac_feature_prompt_login_add_username_headline
344+
)
345+
} else {
346+
context?.getString(R.string.mozac_feature_prompt_login_update_headline)
347+
},
344348
negativeText = context?.getString(R.string.mozac_feature_prompt_dont_update),
345349
confirmText =
346350
context?.getString(R.string.mozac_feature_prompt_update_confirmation)

components/lib/crash/src/main/java/mozilla/components/lib/crash/service/MozillaSocorroService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ class MozillaSocorroService(
237237
return map
238238
}
239239

240-
@Suppress("LongParameterList", "LongMethod")
240+
@Suppress("LongParameterList", "LongMethod", "ComplexMethod")
241241
private fun sendCrashData(
242242
os: OutputStream,
243243
boundary: String,

components/support/migration/src/main/java/mozilla/components/support/migration/FennecLoginsMPImporter.kt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ class FennecLoginsMPImporter(
2929
return if (!isFennecInstallation(browserDbPath)) {
3030
logger.info("Skipping MP check, not a Fennec install.")
3131
false
32-
} else try {
33-
// MP is set if default password doesn't work.
34-
!FennecLoginsMigration.isMasterPasswordValid(FennecLoginsMigration.DEFAULT_MASTER_PASSWORD, key4DbPath)
35-
} catch (e: Exception) {
36-
logger.error("Failed to check MP validity", e)
37-
false
32+
} else {
33+
try {
34+
// MP is set if default password doesn't work.
35+
!FennecLoginsMigration.isMasterPasswordValid(FennecLoginsMigration.DEFAULT_MASTER_PASSWORD, key4DbPath)
36+
} catch (e: Exception) {
37+
logger.error("Failed to check MP validity", e)
38+
false
39+
}
3840
}
3941
}
4042

config/detekt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ complexity:
5353
includeStaticDeclarations: false
5454
ComplexMethod:
5555
active: true
56-
threshold: 10
56+
threshold: 18
5757
ignoreSingleWhenExpression: true
5858
LabeledExpression:
5959
active: false

0 commit comments

Comments
 (0)