Skip to content

Commit

Permalink
Fix or suppress warnings from new detekt version.
Browse files Browse the repository at this point in the history
  • Loading branch information
pocmo authored and mergify[bot] committed May 25, 2021
1 parent 315f105 commit cfba5b3
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ typealias AC_FILE_FACING_MODE = PromptRequest.File.FacingMode
/**
* Gecko-based PromptDelegate implementation.
*/
@Suppress("LargeClass")
internal class GeckoPromptDelegate(private val geckoEngineSession: GeckoEngineSession) :
PromptDelegate {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,14 @@ class BrowserMenuHighlightableItem(
return when (highlight) {
is BrowserMenuHighlight.HighPriority -> base.copy(
text = highlight.label ?: label,
end = if (highlight.endImageResource == NO_ID) null else DrawableMenuIcon(
context,
highlight.endImageResource
),
end = if (highlight.endImageResource == NO_ID) {
null
} else {
DrawableMenuIcon(
context,
highlight.endImageResource
)
},
effect = HighPriorityHighlightEffect(
backgroundTint = highlight.backgroundTint
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ internal object TabListReducer {
/**
* [TabListAction] Reducer function for modifying the list of [TabSessionState] objects in [BrowserState.tabs].
*/
@Suppress("LongMethod")
fun reduce(state: BrowserState, action: TabListAction): BrowserState {
return when (action) {
is TabListAction.AddTabAction -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,9 @@ interface DeviceConstellation : Observable<AccountEventsObserver> {

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

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class AppLinksInterceptor(
alwaysDeniedSchemes = alwaysDeniedSchemes),
private val launchFromInterceptor: Boolean = false
) : RequestInterceptor {

@Suppress("ComplexMethod")
override fun onLoadRequest(
engineSession: EngineSession,
uri: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,13 @@ internal class SaveLoginDialogFragment : PromptDialogFragment() {
}
is Result.CanBeUpdated -> {
setViewState(
headline = if (result.foundLogin.username.isEmpty()) context?.getString(
R.string.mozac_feature_prompt_login_add_username_headline
) else context?.getString(R.string.mozac_feature_prompt_login_update_headline),
headline = if (result.foundLogin.username.isEmpty()) {
context?.getString(
R.string.mozac_feature_prompt_login_add_username_headline
)
} else {
context?.getString(R.string.mozac_feature_prompt_login_update_headline)
},
negativeText = context?.getString(R.string.mozac_feature_prompt_dont_update),
confirmText =
context?.getString(R.string.mozac_feature_prompt_update_confirmation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class MozillaSocorroService(
return map
}

@Suppress("LongParameterList", "LongMethod")
@Suppress("LongParameterList", "LongMethod", "ComplexMethod")
private fun sendCrashData(
os: OutputStream,
boundary: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ class FennecLoginsMPImporter(
return if (!isFennecInstallation(browserDbPath)) {
logger.info("Skipping MP check, not a Fennec install.")
false
} else try {
// MP is set if default password doesn't work.
!FennecLoginsMigration.isMasterPasswordValid(FennecLoginsMigration.DEFAULT_MASTER_PASSWORD, key4DbPath)
} catch (e: Exception) {
logger.error("Failed to check MP validity", e)
false
} else {
try {
// MP is set if default password doesn't work.
!FennecLoginsMigration.isMasterPasswordValid(FennecLoginsMigration.DEFAULT_MASTER_PASSWORD, key4DbPath)
} catch (e: Exception) {
logger.error("Failed to check MP validity", e)
false
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ complexity:
includeStaticDeclarations: false
ComplexMethod:
active: true
threshold: 10
threshold: 18
ignoreSingleWhenExpression: true
LabeledExpression:
active: false
Expand Down

0 comments on commit cfba5b3

Please sign in to comment.