Skip to content

Commit

Permalink
Bug 1805070 - Part 3: Sync Focus detekt configuration with AC
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielluong committed Feb 23, 2023
1 parent 63340c3 commit af35639
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 134 deletions.
28 changes: 26 additions & 2 deletions focus-android/build.gradle
Expand Up @@ -40,11 +40,10 @@ buildscript {
}

plugins {
id "io.gitlab.arturbosch.detekt" version "1.19.0" // Variables in plugins {} aren't supported
id "io.gitlab.arturbosch.detekt" version "1.22.0" // Variables in plugins {} aren't supported
}

detekt {
buildUponDefaultConfig = true
input = files("$projectDir/app")
config = files("$projectDir/quality/detekt.yml")
baseline = file("$projectDir/quality/detekt-baseline.xml")
Expand All @@ -54,9 +53,34 @@ detekt {
enabled = true
destination = file("$projectDir/build/reports/detekt.html")
}
xml {
enabled = false
}
txt {
enabled = false
}
}
}

tasks.withType(io.gitlab.arturbosch.detekt.Detekt).configureEach() {
autoCorrect = true

exclude "**/test/**"
exclude "**/androidTest/**"
exclude "**/build/**"
exclude "**/resources/**"
exclude "**/tmp/**"
}

// Apply same path exclusions as for the main task
tasks.withType(io.gitlab.arturbosch.detekt.DetektCreateBaselineTask).configureEach() {
exclude "**/test/**"
exclude "**/androidTest/**"
exclude "**/build/**"
exclude "**/resources/**"
exclude "**/tmp/**"
}

