diff --git a/quality/detekt-baseline.xml b/quality/detekt-baseline.xml index 466cce16394..6b6ed8d6a5b 100644 --- a/quality/detekt-baseline.xml +++ b/quality/detekt-baseline.xml @@ -2,38 +2,55 @@ - EmptyFunctionBlock:AnimatedProgressBar.kt$AnimatedProgressBar.<no name provided>${} + AbsentOrWrongFileLicense:AddToHomescreenDialogFragment.kt$org.mozilla.focus.fragment.AddToHomescreenDialogFragment.kt + AbsentOrWrongFileLicense:AppConstants.kt$org.mozilla.focus.utils.AppConstants.kt + AbsentOrWrongFileLicense:Browser.kt$org.mozilla.focus.GleanMetrics.Browser.kt + AbsentOrWrongFileLicense:BrowserMenu.kt$org.mozilla.focus.menu.browser.BrowserMenu.kt + AbsentOrWrongFileLicense:BrowserMenuAdapter.kt$org.mozilla.focus.menu.browser.BrowserMenuAdapter.kt + AbsentOrWrongFileLicense:BrowserSearch.kt$org.mozilla.focus.GleanMetrics.BrowserSearch.kt + AbsentOrWrongFileLicense:Features.kt$org.mozilla.focus.utils.Features.kt + AbsentOrWrongFileLicense:FileUtils.kt$org.mozilla.focus.utils.FileUtils.kt + AbsentOrWrongFileLicense:FirstrunFragment.kt$org.mozilla.focus.fragment.FirstrunFragment.kt + AbsentOrWrongFileLicense:FirstrunPagerAdapter.kt$org.mozilla.focus.firstrun.FirstrunPagerAdapter.kt + AbsentOrWrongFileLicense:FocusApplication.kt$org.mozilla.focus.FocusApplication.kt + AbsentOrWrongFileLicense:GleanBuildInfo.kt$org.mozilla.focus.GleanMetrics.GleanBuildInfo.kt + AbsentOrWrongFileLicense:ImageSelectTest.kt$org.mozilla.focus.activity.ImageSelectTest.kt + AbsentOrWrongFileLicense:InstallFirefoxActivity.kt$org.mozilla.focus.activity.InstallFirefoxActivity.kt + AbsentOrWrongFileLicense:LearnMoreSwitchPreference.kt$org.mozilla.focus.settings.LearnMoreSwitchPreference.kt + AbsentOrWrongFileLicense:LegacyIds.kt$org.mozilla.focus.GleanMetrics.LegacyIds.kt + AbsentOrWrongFileLicense:MobileMetricsPingStorageTest.kt$org.mozilla.focus.utils.MobileMetricsPingStorageTest.kt + AbsentOrWrongFileLicense:Pings.kt$org.mozilla.focus.GleanMetrics.Pings.kt + AbsentOrWrongFileLicense:PreferenceSwitch.kt$org.mozilla.focus.settings.privacy.PreferenceSwitch.kt + AbsentOrWrongFileLicense:SearchEnginePreference.kt$org.mozilla.focus.search.SearchEnginePreference.kt + AbsentOrWrongFileLicense:SearchRobot.kt$org.mozilla.focus.activity.robots.SearchRobot.kt + AbsentOrWrongFileLicense:SearchSuggestionsViewModelTest.kt$org.mozilla.focus.searchsuggestions.SearchSuggestionsViewModelTest.kt + AbsentOrWrongFileLicense:SettingsBlockToggleTest.kt$org.mozilla.focus.activity.SettingsBlockToggleTest.kt + AbsentOrWrongFileLicense:SettingsTest.kt$org.mozilla.focus.activity.SettingsTest.kt + AbsentOrWrongFileLicense:SmokeTest.kt$org.mozilla.focus.testAnnotations.SmokeTest.kt + AbsentOrWrongFileLicense:SupportUtils.kt$org.mozilla.focus.utils.SupportUtils.kt + AbsentOrWrongFileLicense:SupportUtilsTest.kt$org.mozilla.focus.utils.SupportUtilsTest.kt + AbsentOrWrongFileLicense:TelemetryWrapper.kt$org.mozilla.focus.telemetry.TelemetryWrapper.kt + AbsentOrWrongFileLicense:Theme.kt$org.mozilla.focus.theme.Theme.kt + AbsentOrWrongFileLicense:ToggleBlockTest.kt$org.mozilla.focus.activity.ToggleBlockTest.kt + AbsentOrWrongFileLicense:TransitionDrawableGroup.kt$org.mozilla.focus.animation.TransitionDrawableGroup.kt + AbsentOrWrongFileLicense:URLExceptionTest.kt$org.mozilla.focus.activity.URLExceptionTest.kt + AbsentOrWrongFileLicense:ViewUtils.kt$org.mozilla.focus.utils.ViewUtils.kt + CollapsibleIfStatements:MainActivity.kt$MainActivity$if (!isTaskRoot) { if (intent.hasCategory(Intent.CATEGORY_LAUNCHER) && Intent.ACTION_MAIN == intent.action) { finish() return } } + CollapsibleIfStatements:UrlInputFragment.kt$UrlInputFragment.<no name provided>$if (reverse) { if (isOverlay) { dismiss() } } EmptyFunctionBlock:AutocompleteListFragment.kt$AutocompleteListFragment.<no name provided>${} - EmptyFunctionBlock:CustomTabTest.kt$CustomTabTest${} EmptyFunctionBlock:ExceptionsListFragment.kt$ExceptionsListFragment.<no name provided>${} EmptyFunctionBlock:FirstrunFragment.kt$FirstrunFragment.<no name provided>${} EmptyFunctionBlock:ManualAddSearchEnginePreference.kt$ManualAddSearchEnginePreference.<no name provided>${} EmptyFunctionBlock:TabSheetFragment.kt$TabSheetFragment${} - FunctionOnlyReturningConstant:Settings.kt$Settings$fun shouldBlockImages(): Boolean ImplicitDefaultLocale:LocalizedContent.kt$LocalizedContent$String.format( "%s (Build #%s)", packageInfo.versionName, packageInfo.versionCode.toString() + engineIndicator ) - ImplicitDefaultLocale:URLMismatchTest.kt$URLMismatchTest$String.format("mozilla focus - %s Search", "google") LongMethod:BrowserFragment.kt$BrowserFragment$@Suppress("ComplexMethod") override fun onClick(view: View) LongMethod:BrowserMenuAdapter.kt$BrowserMenuAdapter$private fun initializeMenu(url: String, customTabConfig: CustomTabConfig?) - LongMethod:MultitaskingTest.kt$MultitaskingTest$@Test fun testVisitingMultipleSites() - LongMethod:UrlInputFragment.kt$UrlInputFragment$ // This method correctly triggers a complexity warning. This method is indeed very and too complex. // However refactoring it is not trivial at this point so we ignore the warning for now. @Suppress("ComplexMethod") private fun playVisibilityAnimation(reverse: Boolean) MatchingDeclarationName:SettingsSearchMenuRobot.kt$SearchSettingsRobot - MaxLineLength:MobileMetricsPingStorageTest.kt$MobileMetricsPingStorageTest$private val file = File("${(ApplicationProvider.getApplicationContext() as FocusApplication).cacheDir}/${MobileMetricsPingStorage.STORAGE_FOLDER}/${MobileMetricsPingStorage.FILE_NAME}") - MaxLineLength:StringTest.kt$StringTest$"http://amazon.com/Mockingjay-Hunger-Games-Suzanne-Collins/dp/0545663261/ref=pd_sim_14_2?_encoding=UTF8&psc=1&refRID=90ZHE3V976TKBGDR9VAM" - MaxLineLength:StringTest.kt$StringTest$"https://www.nytimes.com/2017/08/30/world/europe/princess-diana-death-anniversary.html?hp&action=click&pgtype=Homepage&clickSource=story-heading&module=second-column-region&region=top-news&WT.nav=top-news" - MaxLineLength:StringTest.kt$StringTest$"https://www.wsj.com/articles/mexican-presidential-candidate-calls-for-nafta-talks-to-be-suspended-1504137175" - MaxLineLength:SwitchLocaleTest.kt$SwitchLocaleTest$/* re-enter settings and general settings, change it back to system locale, verify the locale is changed */ - MaxLineLength:UriTest.kt$UriTest$assertTruncatedHost("yahoo.com", "https://de.search.yahoo.com/search?p=mozilla&fr=yfp-t&fp=1&toggle=1&cop=mss&ei=UTF-8") MayBeConst:AddToHomescreenDialogFragment.kt$AddToHomescreenDialogFragment.Companion$private val BLOCKING_ENABLED = "blocking_enabled" MayBeConst:AddToHomescreenDialogFragment.kt$AddToHomescreenDialogFragment.Companion$private val REQUEST_DESKTOP = "request_desktop" MayBeConst:AddToHomescreenDialogFragment.kt$AddToHomescreenDialogFragment.Companion$private val TITLE = "title" MayBeConst:AddToHomescreenDialogFragment.kt$AddToHomescreenDialogFragment.Companion$private val URL = "url" MayBeConst:AddToHomescreenDialogFragment.kt$AddToHomescreenDialogFragment.Companion$val FRAGMENT_TAG = "add-to-homescreen-prompt-dialog" - MayBeConst:AnimatedProgressBar.kt$AnimatedProgressBar.Companion$private val CLOSING_DELAY = 300 - MayBeConst:AnimatedProgressBar.kt$AnimatedProgressBar.Companion$private val CLOSING_DURATION = 300 - MayBeConst:AnimatedProgressBar.kt$AnimatedProgressBar.Companion$private val DEFAULT_DURATION = 1000 - MayBeConst:AnimatedProgressBar.kt$AnimatedProgressBar.Companion$private val DEFAULT_RESOURCE_ID = 0 - MayBeConst:AnimatedProgressBar.kt$AnimatedProgressBar.Companion$private val PROGRESS_DURATION = 200 - MayBeConst:BiometricAuthenticationDialogFragment.kt$BiometricAuthenticationDialogFragment.Companion$val FRAGMENT_TAG = "biometric-dialog-fragment" MayBeConst:CrashReporterFragment.kt$CrashReporterFragment.Companion$val FRAGMENT_TAG = "crash-reporter" MayBeConst:Features.kt$Features.Companion$val SEARCH_TERMS_OR_URL: Boolean = true MayBeConst:IconGenerator.kt$IconGenerator.Companion$private val DEFAULT_ICON_CHAR = '?' @@ -41,7 +58,6 @@ MayBeConst:ManualAddSearchEnginePreference.kt$ManualAddSearchEnginePreference.Companion$private val SEARCH_ENGINE_NAME_KEY = "search-engine-name" MayBeConst:ManualAddSearchEnginePreference.kt$ManualAddSearchEnginePreference.Companion$private val SEARCH_QUERY_KEY = "search-query" MayBeConst:ManualAddSearchEnginePreference.kt$ManualAddSearchEnginePreference.Companion$private val SUPER_STATE_KEY = "super-state" - MayBeConst:SettingsActivity.kt$SettingsActivity.Companion$@JvmField val ACTIVITY_RESULT_LOCALE_CHANGED = 1 MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Category$val ACTION = "action" MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Category$val ERROR = "error" MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Category$val HISTOGRAM = "histogram" @@ -152,9 +168,6 @@ MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val SELECTION = "selection" MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val SETTINGS = "settings" MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val SKIP = "skip" - MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val SURVEY_TIP = "survey_tip" - MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val SURVEY_TIP_ES = "survey_tip_es" - MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val SURVEY_TIP_FR = "survey_tip_fr" MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val TAB = "tab" MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val URL = "url" MayBeConst:TelemetryWrapper.kt$TelemetryWrapper.Value$val WHATS_NEW = "whats_new" @@ -162,47 +175,10 @@ MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val ANIMATION_BROWSER_SCREEN = "browser_screen" MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val ANIMATION_DURATION = 200 MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val ARGUMENT_ANIMATION = "animation" - MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val ARGUMENT_HEIGHT = "height" MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val ARGUMENT_SESSION_UUID = "sesssion_uuid" - MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val ARGUMENT_WIDTH = "width" - MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val ARGUMENT_X = "x" - MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val ARGUMENT_Y = "y" MayBeConst:UrlInputFragment.kt$UrlInputFragment.Companion$private val TIPS_ALPHA = 0.65f - MemberNameEqualsClassName:AddToHomescreenTest.kt$AddToHomescreenTest$@Ignore("Flaky test, will be refactored") @Test @Throws(UiObjectNotFoundException::class) @Suppress("LongMethod") fun AddToHomeScreenTest() - MemberNameEqualsClassName:FirstRunDialogueTest.kt$FirstRunDialogueTest$@Test fun FirstRunDialogueTest() - NewLineAtEndOfFile:Components.kt$org.mozilla.focus.Components.kt NewLineAtEndOfFile:SupportUtilsTest.kt$org.mozilla.focus.utils.SupportUtilsTest.kt NewLineAtEndOfFile:TestFocusApplication.kt$org.mozilla.focus.TestFocusApplication.kt - ReturnCount:IconGenerator.kt$IconGenerator.Companion$ private fun getRepresentativeSnippet(url: String?): String? - ReturnCount:IntentProcessor.kt$IntentProcessor$ fun handleIntent(context: Context, intent: SafeIntent, savedInstanceState: Bundle?): Result - ReturnCount:IntentUtils.kt$IntentUtils$private fun handleUnsupportedLink(context: Context, intent: Intent): Boolean ReturnCount:MainActivity.kt$MainActivity$override fun onBackPressed() - ReturnCount:SearchEngineWriter.kt$SearchEngineWriter.Companion$private fun xmlToString(doc: Document): String? - ReturnCount:String.kt$ fun String.beautifyUrl(): String - SwallowedException:BiometricAuthenticationHandler.kt$BiometricAuthenticationHandler$catch (err: KeyPermanentlyInvalidatedException) { false } - SwallowedException:BrowserFragment.kt$BrowserFragment$catch (e: IllegalStateException) { // It can happen that at this point in time the activity is already in the background // and onSaveInstanceState() has already been called. Fragment transactions are not // allowed after that anymore. It's probably safe to guess that the user might not // be interested in adding to homescreen now. } - SwallowedException:BrowserFragment.kt$BrowserFragment$catch (e: IllegalStateException) { // It can happen that at this point in time the activity is already in the background // and onSaveInstanceState() has already been called. Fragment transactions are not // allowed after that anymore. } - SwallowedException:BrowserFragment.kt$BrowserFragment$catch (e: PendingIntent.CanceledException) { // There's really nothing we can do here... } - SwallowedException:IntentUtils.kt$IntentUtils$catch (e: URISyntaxException) { return false } - SwallowedException:LocalizedContent.kt$LocalizedContent$catch (e: PackageManager.NameNotFoundException) { // Nothing to do if we can't find the package name. } - SwallowedException:ManualAddSearchEngineSettingsFragment.kt$ManualAddSearchEngineSettingsFragment.Companion$catch (e: IOException) { Log.d(LOGTAG, "Failure to get response code from server: returning invalid search query") false } - SwallowedException:MobileMetricsPingStorage.kt$MobileMetricsPingStorage$catch (e: FileNotFoundException) { null } - SwallowedException:MobileMetricsPingStorage.kt$MobileMetricsPingStorage$catch (e: IOException) { atomicFile.failWrite(stream) } - SwallowedException:MobileMetricsPingStorage.kt$MobileMetricsPingStorage$catch (e: JSONException) { null } - SwallowedException:SearchEngineWriter.kt$SearchEngineWriter.Companion$catch (e: TransformerConfigurationException) { return null } - SwallowedException:SearchEngineWriter.kt$SearchEngineWriter.Companion$catch (e: TransformerException) { return null } - SwallowedException:SearchSuggestionsFetcher.kt$SearchSuggestionsFetcher$catch (ex: SearchSuggestionClient.FetchException) { listOf<String>() } - SwallowedException:SearchSuggestionsFetcher.kt$SearchSuggestionsFetcher$catch (ex: SearchSuggestionClient.ResponseParserException) { listOf<String>() } - SwallowedException:SupportUtils.kt$SupportUtils$catch (e: ActivityNotFoundException) { // In some cases, a matching Activity may not exist (according to the Android docs). openDefaultBrowserSumoPage(context) } - UnusedPrivateMember:CustomTabTest.kt$CustomTabTest$private val TEST_PAGE_HEADER_ID = "header" - UnusedPrivateMember:CustomTabTest.kt$CustomTabTest$private val TEST_PAGE_HEADER_TEXT = "focus test page" - UnusedPrivateMember:URLAutocompleteTest.kt$URLAutocompleteTest$// From API 23 and below private val CustomURLRow_old = Espresso.onData(Matchers.anything()) .inAdapterView( AllOf.allOf( ViewMatchers.withId(android.R.id.list), childAtPosition( ViewMatchers.withClassName(Matchers.`is`("android.widget.LinearLayout")), 0 ) ) ) .atPosition(4) - UnusedPrivateMember:URLAutocompleteTest.kt$URLAutocompleteTest$// From API 24 and above private val CustomURLRow = Espresso.onData(Matchers.anything()) .inAdapterView( AllOf.allOf( ViewMatchers.withId(android.R.id.list), childAtPosition( ViewMatchers.withId(android.R.id.list_container), 0 ) ) ) .atPosition(4) - UnusedPrivateMember:URLAutocompleteTest.kt$URLAutocompleteTest$private fun toggleTopsiteAC() - UnusedPrivateMember:WhatsNewTest.kt$WhatsNewTest$i - UtilityClassWithPublicConstructor:Features.kt$Features - UtilityClassWithPublicConstructor:FileUtils.kt$FileUtils - UtilityClassWithPublicConstructor:IconGenerator.kt$IconGenerator - UtilityClassWithPublicConstructor:SearchEngineWriter.kt$SearchEngineWriter