diff --git a/build.gradle b/build.gradle index 6ca271f71..7b9f7dc3c 100644 --- a/build.gradle +++ b/build.gradle @@ -72,7 +72,7 @@ buildscript { } plugins { - id("io.gitlab.arturbosch.detekt").version("1.6.0") + id("io.gitlab.arturbosch.detekt").version("1.9.1") } allprojects { @@ -133,8 +133,7 @@ allprojects { kotlinOptions.jvmTarget = "1.8" kotlinOptions.allWarningsAsErrors = true kotlinOptions.freeCompilerArgs += [ - "-Xuse-experimental=kotlin.Experimental", - "-Xskip-runtime-version-check" + "-Xuse-experimental=kotlin.Experimental" ] } } @@ -145,9 +144,10 @@ task clean(type: Delete) { detekt { // The version number is duplicated, please refer to plugins block for more details - version = "1.6.0" + version = "1.9.1" input = files("$projectDir/app/src") config = files("$projectDir/config/detekt.yml") + baseline = file("$projectDir/config/detekt-baseline.xml") reports { html { diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index 3c2ba184e..4421c1b0a 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -11,7 +11,7 @@ object Versions { const val leanplum = "5.4.0" const val osslicenses_plugin = "0.9.5" const val osslicenses_library = "17.0.0" - const val detekt = "1.6.0" + const val detekt = "1.9.1" const val androidx_appcompat = "1.2.0-rc01" const val androidx_biometric = "1.1.0-alpha01" diff --git a/config/detekt-baseline.xml b/config/detekt-baseline.xml new file mode 100644 index 000000000..0da17efa1 --- /dev/null +++ b/config/detekt-baseline.xml @@ -0,0 +1,50 @@ + + + + + AbsentOrWrongFileLicense:AboutItemViewHolder.kt$org.mozilla.fenix.settings.about.viewholders.AboutItemViewHolder.kt + AbsentOrWrongFileLicense:AccountSettingsFragmentStore.kt$org.mozilla.fenix.settings.account.AccountSettingsFragmentStore.kt + AbsentOrWrongFileLicense:AccountSettingsInteractor.kt$org.mozilla.fenix.settings.account.AccountSettingsInteractor.kt + AbsentOrWrongFileLicense:ButtonTipViewHolder.kt$org.mozilla.fenix.home.tips.ButtonTipViewHolder.kt + AbsentOrWrongFileLicense:CustomTabContextMenuCandidate.kt$org.mozilla.fenix.browser.CustomTabContextMenuCandidate.kt + AbsentOrWrongFileLicense:ExceptionsFragmentStore.kt$org.mozilla.fenix.loginexceptions.ExceptionsFragmentStore.kt + AbsentOrWrongFileLicense:ExceptionsFragmentStore.kt$org.mozilla.fenix.trackingprotectionexceptions.ExceptionsFragmentStore.kt + AbsentOrWrongFileLicense:ExceptionsInteractor.kt$org.mozilla.fenix.trackingprotectionexceptions.ExceptionsInteractor.kt + AbsentOrWrongFileLicense:FeatureFlags.kt$org.mozilla.fenix.FeatureFlags.kt + AbsentOrWrongFileLicense:HistoryController.kt$org.mozilla.fenix.library.history.HistoryController.kt + AbsentOrWrongFileLicense:HistoryFragmentStore.kt$org.mozilla.fenix.library.history.HistoryFragmentStore.kt + AbsentOrWrongFileLicense:HistoryInteractor.kt$org.mozilla.fenix.library.history.HistoryInteractor.kt + AbsentOrWrongFileLicense:InflationAwareFeature.kt$org.mozilla.fenix.components.InflationAwareFeature.kt + AbsentOrWrongFileLicense:LoginExceptionsInteractor.kt$org.mozilla.fenix.loginexceptions.LoginExceptionsInteractor.kt + AbsentOrWrongFileLicense:MigrationTelemetryListener.kt$org.mozilla.fenix.migration.MigrationTelemetryListener.kt + AbsentOrWrongFileLicense:Push.kt$org.mozilla.fenix.components.Push.kt + AbsentOrWrongFileLicense:SearchController.kt$org.mozilla.fenix.search.SearchController.kt + AbsentOrWrongFileLicense:SearchFragmentStore.kt$org.mozilla.fenix.search.SearchFragmentStore.kt + AbsentOrWrongFileLicense:SharedPreferenceUpdater.kt$org.mozilla.fenix.settings.SharedPreferenceUpdater.kt + AbsentOrWrongFileLicense:StoreProvider.kt$org.mozilla.fenix.components.StoreProvider.kt + AbsentOrWrongFileLicense:TabCounterMenuItem.kt$org.mozilla.fenix.components.toolbar.TabCounterMenuItem.kt + AbsentOrWrongFileLicense:ToolbarView.kt$org.mozilla.fenix.search.toolbar.ToolbarView.kt + AbsentOrWrongFileLicense:TrackingProtectionStore.kt$org.mozilla.fenix.trackingprotection.TrackingProtectionStore.kt + AbsentOrWrongFileLicense:ViewHolder.kt$org.mozilla.fenix.utils.view.ViewHolder.kt + AbsentOrWrongFileLicense:WhatsNew.kt$org.mozilla.fenix.whatsnew.WhatsNew.kt + AbsentOrWrongFileLicense:WhatsNewStorage.kt$org.mozilla.fenix.whatsnew.WhatsNewStorage.kt + AbsentOrWrongFileLicense:WhatsNewVersion.kt$org.mozilla.fenix.whatsnew.WhatsNewVersion.kt + LongParameterList:BackgroundServices.kt$BackgroundServices$( private val context: Context, private val push: Push, crashReporter: CrashReporter, historyStorage: Lazy<PlacesHistoryStorage>, bookmarkStorage: Lazy<PlacesBookmarksStorage>, passwordsStorage: Lazy<SyncableLoginsStorage>, remoteTabsStorage: Lazy<RemoteTabsStorage> ) + LongParameterList:BookmarkController.kt$DefaultBookmarkController$( private val activity: HomeActivity, private val navController: NavController, private val clipboardManager: ClipboardManager?, private val scope: CoroutineScope, private val store: BookmarkFragmentStore, private val sharedViewModel: BookmarksSharedViewModel, private val loadBookmarkNode: suspend (String) -> BookmarkNode?, private val showSnackbar: (String) -> Unit, private val deleteBookmarkNodes: (Set<BookmarkNode>, Event) -> Unit, private val deleteBookmarkFolder: (BookmarkNode) -> Unit, private val invokePendingDeletion: () -> Unit ) + LongParameterList:BrowserToolbarController.kt$DefaultBrowserToolbarController$( private val activity: HomeActivity, private val navController: NavController, private val readerModeController: ReaderModeController, private val sessionFeature: ViewBoundFeatureWrapper<SessionFeature>, private val sessionManager: SessionManager, private val findInPageLauncher: () -> Unit, private val engineView: EngineView, private val browserAnimator: BrowserAnimator, private val swipeRefresh: SwipeRefreshLayout, private val customTabSession: Session?, private val openInFenixIntent: Intent, private val bookmarkTapped: (Session) -> Unit, private val scope: CoroutineScope, private val tabCollectionStorage: TabCollectionStorage, private val topSiteStorage: TopSiteStorage, private val onTabCounterClicked: () -> Unit, private val onCloseTab: (Session) -> Unit ) + LongParameterList:CollectionCreationController.kt$DefaultCollectionCreationController$( private val store: CollectionCreationStore, private val dismiss: () -> Unit, private val metrics: MetricController, private val tabCollectionStorage: TabCollectionStorage, private val sessionManager: SessionManager, private val ioScope: CoroutineScope ) + LongParameterList:CollectionCreationTabListAdapter.kt$TabDiffUtil$( val old: List<Tab>, val new: List<Tab>, val oldSelected: Set<Tab>, val newSelected: Set<Tab>, val oldHideCheckboxes: Boolean, val newHideCheckboxes: Boolean ) + LongParameterList:CustomTabsIntegration.kt$CustomTabsIntegration$( sessionManager: SessionManager, toolbar: BrowserToolbar, sessionId: String, activity: Activity, onItemTapped: (ToolbarMenu.Item) -> Unit = {}, shouldReverseItems: Boolean, isPrivate: Boolean ) + LongParameterList:DefaultToolbarMenu.kt$DefaultToolbarMenu$( private val context: Context, private val sessionManager: SessionManager, private val store: BrowserStore, hasAccountProblem: Boolean = false, shouldReverseItems: Boolean, private val onItemTapped: (ToolbarMenu.Item) -> Unit = {}, private val lifecycleOwner: LifecycleOwner, private val bookmarksStorage: BookmarksStorage ) + LongParameterList:DynamicDownloadDialog.kt$DynamicDownloadDialog$( private val container: ViewGroup, private val downloadState: DownloadState?, private val didFail: Boolean, private val tryAgain: (Long) -> Unit, private val onCannotOpenFile: () -> Unit, private val view: View, private val toolbarHeight: Int, private val onDismiss: () -> Unit ) + LongParameterList:HistoryController.kt$DefaultHistoryController$( private val store: HistoryFragmentStore, private val navController: NavController, private val resources: Resources, private val snackbar: FenixSnackbar, private val clipboardManager: ClipboardManager, private val scope: CoroutineScope, private val openToBrowser: (item: HistoryItem, mode: BrowsingMode?) -> Unit, private val displayDeleteAll: () -> Unit, private val invalidateOptionsMenu: () -> Unit, private val deleteHistoryItems: (Set<HistoryItem>) -> Unit, private val syncHistory: suspend () -> Unit ) + LongParameterList:IntentProcessors.kt$IntentProcessors$( private val context: Context, private val sessionManager: SessionManager, private val sessionUseCases: SessionUseCases, private val searchUseCases: SearchUseCases, private val relationChecker: RelationChecker, private val customTabsStore: CustomTabsServiceStore, private val migrationStore: MigrationStore, private val manifestStorage: ManifestStorage ) + LongParameterList:QuickSettingsController.kt$DefaultQuickSettingsController$( private val context: Context, private val quickSettingsStore: QuickSettingsFragmentStore, private val ioScope: CoroutineScope, private val navController: NavController, private val session: Session?, private var sitePermissions: SitePermissions?, private val settings: Settings, private val permissionStorage: PermissionStorage, private val reload: ReloadUrlUseCase, private val addNewTab: AddNewTabUseCase, private val requestRuntimePermissions: OnNeedToRequestPermissions = { }, private val displayPermissions: () -> Unit, private val dismiss: () -> Unit ) + LongParameterList:SessionControlController.kt$DefaultSessionControlController$( private val activity: HomeActivity, private val fragmentStore: HomeFragmentStore, private val navController: NavController, private val viewLifecycleScope: CoroutineScope, private val getListOfTabs: () -> List<Tab>, private val hideOnboarding: () -> Unit, private val registerCollectionStorageObserver: () -> Unit, private val showDeleteCollectionPrompt: (tabCollection: TabCollection, title: String?, message: String) -> Unit, private val openSettingsScreen: () -> Unit, private val openWhatsNewLink: () -> Unit, private val openPrivacyNotice: () -> Unit, private val showTabTray: () -> Unit ) + LongParameterList:ShareController.kt$DefaultShareController$( private val context: Context, private val shareData: List<ShareData>, private val sendTabUseCases: SendTabUseCases, private val snackbar: FenixSnackbar, private val navController: NavController, private val recentAppsStorage: RecentAppsStorage, private val viewLifecycleScope: CoroutineScope, private val dismiss: (ShareController.Result) -> Unit ) + LongParameterList:ToolbarIntegration.kt$DefaultToolbarIntegration$( context: Context, toolbar: BrowserToolbar, toolbarMenu: ToolbarMenu, domainAutocompleteProvider: DomainAutocompleteProvider, historyStorage: HistoryStorage, sessionManager: SessionManager, sessionId: String? = null, isPrivate: Boolean, interactor: BrowserToolbarViewInteractor, engine: Engine ) + LongParameterList:ToolbarIntegration.kt$ToolbarIntegration$( context: Context, toolbar: BrowserToolbar, toolbarMenu: ToolbarMenu, sessionId: String?, isPrivate: Boolean, renderStyle: ToolbarFeature.RenderStyle ) + LongParameterList:ToolbarView.kt$ToolbarView$( private val context: Context, private val interactor: ToolbarInteractor, private val historyStorage: HistoryStorage?, private val isPrivate: Boolean, val view: BrowserToolbar, engine: Engine ) + LongParameterList:UseCases.kt$UseCases$( private val context: Context, private val engine: Engine, private val sessionManager: SessionManager, private val store: BrowserStore, private val searchEngineManager: SearchEngineManager, private val shortcutManager: WebAppShortcutManager ) + + diff --git a/config/detekt.yml b/config/detekt.yml index 99697f9c5..c8a649a28 100644 --- a/config/detekt.yml +++ b/config/detekt.yml @@ -23,10 +23,6 @@ console-reports: # - 'NotificationReport' # - 'FindingsReport' # - 'BuildFailureReport' - -console-reports: - active: true - exclude: # - 'HtmlOutputReport' - 'PlainOutputReport' - 'XmlOutputReport' @@ -34,6 +30,8 @@ console-reports: comments: active: true excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**" + AbsentOrWrongFileLicense: + active: true CommentOverPrivateFunction: active: false CommentOverPrivateProperty: diff --git a/config/license.template b/config/license.template new file mode 100644 index 000000000..e0032240a --- /dev/null +++ b/config/license.template @@ -0,0 +1,3 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */