For #4326 - Updates codebase to support latest version of detekt
parent
e601fe7c9f
commit
68f5d211d3
|
@ -145,7 +145,7 @@ abstract class BaseBrowserFragment : Fragment(), BackHandler, SessionManager.Obs
|
||||||
browserInitialized = initializeUI(view) != null
|
browserInitialized = initializeUI(view) != null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("ComplexMethod")
|
@Suppress("ComplexMethod", "LongMethod")
|
||||||
@CallSuper
|
@CallSuper
|
||||||
protected open fun initializeUI(view: View): Session? {
|
protected open fun initializeUI(view: View): Session? {
|
||||||
val sessionManager = requireComponents.core.sessionManager
|
val sessionManager = requireComponents.core.sessionManager
|
||||||
|
|
|
@ -56,7 +56,7 @@ import org.mozilla.fenix.quickactionsheet.QuickActionSheetView
|
||||||
*/
|
*/
|
||||||
@ObsoleteCoroutinesApi
|
@ObsoleteCoroutinesApi
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
@Suppress("TooManyFunctions")
|
@Suppress("TooManyFunctions", "LargeClass")
|
||||||
class BrowserFragment : BaseBrowserFragment(), BackHandler {
|
class BrowserFragment : BaseBrowserFragment(), BackHandler {
|
||||||
private lateinit var quickActionSheetView: QuickActionSheetView
|
private lateinit var quickActionSheetView: QuickActionSheetView
|
||||||
private var quickActionSheetSessionObserver: QuickActionSheetSessionObserver? = null
|
private var quickActionSheetSessionObserver: QuickActionSheetSessionObserver? = null
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.mozilla.fenix.home.sessioncontrol.Tab
|
||||||
import org.mozilla.fenix.home.sessioncontrol.TabCollection
|
import org.mozilla.fenix.home.sessioncontrol.TabCollection
|
||||||
import org.mozilla.fenix.mvi.UIView
|
import org.mozilla.fenix.mvi.UIView
|
||||||
|
|
||||||
|
@SuppressWarnings("LargeClass")
|
||||||
class CollectionCreationUIView(
|
class CollectionCreationUIView(
|
||||||
container: ViewGroup,
|
container: ViewGroup,
|
||||||
actionEmitter: Observer<CollectionCreationAction>,
|
actionEmitter: Observer<CollectionCreationAction>,
|
||||||
|
@ -104,7 +105,7 @@ class CollectionCreationUIView(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("ComplexMethod")
|
@Suppress("ComplexMethod", "LongMethod")
|
||||||
override fun updateView() = Consumer<CollectionCreationState> {
|
override fun updateView() = Consumer<CollectionCreationState> {
|
||||||
step = it.saveCollectionStep
|
step = it.saveCollectionStep
|
||||||
selectedTabs = it.selectedTabs
|
selectedTabs = it.selectedTabs
|
||||||
|
@ -231,17 +232,16 @@ class CollectionCreationUIView(
|
||||||
}, TRANSITION_DURATION)
|
}, TRANSITION_DURATION)
|
||||||
}
|
}
|
||||||
transition.addListener(object : Transition.TransitionListener {
|
transition.addListener(object : Transition.TransitionListener {
|
||||||
override fun onTransitionStart(transition: Transition) {
|
override fun onTransitionStart(transition: Transition) { /* noop */ }
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTransitionEnd(transition: Transition) {
|
override fun onTransitionEnd(transition: Transition) {
|
||||||
view.name_collection_edittext.showKeyboard()
|
view.name_collection_edittext.showKeyboard()
|
||||||
transition.removeListener(this)
|
transition.removeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTransitionCancel(transition: Transition) {}
|
override fun onTransitionCancel(transition: Transition) { /* noop */ }
|
||||||
override fun onTransitionPause(transition: Transition) {}
|
override fun onTransitionPause(transition: Transition) { /* noop */ }
|
||||||
override fun onTransitionResume(transition: Transition) {}
|
override fun onTransitionResume(transition: Transition) { /* noop */ }
|
||||||
})
|
})
|
||||||
TransitionManager.beginDelayedTransition(
|
TransitionManager.beginDelayedTransition(
|
||||||
view.collection_constraint_layout,
|
view.collection_constraint_layout,
|
||||||
|
@ -289,17 +289,16 @@ class CollectionCreationUIView(
|
||||||
}, TRANSITION_DURATION)
|
}, TRANSITION_DURATION)
|
||||||
}
|
}
|
||||||
transition.addListener(object : Transition.TransitionListener {
|
transition.addListener(object : Transition.TransitionListener {
|
||||||
override fun onTransitionStart(transition: Transition) {
|
override fun onTransitionStart(transition: Transition) { /* noop */ }
|
||||||
}
|
|
||||||
|
|
||||||
override fun onTransitionEnd(transition: Transition) {
|
override fun onTransitionEnd(transition: Transition) {
|
||||||
view.name_collection_edittext.showKeyboard()
|
view.name_collection_edittext.showKeyboard()
|
||||||
transition.removeListener(this)
|
transition.removeListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTransitionCancel(transition: Transition) {}
|
override fun onTransitionCancel(transition: Transition) { /* noop */ }
|
||||||
override fun onTransitionPause(transition: Transition) {}
|
override fun onTransitionPause(transition: Transition) { /* noop */ }
|
||||||
override fun onTransitionResume(transition: Transition) {}
|
override fun onTransitionResume(transition: Transition) { /* noop */ }
|
||||||
})
|
})
|
||||||
TransitionManager.beginDelayedTransition(
|
TransitionManager.beginDelayedTransition(
|
||||||
view.collection_constraint_layout,
|
view.collection_constraint_layout,
|
||||||
|
|
|
@ -45,7 +45,7 @@ class AdjustMetricsService(private val application: Application) : MetricsServic
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're not currently sending events directly to Adjust
|
// We're not currently sending events directly to Adjust
|
||||||
override fun track(event: Event) { }
|
override fun track(event: Event) { /* noop */ }
|
||||||
override fun shouldTrack(event: Event): Boolean = false
|
override fun shouldTrack(event: Event): Boolean = false
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -61,14 +61,14 @@ class AdjustMetricsService(private val application: Application) : MetricsServic
|
||||||
Adjust.onPause()
|
Adjust.onPause()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {}
|
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) { /* noop */ }
|
||||||
|
|
||||||
override fun onActivityStarted(activity: Activity) {}
|
override fun onActivityStarted(activity: Activity) { /* noop */ }
|
||||||
|
|
||||||
override fun onActivityStopped(activity: Activity) {}
|
override fun onActivityStopped(activity: Activity) { /* noop */ }
|
||||||
|
|
||||||
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {}
|
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) { /* noop */ }
|
||||||
|
|
||||||
override fun onActivityDestroyed(activity: Activity) {}
|
override fun onActivityDestroyed(activity: Activity) { /* noop */ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class DefaultBrowserToolbarController(
|
||||||
|
|
||||||
@ExperimentalCoroutinesApi
|
@ExperimentalCoroutinesApi
|
||||||
@ObsoleteCoroutinesApi
|
@ObsoleteCoroutinesApi
|
||||||
@SuppressWarnings("ComplexMethod")
|
@SuppressWarnings("ComplexMethod", "LongMethod")
|
||||||
override fun handleToolbarItemInteraction(item: ToolbarMenu.Item) {
|
override fun handleToolbarItemInteraction(item: ToolbarMenu.Item) {
|
||||||
val sessionUseCases = context.components.useCases.sessionUseCases
|
val sessionUseCases = context.components.useCases.sessionUseCases
|
||||||
trackToolbarItemInteraction(item)
|
trackToolbarItemInteraction(item)
|
||||||
|
|
|
@ -303,7 +303,7 @@ class HomeFragment : Fragment(), AccountObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ComplexMethod")
|
@SuppressWarnings("ComplexMethod", "LongMethod")
|
||||||
private fun handleTabAction(action: TabAction) {
|
private fun handleTabAction(action: TabAction) {
|
||||||
Do exhaustive when (action) {
|
Do exhaustive when (action) {
|
||||||
is TabAction.SaveTabGroup -> {
|
is TabAction.SaveTabGroup -> {
|
||||||
|
@ -423,6 +423,7 @@ class HomeFragment : Fragment(), AccountObserver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("LongMethod")
|
||||||
private fun handleCollectionAction(action: CollectionAction) {
|
private fun handleCollectionAction(action: CollectionAction) {
|
||||||
when (action) {
|
when (action) {
|
||||||
is CollectionAction.Expand -> {
|
is CollectionAction.Expand -> {
|
||||||
|
@ -801,8 +802,8 @@ class HomeFragment : Fragment(), AccountObserver {
|
||||||
border?.visibility = View.GONE
|
border?.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onAnimationStart(animation: Animator?) {}
|
override fun onAnimationStart(animation: Animator?) { /* noop */ }
|
||||||
override fun onAnimationRepeat(animation: Animator?) {}
|
override fun onAnimationRepeat(animation: Animator?) { /* noop */ }
|
||||||
override fun onAnimationEnd(animation: Animator?) {
|
override fun onAnimationEnd(animation: Animator?) {
|
||||||
border?.animate()?.alpha(0.0F)?.setStartDelay(ANIM_ON_SCREEN_DELAY)
|
border?.animate()?.alpha(0.0F)?.setStartDelay(ANIM_ON_SCREEN_DELAY)
|
||||||
?.setDuration(FADE_ANIM_DURATION)
|
?.setDuration(FADE_ANIM_DURATION)
|
||||||
|
|
|
@ -35,7 +35,7 @@ class HistoryDataSource(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun loadBefore(params: LoadParams<Int>, callback: LoadCallback<HistoryItem>) {}
|
override fun loadBefore(params: LoadParams<Int>, callback: LoadCallback<HistoryItem>) { /* noop */ }
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private const val INITIAL_OFFSET = 0L
|
private const val INITIAL_OFFSET = 0L
|
||||||
|
|
|
@ -249,7 +249,7 @@ open class QuickActionSheetBehavior<V : View>(context: Context, attrs: Attribute
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("ComplexCondition")
|
@Suppress("ComplexCondition", "LongMethod")
|
||||||
override fun onViewReleased(releasedChild: View, xvel: Float, yvel: Float) {
|
override fun onViewReleased(releasedChild: View, xvel: Float, yvel: Float) {
|
||||||
val top: Int
|
val top: Int
|
||||||
@State val targetState: Int
|
@State val targetState: Int
|
||||||
|
|
|
@ -58,6 +58,9 @@ detekt {
|
||||||
enabled = true
|
enabled = true
|
||||||
destination = file("$projectDir/build/reports/detekt.html")
|
destination = file("$projectDir/build/reports/detekt.html")
|
||||||
}
|
}
|
||||||
|
xml {
|
||||||
|
enabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,6 @@
|
||||||
autoCorrect: true
|
autoCorrect: true
|
||||||
failFast: false
|
failFast: false
|
||||||
|
|
||||||
test-pattern: # Configure exclusions for test sources
|
|
||||||
active: true
|
|
||||||
patterns: # Test file regexes
|
|
||||||
- '.*/test/.*'
|
|
||||||
- '.*Test.kt'
|
|
||||||
- '.*Spec.kt'
|
|
||||||
exclude-rule-sets:
|
|
||||||
- 'comments'
|
|
||||||
exclude-rules:
|
|
||||||
- 'NamingRules'
|
|
||||||
- 'WildcardImport'
|
|
||||||
- 'MagicNumber'
|
|
||||||
- 'MaxLineLength'
|
|
||||||
- 'LateinitUsage'
|
|
||||||
- 'StringLiteralDuplication'
|
|
||||||
- 'SpreadOperator'
|
|
||||||
- 'TooManyFunctions'
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
maxIssues: 0
|
maxIssues: 0
|
||||||
weights:
|
weights:
|
||||||
|
@ -54,6 +36,7 @@ output-reports:
|
||||||
|
|
||||||
comments:
|
comments:
|
||||||
active: true
|
active: true
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
CommentOverPrivateFunction:
|
CommentOverPrivateFunction:
|
||||||
active: false
|
active: false
|
||||||
CommentOverPrivateProperty:
|
CommentOverPrivateProperty:
|
||||||
|
@ -87,10 +70,16 @@ complexity:
|
||||||
active: false
|
active: false
|
||||||
LargeClass:
|
LargeClass:
|
||||||
active: true
|
active: true
|
||||||
threshold: 150
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
|
# Had to increase the threshold as RC13 started counting lines of code
|
||||||
|
# https://github.com/mozilla-mobile/fenix/issues/4861
|
||||||
|
threshold: 200
|
||||||
LongMethod:
|
LongMethod:
|
||||||
active: true
|
active: true
|
||||||
threshold: 20
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
|
# Had to increase the threshold as RC13 started counting lines of code
|
||||||
|
# https://github.com/mozilla-mobile/fenix/issues/4861
|
||||||
|
threshold: 75
|
||||||
LongParameterList:
|
LongParameterList:
|
||||||
active: true
|
active: true
|
||||||
threshold: 6
|
threshold: 6
|
||||||
|
@ -103,12 +92,14 @@ complexity:
|
||||||
threshold: 4
|
threshold: 4
|
||||||
StringLiteralDuplication:
|
StringLiteralDuplication:
|
||||||
active: false
|
active: false
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
threshold: 3
|
threshold: 3
|
||||||
ignoreAnnotation: true
|
ignoreAnnotation: true
|
||||||
excludeStringsWithLessThan5Characters: true
|
excludeStringsWithLessThan5Characters: true
|
||||||
ignoreStringsRegex: '$^'
|
ignoreStringsRegex: '$^'
|
||||||
TooManyFunctions:
|
TooManyFunctions:
|
||||||
active: true
|
active: true
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
thresholdInFiles: 11
|
thresholdInFiles: 11
|
||||||
thresholdInClasses: 11
|
thresholdInClasses: 11
|
||||||
thresholdInInterfaces: 11
|
thresholdInInterfaces: 11
|
||||||
|
@ -134,6 +125,7 @@ empty-blocks:
|
||||||
active: true
|
active: true
|
||||||
EmptyFunctionBlock:
|
EmptyFunctionBlock:
|
||||||
active: true
|
active: true
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
EmptyIfBlock:
|
EmptyIfBlock:
|
||||||
active: true
|
active: true
|
||||||
EmptyInitBlock:
|
EmptyInitBlock:
|
||||||
|
@ -211,6 +203,7 @@ naming:
|
||||||
minimumFunctionNameLength: 3
|
minimumFunctionNameLength: 3
|
||||||
FunctionNaming:
|
FunctionNaming:
|
||||||
active: true
|
active: true
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
|
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
|
||||||
excludeClassPattern: '$^'
|
excludeClassPattern: '$^'
|
||||||
MatchingDeclarationName:
|
MatchingDeclarationName:
|
||||||
|
@ -247,6 +240,7 @@ performance:
|
||||||
active: true
|
active: true
|
||||||
SpreadOperator:
|
SpreadOperator:
|
||||||
active: true
|
active: true
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
UnnecessaryTemporaryInstantiation:
|
UnnecessaryTemporaryInstantiation:
|
||||||
active: true
|
active: true
|
||||||
|
|
||||||
|
@ -268,6 +262,7 @@ potential-bugs:
|
||||||
active: false
|
active: false
|
||||||
LateinitUsage:
|
LateinitUsage:
|
||||||
active: false
|
active: false
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
excludeAnnotatedProperties: ""
|
excludeAnnotatedProperties: ""
|
||||||
ignoreOnClassesPattern: ""
|
ignoreOnClassesPattern: ""
|
||||||
UnconditionalJumpStatementInLoop:
|
UnconditionalJumpStatementInLoop:
|
||||||
|
@ -309,6 +304,7 @@ style:
|
||||||
maxJumpCount: 1
|
maxJumpCount: 1
|
||||||
MagicNumber:
|
MagicNumber:
|
||||||
active: true
|
active: true
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
ignoreNumbers: '-1,0,1,2'
|
ignoreNumbers: '-1,0,1,2'
|
||||||
ignoreHashCodeFunction: false
|
ignoreHashCodeFunction: false
|
||||||
ignorePropertyDeclaration: false
|
ignorePropertyDeclaration: false
|
||||||
|
@ -319,6 +315,7 @@ style:
|
||||||
ignoreEnums: false
|
ignoreEnums: false
|
||||||
MaxLineLength:
|
MaxLineLength:
|
||||||
active: true
|
active: true
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
maxLineLength: 120
|
maxLineLength: 120
|
||||||
excludePackageStatements: false
|
excludePackageStatements: false
|
||||||
excludeImportStatements: false
|
excludeImportStatements: false
|
||||||
|
@ -376,4 +373,5 @@ style:
|
||||||
active: false
|
active: false
|
||||||
WildcardImport:
|
WildcardImport:
|
||||||
active: true
|
active: true
|
||||||
|
excludes: "**/*Test.kt, **/*Spec.kt, **/test/**, **/androidTest/**"
|
||||||
excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
|
excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
|
||||||
|
|
Loading…
Reference in New Issue