allprojects {
repositories {
google()
Expand Down
76 changes: 21 additions & 55 deletions focus-android/quality/detekt-baseline.xml
Expand Up @@ -4,61 +4,24 @@
<CurrentIssues>
<ID>CollapsibleIfStatements:MainActivity.kt$MainActivity$if (!isTaskRoot) { if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) &amp;&amp; Intent.ACTION_MAIN == intent.action) { finish() return } }</ID>
<ID>CollapsibleIfStatements:UrlInputFragment.kt$UrlInputFragment.&lt;no name provided&gt;$if (reverse) { if (isOverlay) { dismiss() } }</ID>
<ID>ConstructorParameterNaming:FocusNimbus.kt$CookieBanner$_variables: Variables = NullVariables.instance</ID>
<ID>ConstructorParameterNaming:FocusNimbus.kt$CookieBanner$private val _defaults: Defaults</ID>
<ID>ConstructorParameterNaming:FocusNimbus.kt$CookieBanner$private val _variables: Variables</ID>
<ID>ConstructorParameterNaming:FocusNimbus.kt$Onboarding$_variables: Variables = NullVariables.instance</ID>
<ID>ConstructorParameterNaming:FocusNimbus.kt$Onboarding$private val _defaults: Defaults</ID>
<ID>ConstructorParameterNaming:FocusNimbus.kt$Onboarding$private val _variables: Variables</ID>
<ID>EmptyFunctionBlock:AutocompleteListFragment.kt$AutocompleteListFragment.&lt;no name provided&gt;${}</ID>
<ID>EmptyFunctionBlock:BiometricAuthenticationFragmentTest.kt$BiometricAuthenticationFragmentTest.&lt;no name provided&gt;${ }</ID>
<ID>EmptyFunctionBlock:ExceptionsListFragment.kt$ExceptionsListFragment.&lt;no name provided&gt;${}</ID>
<ID>EmptyFunctionBlock:FirstrunFragment.kt$FirstrunFragment.&lt;no name provided&gt;${}</ID>
<ID>FunctionOnlyReturningConstant:ExternalIntentNavigationTest.kt$ShadowPerformance$@Implementation @Suppress("Unused_Parameter") fun processIntentIfPerformanceTest(bundle: Bundle?, context: Context)</ID>
<ID>LongParameterList:FullScreenIntegration.kt$FullScreenIntegration$( val activity: Activity, val store: BrowserStore, tabId: String?, sessionUseCases: SessionUseCases, private val settings: Settings, private val toolbarView: BrowserToolbar, private val statusBar: View, private val engineView: EngineView, )</ID>
<ID>MatchingDeclarationName:SettingsSearchMenuRobot.kt$SearchSettingsRobot</ID>
<ID>MaxLineLength:BiometricAuthenticationFragmentTest.kt$BiometricAuthenticationFragmentTest$fun</ID>
<ID>MaxLineLength:BrowserRobot.kt$BrowserRobot$fun verifyOpenLinksInAppsPrompt(openLinksInAppsEnabled: Boolean, link: String)</ID>
<ID>MaxLineLength:BrowserRobot.kt$BrowserRobot.Transition$fun</ID>
<ID>MaxLineLength:BrowserToolbarIntegrationTest.kt$BrowserToolbarIntegrationTest$fun</ID>
<ID>MaxLineLength:BrowserToolbarTest.kt$BrowserToolbarTest$assertTrue((engineView.layoutParams as? CoordinatorLayout.LayoutParams)?.behavior is EngineViewBrowserToolbarBehavior)</ID>
<ID>MaxLineLength:CfrMiddlewareTest.kt$CfrMiddlewareTest$fun</ID>
<ID>MaxLineLength:ExternalIntentNavigationTest.kt$ExternalIntentNavigationTest$fun</ID>
<ID>MaxLineLength:FocusNimbus.kt$Onboarding$_defaults = Defaults(isCfrEnabled = isCfrEnabled, isEnabled = isEnabled, isPromoteSearchWidgetDialogEnabled = isPromoteSearchWidgetDialogEnabled )</ID>
<ID>MaxLineLength:HomeScreenScreenshots.kt$HomeScreenScreenshots$TestHelper.mDevice.findObject(UiSelector().resourceId("${TestHelper.packageName}:id/mozac_browser_toolbar_edit_url_view"))</ID>
<ID>MaxLineLength:HomeScreenScreenshots.kt$HomeScreenScreenshots$TestHelper.mDevice.findObject(UiSelector().resourceId("${TestHelper.packageName}:id/mozac_browser_toolbar_menu"))</ID>
<ID>MaxLineLength:HomeScreenScreenshots.kt$HomeScreenScreenshots$private</ID>
<ID>MaxLineLength:IntentUtilsTest.kt$IntentUtilsTest$fun</ID>
<ID>MaxLineLength:MainActivityTestRule.kt$MainActivityIntentsTestRule$open</ID>
<ID>MaxLineLength:MobileMetricsPingStorageTest.kt$MobileMetricsPingStorageTest$private val file = File("${(ApplicationProvider.getApplicationContext() as FocusApplication).cacheDir}/${MobileMetricsPingStorage.STORAGE_FOLDER}/${MobileMetricsPingStorage.FILE_NAME}")</ID>
<ID>MaxLineLength:OnboardingStorageTest.kt$OnboardingStorageTest$assertEquals(testContext.getString(OnboardingStep.ON_BOARDING_FIRST_SCREEN.prefId), prefManager.getString(testContext.getString(R.string.pref_key_onboarding_step), ""))</ID>
<ID>MaxLineLength:OnboardingStorageTest.kt$OnboardingStorageTest$assertEquals(testContext.getString(OnboardingStep.ON_BOARDING_SECOND_SCREEN.prefId), prefManager.getString(testContext.getString(R.string.pref_key_onboarding_step), ""))</ID>
<ID>MaxLineLength:OnboardingStorageTest.kt$OnboardingStorageTest$fun</ID>
<ID>MaxLineLength:SearchRobot.kt$private val clearSearchButton = mDevice.findObject(UiSelector().resourceId("$packageName:id/mozac_browser_toolbar_clear_view"))</ID>
<ID>MaxLineLength:SearchWidgetProviderTest.kt$SearchWidgetProviderTest$fun</ID>
<ID>MaxLineLength:SettingsPrivacyMenuRobot.kt$.</ID>
<ID>MaxLineLength:SettingsPrivacyMenuRobot.kt$SettingsPrivacyMenuRobot.Transition$fun</ID>
<ID>MaxLineLength:SitePermissionOptionsStorageTest.kt$SitePermissionOptionsStorageTest$fun</ID>
<ID>MaxLineLength:SitePermissionOptionsStoreTest.kt$SitePermissionOptionsStoreTest$doReturn(listOf(SitePermissionOption.AskToAllow(), SitePermissionOption.Blocked())).`when`(storage).getSitePermissionOptions(SitePermission.CAMERA)</ID>
<ID>MaxLineLength:SitePermissionOptionsStoreTest.kt$SitePermissionOptionsStoreTest$doReturn(testContext.getString(R.string.preference_phone_feature_camera)).`when`(storage).getSitePermissionLabel(SitePermission.CAMERA)</ID>
<ID>MaxLineLength:SitePermissionOptionsStoreTest.kt$SitePermissionOptionsStoreTest$fun</ID>
<ID>MaxLineLength:SitePermissionOptionsStoreTest.kt$SitePermissionOptionsStoreTest$verify(storage).saveCurrentSitePermissionOptionInSharePref(SitePermissionOption.Blocked(), SitePermission.CAMERA)</ID>
<ID>MaxLineLength:SitePermissionsFragmentTest.kt$SitePermissionsFragmentTest$fun</ID>
<ID>MaxLineLength:StartupPathProviderTest.kt$StartupPathProviderTest$fun</ID>
<ID>MaxLineLength:StartupStateProviderTest.kt$StartupStateProviderTest$fun</ID>
<ID>MaxLineLength:StartupTypeTelemetryTest.kt$StartupTypeTelemetryTest$fun</ID>
<ID>MaxLineLength:StringTest.kt$StringTest$"http://amazon.com/Mockingjay-Hunger-Games-Suzanne-Collins/dp/0545663261/ref=pd_sim_14_2?_encoding=UTF8&amp;psc=1&amp;refRID=90ZHE3V976TKBGDR9VAM"</ID>
<ID>MaxLineLength:StringTest.kt$StringTest$"https://www.nytimes.com/2017/08/30/world/europe/princess-diana-death-anniversary.html?hp&amp;action=click&amp;pgtype=Homepage&amp;clickSource=story-heading&amp;module=second-column-region&amp;region=top-news&amp;WT.nav=top-news"</ID>
<ID>MaxLineLength:StringTest.kt$StringTest$"https://www.wsj.com/articles/mexican-presidential-candidate-calls-for-nafta-talks-to-be-suspended-1504137175"</ID>
<ID>MaxLineLength:UriTest.kt$UriTest$assertTruncatedHost("yahoo.com", "https://de.search.yahoo.com/search?p=mozilla&amp;fr=yfp-t&amp;fp=1&amp;toggle=1&amp;cop=mss&amp;ei=UTF-8")</ID>
<ID>MayBeConst:CrashReporterFragment.kt$CrashReporterFragment.Companion$val FRAGMENT_TAG = "crash-reporter"</ID>
<ID>MayBeConst:IconGenerator.kt$IconGenerator.Companion$private val DEFAULT_ICON_CHAR = '?'</ID>
<ID>MayBeConst:IconGenerator.kt$IconGenerator.Companion$private val TEXT_SIZE_DP = 36f</ID>
<ID>MayBeConst:ManualAddSearchEnginePreference.kt$ManualAddSearchEnginePreference.Companion$private val SEARCH_ENGINE_NAME_KEY = "search-engine-name"</ID>
<ID>MayBeConst:ManualAddSearchEnginePreference.kt$ManualAddSearchEnginePreference.Companion$private val SEARCH_QUERY_KEY = "search-query"</ID>
<ID>MayBeConst:ManualAddSearchEnginePreference.kt$ManualAddSearchEnginePreference.Companion$private val SUPER_STATE_KEY = "super-state"</ID>
<ID>PrintStackTrace:TestHelper.kt$TestHelper$e</ID>
<ID>SpacingBetweenPackageAndImports:FocusNimbus.kt$ </ID>
<ID>SwallowedException:AppReviewUtils.kt$AppReviewUtils.Companion$e: ActivityNotFoundException</ID>
<ID>SwallowedException:BrowserFragment.kt$BrowserFragment$e: IllegalStateException</ID>
<ID>SwallowedException:FenixProductDetector.kt$FenixProductDetector$e: PackageManager.NameNotFoundException</ID>
<ID>SwallowedException:LocalizedContent.kt$LocalizedContent$e: PackageManager.NameNotFoundException</ID>
<ID>SwallowedException:ManualAddSearchEngineSettingsFragment.kt$ManualAddSearchEngineSettingsFragment.Companion$e: IOException</ID>
<ID>SwallowedException:MobileMetricsPingStorage.kt$MobileMetricsPingStorage$e: FileNotFoundException</ID>
<ID>SwallowedException:MobileMetricsPingStorage.kt$MobileMetricsPingStorage$e: IOException</ID>
<ID>SwallowedException:MobileMetricsPingStorage.kt$MobileMetricsPingStorage$e: JSONException</ID>
<ID>UndocumentedPublicClass:AboutFragment.kt$AboutFragment : BaseSettingsLikeFragment</ID>
<ID>UndocumentedPublicClass:AdvancedSettingsFragment.kt$AdvancedSettingsFragment : BaseSettingsFragmentOnSharedPreferenceChangeListener</ID>
<ID>UndocumentedPublicClass:AppAction.kt$AppAction$NavigateUp : AppAction</ID>
Expand Down Expand Up @@ -118,7 +81,6 @@
<ID>UndocumentedPublicClass:FirstrunFragment.kt$FirstrunFragment : FragmentOnClickListener</ID>
<ID>UndocumentedPublicClass:FirstrunPagerAdapter.kt$FirstrunPagerAdapter : PagerAdapter</ID>
<ID>UndocumentedPublicClass:FocusApplication.kt$FocusApplication : LocaleAwareApplicationProviderCoroutineScope</ID>
<ID>UndocumentedPublicClass:FocusNimbus.kt$FocusNimbus$Features</ID>
<ID>UndocumentedPublicClass:FocusSnackbar.kt$FocusSnackbar : BaseTransientBottomBar</ID>
<ID>UndocumentedPublicClass:FocusSnackbarDelegate.kt$FocusSnackbarDelegate : SnackbarDelegate</ID>
<ID>UndocumentedPublicClass:FullScreenIntegration.kt$FullScreenIntegration : LifecycleAwareFeatureUserInteractionHandler</ID>
Expand Down Expand Up @@ -311,7 +273,7 @@
<ID>UndocumentedPublicFunction:FocusTheme.kt$fun phoneDimensions()</ID>
<ID>UndocumentedPublicFunction:FocusTheme.kt$fun tabletDimensions()</ID>
<ID>UndocumentedPublicFunction:HomeMenu.kt$HomeMenu$fun getMenuBuilder(): BrowserMenuBuilder</ID>
<ID>UndocumentedPublicFunction:IconGenerator.kt$IconGenerator.Companion$/* * This method needs to be separate from generateAdaptiveLauncherIcon so that we can generate * the pre-Oreo icon to display in the Add To Home screen Dialog */ @JvmStatic fun generateLauncherIconPreOreo(context: Context, character: Char): Bitmap</ID>
<ID>UndocumentedPublicFunction:IconGenerator.kt$IconGenerator.Companion$@JvmStatic fun generateLauncherIconPreOreo(context: Context, character: Char): Bitmap</ID>
<ID>UndocumentedPublicFunction:InstallFirefoxActivity.kt$InstallFirefoxActivity.Companion$fun open(context: Context)</ID>
<ID>UndocumentedPublicFunction:InstallFirefoxActivity.kt$InstallFirefoxActivity.Companion$fun resolveAppStore(context: Context): ActivityInfo?</ID>
<ID>UndocumentedPublicFunction:InstalledSearchEnginesSettingsFragment.kt$InstalledSearchEnginesSettingsFragment.Companion$fun newInstance()</ID>
Expand Down Expand Up @@ -427,8 +389,8 @@
<ID>UndocumentedPublicFunction:StudiesViewHolder.kt$StudiesViewHolder.SectionViewHolder$fun bindSection(section: StudiesListItem.Section)</ID>
<ID>UndocumentedPublicFunction:StudiesViewModel.kt$StudiesViewModel$fun removeStudy(study: StudiesListItem.ActiveStudy)</ID>
<ID>UndocumentedPublicFunction:StudiesViewModel.kt$StudiesViewModel$fun setStudiesState(state: Boolean)</ID>
<ID>UndocumentedPublicFunction:SupportUtils.kt$SupportUtils$// For some reason this URL has a different format than the other SUMO URLs fun getSafeBrowsingURL(): String</ID>
<ID>UndocumentedPublicFunction:SupportUtils.kt$SupportUtils$fun getGenericSumoURLForTopic(topic: SumoTopic): String</ID>
<ID>UndocumentedPublicFunction:SupportUtils.kt$SupportUtils$fun getSafeBrowsingURL(): String</ID>
<ID>UndocumentedPublicFunction:SupportUtils.kt$SupportUtils$fun getSumoURLForTopic(context: Context, topic: SumoTopic): String</ID>
<ID>UndocumentedPublicFunction:SupportUtils.kt$SupportUtils$fun openDefaultBrowserSumoPage(context: Context)</ID>
<ID>UndocumentedPublicFunction:SupportUtils.kt$SupportUtils$fun openUrlInCustomTab(activity: FragmentActivity, destinationUrl: String)</ID>
Expand Down Expand Up @@ -520,13 +482,17 @@
<ID>UndocumentedPublicFunction:WhatsNewStorage.kt$WhatsNewStorage$fun getVersion(): WhatsNewVersion?</ID>
<ID>UndocumentedPublicFunction:WhatsNewStorage.kt$WhatsNewStorage$fun setSessionCounter(sessionCount: Int)</ID>
<ID>UndocumentedPublicFunction:WhatsNewStorage.kt$WhatsNewStorage$fun setVersion(version: WhatsNewVersion)</ID>
<ID>UnusedPrivateMember:DownloadRobot.kt$private val downloadNotificationText = getStringResource(R.string.mozac_feature_downloads_completed_notification_text2)</ID>
<ID>UnusedPrivateMember:ExternalIntentNavigationTest.kt$ShadowPerformance$bundle: Bundle?</ID>
<ID>UnusedPrivateMember:ExternalIntentNavigationTest.kt$ShadowPerformance$context: Context</ID>
<ID>UnusedPrivateMember:SettingsGeneralMenuRobot.kt$private val openWithDialogTitle = mDevice.findObject( UiSelector() .text("Open with"), )</ID>
<ID>UnusedPrivateMember:SettingsGeneralMenuRobot.kt$private val openWithList = mDevice.findObject( UiSelector() .resourceId("android:id/resolver_list"), )</ID>
<ID>UnusedPrivateMember:TelemetryMiddleware.kt$TelemetryMiddleware$ @Suppress("ComplexMethod") private fun generateOptions(customTabConfig: CustomTabConfig): List&lt;String&gt;</ID>
<ID>UnusedPrivateMember:WhatsNewTest.kt$WhatsNewTest$i</ID>
<ID>UnusedPrivateMember:TelemetryMiddleware.kt$TelemetryMiddleware$@Suppress("ComplexMethod") private fun generateOptions(customTabConfig: CustomTabConfig): List&lt;String&gt;</ID>
<ID>UseCheckOrError:ClientWrapper.kt$ClientWrapper$throw IllegalStateException("Non-private request")</ID>
<ID>UseCheckOrError:CookieBannerExceptionStore.kt$throw IllegalStateException( "You need to add CookieBannerExceptionMiddleware to your CookieBannerStore. ($action)", )</ID>
<ID>UseCheckOrError:LanguageScreenStore.kt$throw IllegalStateException("You need to add LanguageMiddleware to your LanguageScreenStore. ($action)")</ID>
<ID>UseCheckOrError:MainActivityNavigation.kt$MainActivityNavigation$throw IllegalStateException("Trying to lock unsupported device")</ID>
<ID>UseCheckOrError:SanityCheckMiddleware.kt$SanityCheckMiddleware$throw IllegalStateException("State contains non-private tabs")</ID>
<ID>UseCheckOrError:SessionNotificationService.kt$SessionNotificationService$throw IllegalStateException("Unknown intent: $intent")</ID>
<ID>UseCheckOrError:SettingsFragment.kt$SettingsFragment$throw IllegalStateException("Unknown preference: ${preference.key}")</ID>
<ID>UseCheckOrError:SitePermissionOptionsScreenStore.kt$throw IllegalStateException( "You need to add SitePermissionsOptionsMiddleware to your SitePermissionsOptionsScreenStore. ($action)", )</ID>
<ID>UseCheckOrError:UrlInputFragment.kt$UrlInputFragment$throw IllegalStateException("Unhandled view in onClick()")</ID>
<ID>UseRequire:FactsProcessor.kt$throw IllegalArgumentException("Fact is not a context menu fact")</ID>
<ID>UtilityClassWithPublicConstructor:AppReviewUtils.kt$AppReviewUtils</ID>
<ID>UtilityClassWithPublicConstructor:IconGenerator.kt$IconGenerator</ID>
</CurrentIssues>
Expand Down

0 comments on commit af35639

Please sign in to comment.