Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
For #7467: Update ktlint to 0.47.0.
Browse files Browse the repository at this point in the history
Replace deprecated disabled_rules with ktlint_disabled_rules.
Fix existing issues.
  • Loading branch information
mcarare authored and mergify[bot] committed Sep 6, 2022
1 parent 2407357 commit 2000242
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
ij_kotlin_allow_trailing_comma_on_call_site=true
ij_kotlin_allow_trailing_comma=true

disabled_rules = filename
ktlint_disabled_rules = filename
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ class ThreeDotMainMenuRobot {
fun verifyRequestDesktopSiteIsEnabled(expectedState: Boolean) {
if (expectedState) {
assertTrue(requestDesktopSiteButton.isChecked)
} else assertFalse(requestDesktopSiteButton.isChecked)
} else {
assertFalse(requestDesktopSiteButton.isChecked)
}
}

fun verifySettingsButtonExists() = settingsMenuButton().check(matches(isDisplayed()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ class CustomTabActivity : LocaleAwareAppCompatActivity() {
return if (name == EngineView::class.java.name) {
val engineView = components.engine.createView(context, attrs)
engineView.asView()
} else super.onCreateView(parent, name, context, attrs)
} else {
super.onCreateView(parent, name, context, attrs)
}
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ class InstallFirefoxActivity : Activity() {
return if (!resolveInfo.activityInfo.exported) {
// We are not allowed to launch this activity.
null
} else resolveInfo.activityInfo
} else {
resolveInfo.activityInfo
}
}

private fun createStoreIntent(): Intent {
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/org/mozilla/focus/activity/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ open class MainActivity : LocaleAwareAppCompatActivity() {
window.statusBarColor = ContextCompat.getColor(this, android.R.color.transparent)
when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
Configuration.UI_MODE_NIGHT_UNDEFINED, // We assume light here per Android doc's recommendation
Configuration.UI_MODE_NIGHT_NO, -> {
Configuration.UI_MODE_NIGHT_NO,
-> {
updateLightSystemBars()
}
Configuration.UI_MODE_NIGHT_YES -> {
Expand Down Expand Up @@ -321,7 +322,9 @@ open class MainActivity : LocaleAwareAppCompatActivity() {
override fun onCreateView(parent: View?, name: String, context: Context, attrs: AttributeSet): View? {
return if (name == EngineView::class.java.name) {
components.engine.createView(context, attrs).asView()
} else super.onCreateView(parent, name, context, attrs)
} else {
super.onCreateView(parent, name, context, attrs)
}
}

override fun onBackPressed() {
Expand Down Expand Up @@ -449,7 +452,7 @@ open class MainActivity : LocaleAwareAppCompatActivity() {

enum class AppOpenType(val type: String) {
LAUNCH("Launch"),
RESUME("Resume")
RESUME("Resume"),
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ package org.mozilla.focus.appreview
enum class AppReviewStep {
Pending,
ReviewNeeded,
Reviewed
Reviewed,
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ class EngineSharedPreferencesListener(

enum class ChangeSource(val source: String) {
SETTINGS("Settings"),
PANEL("Panel")
PANEL("Panel"),
}

enum class TrackerChanged(val tracker: String) {
ADVERTISING("Advertising"),
ANALYTICS("Analytics"),
SOCIAL("Social"),
CONTENT("Content")
CONTENT("Content"),
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import org.mozilla.focus.R

enum class OnboardingStep(val prefId: Int) {
ON_BOARDING_FIRST_SCREEN(R.string.pref_key_first_screen),
ON_BOARDING_SECOND_SCREEN(R.string.pref_key_second_screen)
ON_BOARDING_SECOND_SCREEN(R.string.pref_key_second_screen),
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ fun SearchOverlay(

when (state.value) {
is State.Disabled,
is State.NoSuggestionsAPI, -> {
is State.NoSuggestionsAPI,
-> {
if (query.value.isNullOrEmpty()) {
TopSitesOverlay(modifier = Modifier.background(focusColors.surface))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ enum class SitePermission(val androidPermissionsList: Array<String>) : Parcelabl
AUTOPLAY(emptyArray()),
AUTOPLAY_AUDIBLE(emptyArray()),
AUTOPLAY_INAUDIBLE(emptyArray()),
MEDIA_KEY_SYSTEM_ACCESS(emptyArray());
MEDIA_KEY_SYSTEM_ACCESS(emptyArray()),
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ class PrivacySecuritySettingsFragment :
)
}
resources.getString(R.string.pref_key_secure),
resources.getString(R.string.pref_key_biometric), -> {
resources.getString(R.string.pref_key_biometric),
-> {
// We need to recreate the activity to apply the SECURE flags.
requireActivity().recreate()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ object TelemetryWrapper {
}

enum class AutoCompleteEventSource {
SETTINGS
SETTINGS,
}

fun saveAutocompleteDomainEvent(eventSource: AutoCompleteEventSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class StartupPathProvider {
* - this API is accessed before it is set
* - if no intent is received before the activity is STARTED (e.g. app switcher)
*/
NOT_SET
NOT_SET,
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class StartupStateProvider(
* - if the activity this is called from is not currently started
* - if the currently started activity is not the first started activity
*/
UNKNOWN;
UNKNOWN,
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class StartupTypeTelemetry(

// To avoid combinatorial explosion in label names, we bucket NOT_SET into UNKNOWN.
StartupPath.NOT_SET,
StartupPath.UNKNOWN, -> "unknown"
StartupPath.UNKNOWN,
-> "unknown"
}

return "${stateLabel}_$pathLabel"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/mozilla/focus/utils/SupportUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object SupportUtils {
SEARCH_SUGGESTIONS("search-suggestions-focus-android"),
ALLOWLIST("focus-android-allowlist"),
STUDIES("how-opt-out-studies-firefox-focus-android"),
HTTPS_ONLY("https-only-prefs-focus")
HTTPS_ONLY("https-only-prefs-focus"),
}

fun getGenericSumoURLForTopic(topic: SumoTopic): String {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ configurations {
}

dependencies {
ktlint("com.pinterest:ktlint:0.46.1") {
ktlint("com.pinterest:ktlint:0.47.0") {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, getObjects().named(Bundling, Bundling.EXTERNAL))
}
Expand Down

0 comments on commit 2000242

Please sign in to comment.