Make ktlint and detekt style changes
parent
99a72fc7f4
commit
b2b6a530d0
|
@ -2,10 +2,12 @@ package org.mozilla.fenix
|
||||||
|
|
||||||
import android.support.test.InstrumentationRegistry
|
import android.support.test.InstrumentationRegistry
|
||||||
import android.support.test.runner.AndroidJUnit4
|
import android.support.test.runner.AndroidJUnit4
|
||||||
|
import androidx.test.InstrumentationRegistry
|
||||||
|
import androidx.test.runner.AndroidJUnit4
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
/* ktlint-disable no-wildcard-imports */
|
||||||
import org.junit.Assert.*
|
import org.junit.Assert.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,4 +24,4 @@ class IntentReceiverActivity : Activity() {
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,8 @@ class BrowserFragment : Fragment() {
|
||||||
private lateinit var sessionFeature: SessionFeature
|
private lateinit var sessionFeature: SessionFeature
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_browser, container, false)
|
return inflater.inflate(R.layout.fragment_browser, container, false)
|
||||||
|
|
|
@ -6,7 +6,6 @@ import mozilla.components.feature.intent.IntentProcessor
|
||||||
import mozilla.components.feature.search.SearchUseCases
|
import mozilla.components.feature.search.SearchUseCases
|
||||||
import mozilla.components.feature.session.SessionUseCases
|
import mozilla.components.feature.session.SessionUseCases
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component group for miscellaneous components.
|
* Component group for miscellaneous components.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -139,4 +139,4 @@ class Toolbar(
|
||||||
private fun openSettingsActivity() {
|
private fun openSettingsActivity() {
|
||||||
// TODO Open Settings
|
// TODO Open Settings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,10 @@ class ToolbarIntegration(
|
||||||
init {
|
init {
|
||||||
toolbar.setMenuBuilder(context.components.toolbar.menuBuilder)
|
toolbar.setMenuBuilder(context.components.toolbar.menuBuilder)
|
||||||
|
|
||||||
toolbar.browserActionMargin = toolbar.resources.pxToDp(8)
|
toolbar.browserActionMargin = toolbar.resources.pxToDp(browserActionMarginDp)
|
||||||
toolbar.textColor = ContextCompat.getColor(context, R.color.searchText)
|
toolbar.textColor = ContextCompat.getColor(context, R.color.searchText)
|
||||||
toolbar.urlBoxView = LayoutInflater.from(context).inflate(R.layout.layout_url_backround, null)
|
toolbar.urlBoxView = LayoutInflater.from(context).inflate(R.layout.layout_url_backround, null)
|
||||||
toolbar.urlBoxMargin = toolbar.resources.pxToDp(8)
|
toolbar.urlBoxMargin = toolbar.resources.pxToDp(urlBoxMargin)
|
||||||
|
|
||||||
val home = BrowserToolbar.Button(
|
val home = BrowserToolbar.Button(
|
||||||
context.resources.getDrawable(
|
context.resources.getDrawable(
|
||||||
|
@ -81,4 +81,9 @@ class ToolbarIntegration(
|
||||||
fun stop() {
|
fun stop() {
|
||||||
toolbarFeature.stop()
|
toolbarFeature.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val browserActionMarginDp = 8
|
||||||
|
const val urlBoxMargin = 8
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,10 @@ package org.mozilla.fenix.ext
|
||||||
import android.content.ActivityNotFoundException
|
import android.content.ActivityNotFoundException
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.Intent.*
|
import android.content.Intent.ACTION_SEND
|
||||||
|
import android.content.Intent.EXTRA_SUBJECT
|
||||||
|
import android.content.Intent.EXTRA_TEXT
|
||||||
|
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import mozilla.components.support.base.log.Log
|
import mozilla.components.support.base.log.Log
|
||||||
import mozilla.components.support.base.log.Log.Priority.WARN
|
import mozilla.components.support.base.log.Log.Priority.WARN
|
||||||
|
|
|
@ -10,4 +10,4 @@ import org.mozilla.fenix.components.Components
|
||||||
* Get the requireComponents of this application.
|
* Get the requireComponents of this application.
|
||||||
*/
|
*/
|
||||||
val androidx.fragment.app.Fragment.requireComponents: Components
|
val androidx.fragment.app.Fragment.requireComponents: Components
|
||||||
get() = requireContext().components
|
get() = requireContext().components
|
||||||
|
|
|
@ -7,14 +7,11 @@ package org.mozilla.fenix.home
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.transition.TransitionInflater
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.view.ViewCompat
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.navigation.Navigation
|
import androidx.navigation.Navigation
|
||||||
import androidx.navigation.fragment.FragmentNavigator
|
|
||||||
import kotlinx.android.synthetic.main.fragment_home.*
|
import kotlinx.android.synthetic.main.fragment_home.*
|
||||||
import kotlinx.android.synthetic.main.fragment_home.view.*
|
import kotlinx.android.synthetic.main.fragment_home.view.*
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
|
@ -26,7 +23,8 @@ import kotlin.math.roundToInt
|
||||||
|
|
||||||
class HomeFragment : Fragment() {
|
class HomeFragment : Fragment() {
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
val view = inflater.inflate(R.layout.fragment_home, container, false)
|
val view = inflater.inflate(R.layout.fragment_home, container, false)
|
||||||
|
@ -42,10 +40,15 @@ class HomeFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbar.setCompoundDrawablesWithIntrinsicBounds(searchIcon, null, null, null)
|
toolbar.setCompoundDrawablesWithIntrinsicBounds(searchIcon, null, null, null)
|
||||||
toolbar.compoundDrawablePadding = (12f * Resources.getSystem().displayMetrics.density).roundToInt()
|
val roundToInt = (toolbarPaddingDp * Resources.getSystem().displayMetrics.density).roundToInt()
|
||||||
|
toolbar.compoundDrawablePadding = roundToInt
|
||||||
toolbar.setOnClickListener { it ->
|
toolbar.setOnClickListener { it ->
|
||||||
Navigation.findNavController(it).navigate(R.id.action_homeFragment_to_searchFragment, null, null)
|
Navigation.findNavController(it).navigate(R.id.action_homeFragment_to_searchFragment, null, null)
|
||||||
}
|
}
|
||||||
layoutComponents(homeLayout)
|
layoutComponents(homeLayout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val toolbarPaddingDp = 12f
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,21 +20,25 @@ class SearchView(context: Context, attrs: AttributeSet) : FrameLayout(context, a
|
||||||
|
|
||||||
fun transitionToLight() {
|
fun transitionToLight() {
|
||||||
background = lightToDark
|
background = lightToDark
|
||||||
lightToDark.reverseTransition(500)
|
lightToDark.reverseTransition(transitionDurationMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun transitionToDark() {
|
fun transitionToDark() {
|
||||||
background = lightToDark
|
background = lightToDark
|
||||||
lightToDark.startTransition(500)
|
lightToDark.startTransition(transitionDurationMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun transitionToDarkFromNoBorder() {
|
fun transitionToDarkFromNoBorder() {
|
||||||
background = darkToNoBorder
|
background = darkToNoBorder
|
||||||
darkToNoBorder.reverseTransition(500)
|
darkToNoBorder.reverseTransition(transitionDurationMs)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun transitionToDarkNoBorder() {
|
fun transitionToDarkNoBorder() {
|
||||||
background = darkToNoBorder
|
background = darkToNoBorder
|
||||||
darkToNoBorder.startTransition(500)
|
darkToNoBorder.startTransition(transitionDurationMs)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
companion object {
|
||||||
|
const val transitionDurationMs = 500
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -11,12 +11,11 @@ import android.widget.TextView
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import org.mozilla.fenix.R
|
import org.mozilla.fenix.R
|
||||||
|
|
||||||
|
class SessionsAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||||
class SessionsAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||||
val view = LayoutInflater.from(parent.context).inflate(viewType, parent, false)
|
val view = LayoutInflater.from(parent.context).inflate(viewType, parent, false)
|
||||||
|
|
||||||
return when(viewType) {
|
return when (viewType) {
|
||||||
HeaderViewHolder.LAYOUT_ID -> HeaderViewHolder(view)
|
HeaderViewHolder.LAYOUT_ID -> HeaderViewHolder(view)
|
||||||
EmptyListViewHolder.LAYOUT_ID -> EmptyListViewHolder(view)
|
EmptyListViewHolder.LAYOUT_ID -> EmptyListViewHolder(view)
|
||||||
else -> EmptyListViewHolder(view)
|
else -> EmptyListViewHolder(view)
|
||||||
|
@ -37,7 +36,7 @@ class SessionsAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class HeaderViewHolder(private val view: View): RecyclerView.ViewHolder(view) {
|
private class HeaderViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||||
val headerText = view.findViewById<TextView>(R.id.header_text)
|
val headerText = view.findViewById<TextView>(R.id.header_text)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -45,7 +44,7 @@ class SessionsAdapter() : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class EmptyListViewHolder(private val view: View): RecyclerView.ViewHolder(view) {
|
private class EmptyListViewHolder(private val view: View) : RecyclerView.ViewHolder(view) {
|
||||||
companion object {
|
companion object {
|
||||||
const val LAYOUT_ID = R.layout.session_list_empty
|
const val LAYOUT_ID = R.layout.session_list_empty
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,18 @@ package org.mozilla.fenix.home.sessions
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import mozilla.components.browser.session.Session
|
import mozilla.components.browser.session.Session
|
||||||
import org.mozilla.fenix.mvi.*
|
import org.mozilla.fenix.mvi.Action
|
||||||
|
import org.mozilla.fenix.mvi.ActionBusFactory
|
||||||
|
import org.mozilla.fenix.mvi.Change
|
||||||
|
import org.mozilla.fenix.mvi.UIComponent
|
||||||
|
import org.mozilla.fenix.mvi.ViewState
|
||||||
|
|
||||||
class SessionsComponent(private val container: ViewGroup, override val bus: ActionBusFactory) :
|
class SessionsComponent(private val container: ViewGroup, override val bus: ActionBusFactory) :
|
||||||
UIComponent<SessionsState, SessionsAction, SessionsChange>(bus) {
|
UIComponent<SessionsState, SessionsAction, SessionsChange>(bus) {
|
||||||
|
|
||||||
override var initialState: SessionsState = SessionsState(emptyList())
|
override var initialState: SessionsState = SessionsState(emptyList())
|
||||||
|
|
||||||
override val reducer : (SessionsState, SessionsChange) -> SessionsState = { state, change ->
|
override val reducer: (SessionsState, SessionsChange) -> SessionsState = { state, change ->
|
||||||
when (change) {
|
when (change) {
|
||||||
is SessionsChange.SessionsChanged -> state // copy state with changes here
|
is SessionsChange.SessionsChanged -> state // copy state with changes here
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,10 @@ import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID
|
import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID
|
||||||
import kotlinx.android.synthetic.main.component_sessions.*
|
import kotlinx.android.synthetic.main.component_sessions.*
|
||||||
import kotlinx.android.synthetic.main.fragment_home.*
|
import kotlinx.android.synthetic.main.fragment_home.*
|
||||||
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.*
|
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.TOP
|
||||||
|
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.BOTTOM
|
||||||
|
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.START
|
||||||
|
import org.jetbrains.anko.constraint.layout.ConstraintSetBuilder.Side.END
|
||||||
import org.jetbrains.anko.constraint.layout.applyConstraintSet
|
import org.jetbrains.anko.constraint.layout.applyConstraintSet
|
||||||
import org.mozilla.fenix.home.HomeFragment
|
import org.mozilla.fenix.home.HomeFragment
|
||||||
|
|
||||||
|
@ -19,4 +22,4 @@ fun HomeFragment.layoutComponents(layout: ConstraintLayout) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,5 @@ class SessionsUIView(container: ViewGroup, bus: ActionBusFactory) :
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun updateView() = Consumer<SessionsState> {
|
override fun updateView() = Consumer<SessionsState> {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,4 +154,3 @@ inline fun LifecycleOwner?.createDestroyObservable(): Observable<Unit> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,19 @@ import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.Disposable
|
import io.reactivex.disposables.Disposable
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
abstract class UIComponent<S: ViewState, A: Action, C: Change>(open val bus: ActionBusFactory) {
|
abstract class UIComponent<S : ViewState, A : Action, C : Change>(open val bus: ActionBusFactory) {
|
||||||
abstract var initialState: S
|
abstract var initialState: S
|
||||||
abstract val reducer: Reducer<S, C>
|
abstract val reducer: Reducer<S, C>
|
||||||
val uiView: UIView<S> by lazy { initView() }
|
val uiView: UIView<S> by lazy { initView() }
|
||||||
|
|
||||||
abstract fun initView(): UIView<S>
|
abstract fun initView(): UIView<S>
|
||||||
open fun getContainerId() = uiView.containerId
|
open fun getContainerId() = uiView.containerId
|
||||||
inline fun <reified A: Action> getUserInteractionEvents(): Observable<A> = bus.getSafeManagedObservable(A::class.java)
|
|
||||||
inline fun <reified C: Change> getModelChangeEvents(): Observable<C> = bus.getSafeManagedObservable(C::class.java)
|
inline fun <reified A : Action> getUserInteractionEvents():
|
||||||
|
Observable<A> = bus.getSafeManagedObservable(A::class.java)
|
||||||
|
|
||||||
|
inline fun <reified C : Change> getModelChangeEvents():
|
||||||
|
Observable<C> = bus.getSafeManagedObservable(C::class.java)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render the ViewState to the View through the Reducer
|
* Render the ViewState to the View through the Reducer
|
||||||
|
|
|
@ -11,7 +11,8 @@ import io.reactivex.functions.Consumer
|
||||||
import kotlinx.android.extensions.LayoutContainer
|
import kotlinx.android.extensions.LayoutContainer
|
||||||
|
|
||||||
abstract class UIView<S : ViewState>(
|
abstract class UIView<S : ViewState>(
|
||||||
private val container: ViewGroup, val bus: ActionBusFactory
|
private val container: ViewGroup,
|
||||||
|
val bus: ActionBusFactory
|
||||||
) : LayoutContainer {
|
) : LayoutContainer {
|
||||||
|
|
||||||
abstract val view: View
|
abstract val view: View
|
||||||
|
|
|
@ -4,15 +4,12 @@
|
||||||
package org.mozilla.fenix.search
|
package org.mozilla.fenix.search
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.transition.TransitionInflater
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.ViewCompat
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.navigation.Navigation
|
import androidx.navigation.Navigation
|
||||||
import androidx.navigation.fragment.FragmentNavigator
|
|
||||||
import kotlinx.android.synthetic.main.fragment_search.*
|
import kotlinx.android.synthetic.main.fragment_search.*
|
||||||
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider
|
||||||
import mozilla.components.feature.awesomebar.AwesomeBarFeature
|
import mozilla.components.feature.awesomebar.AwesomeBarFeature
|
||||||
|
@ -25,7 +22,8 @@ class SearchFragment : Fragment() {
|
||||||
private lateinit var awesomeBarFeature: AwesomeBarFeature
|
private lateinit var awesomeBarFeature: AwesomeBarFeature
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater,
|
||||||
|
container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View? {
|
): View? {
|
||||||
return inflater.inflate(R.layout.fragment_search, container, false)
|
return inflater.inflate(R.layout.fragment_search, container, false)
|
||||||
|
@ -58,11 +56,10 @@ class SearchFragment : Fragment() {
|
||||||
requireComponents.core.sessionManager,
|
requireComponents.core.sessionManager,
|
||||||
requireComponents.useCases.tabsUseCases.selectTab)
|
requireComponents.useCases.tabsUseCases.selectTab)
|
||||||
|
|
||||||
|
|
||||||
toolbar_wrapper.clipToOutline = false
|
toolbar_wrapper.clipToOutline = false
|
||||||
toolbar.apply {
|
toolbar.apply {
|
||||||
textColor = ContextCompat.getColor(context, R.color.searchText)
|
textColor = ContextCompat.getColor(context, R.color.searchText)
|
||||||
textSize = 14f
|
textSize = toolbarTextSizeSp
|
||||||
hint = context.getString(R.string.search_hint)
|
hint = context.getString(R.string.search_hint)
|
||||||
hintColor = ContextCompat.getColor(context, R.color.searchText)
|
hintColor = ContextCompat.getColor(context, R.color.searchText)
|
||||||
}
|
}
|
||||||
|
@ -71,4 +68,8 @@ class SearchFragment : Fragment() {
|
||||||
private fun userDidSearch() {
|
private fun userDidSearch() {
|
||||||
Navigation.findNavController(toolbar).navigate(R.id.action_searchFragment_to_browserFragment, null, null)
|
Navigation.findNavController(toolbar).navigate(R.id.action_searchFragment_to_browserFragment, null, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val toolbarTextSizeSp = 14f
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.mozilla.fenix
|
package org.mozilla.fenix
|
||||||
|
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
|
/* ktlint-disable no-wildcard-imports */
|
||||||
import org.junit.Assert.*
|
import org.junit.Assert.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -0,0 +1,379 @@
|
||||||
|
autoCorrect: true
|
||||||
|
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:
|
||||||
|
maxIssues: 0
|
||||||
|
weights:
|
||||||
|
# complexity: 2
|
||||||
|
# LongParameterList: 1
|
||||||
|
# style: 1
|
||||||
|
# comments: 1
|
||||||
|
|
||||||
|
processors:
|
||||||
|
active: true
|
||||||
|
exclude:
|
||||||
|
# - 'FunctionCountProcessor'
|
||||||
|
# - 'PropertyCountProcessor'
|
||||||
|
# - 'ClassCountProcessor'
|
||||||
|
# - 'PackageCountProcessor'
|
||||||
|
# - 'KtFileCountProcessor'
|
||||||
|
|
||||||
|
console-reports:
|
||||||
|
active: true
|
||||||
|
exclude:
|
||||||
|
# - 'ProjectStatisticsReport'
|
||||||
|
# - 'ComplexityReport'
|
||||||
|
# - 'NotificationReport'
|
||||||
|
# - 'FindingsReport'
|
||||||
|
# - 'BuildFailureReport'
|
||||||
|
|
||||||
|
output-reports:
|
||||||
|
active: true
|
||||||
|
exclude:
|
||||||
|
# - 'HtmlOutputReport'
|
||||||
|
- 'PlainOutputReport'
|
||||||
|
- 'XmlOutputReport'
|
||||||
|
|
||||||
|
comments:
|
||||||
|
active: true
|
||||||
|
CommentOverPrivateFunction:
|
||||||
|
active: false
|
||||||
|
CommentOverPrivateProperty:
|
||||||
|
active: false
|
||||||
|
EndOfSentenceFormat:
|
||||||
|
active: false
|
||||||
|
endOfSentenceFormat: ([.?!][ \t\n\r\f<])|([.?!]$)
|
||||||
|
UndocumentedPublicClass:
|
||||||
|
active: false
|
||||||
|
searchInNestedClass: true
|
||||||
|
searchInInnerClass: true
|
||||||
|
searchInInnerObject: true
|
||||||
|
searchInInnerInterface: true
|
||||||
|
UndocumentedPublicFunction:
|
||||||
|
active: false
|
||||||
|
|
||||||
|
complexity:
|
||||||
|
active: true
|
||||||
|
ComplexCondition:
|
||||||
|
active: true
|
||||||
|
threshold: 4
|
||||||
|
ComplexInterface:
|
||||||
|
active: false
|
||||||
|
threshold: 10
|
||||||
|
includeStaticDeclarations: false
|
||||||
|
ComplexMethod:
|
||||||
|
active: true
|
||||||
|
threshold: 10
|
||||||
|
ignoreSingleWhenExpression: false
|
||||||
|
LabeledExpression:
|
||||||
|
active: false
|
||||||
|
LargeClass:
|
||||||
|
active: true
|
||||||
|
threshold: 150
|
||||||
|
LongMethod:
|
||||||
|
active: true
|
||||||
|
threshold: 20
|
||||||
|
LongParameterList:
|
||||||
|
active: true
|
||||||
|
threshold: 6
|
||||||
|
ignoreDefaultParameters: false
|
||||||
|
MethodOverloading:
|
||||||
|
active: false
|
||||||
|
threshold: 6
|
||||||
|
NestedBlockDepth:
|
||||||
|
active: true
|
||||||
|
threshold: 4
|
||||||
|
StringLiteralDuplication:
|
||||||
|
active: false
|
||||||
|
threshold: 3
|
||||||
|
ignoreAnnotation: true
|
||||||
|
excludeStringsWithLessThan5Characters: true
|
||||||
|
ignoreStringsRegex: '$^'
|
||||||
|
TooManyFunctions:
|
||||||
|
active: true
|
||||||
|
thresholdInFiles: 11
|
||||||
|
thresholdInClasses: 11
|
||||||
|
thresholdInInterfaces: 11
|
||||||
|
thresholdInObjects: 11
|
||||||
|
thresholdInEnums: 11
|
||||||
|
|
||||||
|
empty-blocks:
|
||||||
|
active: true
|
||||||
|
EmptyCatchBlock:
|
||||||
|
active: true
|
||||||
|
allowedExceptionNameRegex: "^(ignore|expected).*"
|
||||||
|
EmptyClassBlock:
|
||||||
|
active: true
|
||||||
|
EmptyDefaultConstructor:
|
||||||
|
active: true
|
||||||
|
EmptyDoWhileBlock:
|
||||||
|
active: true
|
||||||
|
EmptyElseBlock:
|
||||||
|
active: true
|
||||||
|
EmptyFinallyBlock:
|
||||||
|
active: true
|
||||||
|
EmptyForBlock:
|
||||||
|
active: true
|
||||||
|
EmptyFunctionBlock:
|
||||||
|
active: true
|
||||||
|
EmptyIfBlock:
|
||||||
|
active: true
|
||||||
|
EmptyInitBlock:
|
||||||
|
active: true
|
||||||
|
EmptyKtFile:
|
||||||
|
active: true
|
||||||
|
EmptySecondaryConstructor:
|
||||||
|
active: true
|
||||||
|
EmptyWhenBlock:
|
||||||
|
active: true
|
||||||
|
EmptyWhileBlock:
|
||||||
|
active: true
|
||||||
|
|
||||||
|
exceptions:
|
||||||
|
active: true
|
||||||
|
ExceptionRaisedInUnexpectedLocation:
|
||||||
|
active: false
|
||||||
|
methodNames: 'toString,hashCode,equals,finalize'
|
||||||
|
InstanceOfCheckForException:
|
||||||
|
active: false
|
||||||
|
NotImplementedDeclaration:
|
||||||
|
active: false
|
||||||
|
PrintStackTrace:
|
||||||
|
active: false
|
||||||
|
RethrowCaughtException:
|
||||||
|
active: false
|
||||||
|
ReturnFromFinally:
|
||||||
|
active: false
|
||||||
|
SwallowedException:
|
||||||
|
active: false
|
||||||
|
ThrowingExceptionFromFinally:
|
||||||
|
active: false
|
||||||
|
ThrowingExceptionInMain:
|
||||||
|
active: false
|
||||||
|
ThrowingExceptionsWithoutMessageOrCause:
|
||||||
|
active: false
|
||||||
|
exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
|
||||||
|
ThrowingNewInstanceOfSameException:
|
||||||
|
active: false
|
||||||
|
TooGenericExceptionCaught:
|
||||||
|
active: true
|
||||||
|
exceptionNames:
|
||||||
|
- ArrayIndexOutOfBoundsException
|
||||||
|
- Error
|
||||||
|
- Exception
|
||||||
|
- IllegalMonitorStateException
|
||||||
|
- NullPointerException
|
||||||
|
- IndexOutOfBoundsException
|
||||||
|
- RuntimeException
|
||||||
|
- Throwable
|
||||||
|
TooGenericExceptionThrown:
|
||||||
|
active: true
|
||||||
|
exceptionNames:
|
||||||
|
- Error
|
||||||
|
- Exception
|
||||||
|
- Throwable
|
||||||
|
- RuntimeException
|
||||||
|
|
||||||
|
naming:
|
||||||
|
active: true
|
||||||
|
ClassNaming:
|
||||||
|
active: true
|
||||||
|
classPattern: '[A-Z$][a-zA-Z0-9$]*'
|
||||||
|
EnumNaming:
|
||||||
|
active: true
|
||||||
|
enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*'
|
||||||
|
ForbiddenClassName:
|
||||||
|
active: false
|
||||||
|
forbiddenName: ''
|
||||||
|
FunctionMaxLength:
|
||||||
|
active: false
|
||||||
|
maximumFunctionNameLength: 30
|
||||||
|
FunctionMinLength:
|
||||||
|
active: false
|
||||||
|
minimumFunctionNameLength: 3
|
||||||
|
FunctionNaming:
|
||||||
|
active: true
|
||||||
|
functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
|
||||||
|
excludeClassPattern: '$^'
|
||||||
|
MatchingDeclarationName:
|
||||||
|
active: true
|
||||||
|
MemberNameEqualsClassName:
|
||||||
|
active: false
|
||||||
|
ignoreOverriddenFunction: true
|
||||||
|
ObjectPropertyNaming:
|
||||||
|
active: true
|
||||||
|
propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
|
||||||
|
PackageNaming:
|
||||||
|
active: true
|
||||||
|
packagePattern: '^[a-z]+(\.[a-z][a-z0-9]*)*$'
|
||||||
|
TopLevelPropertyNaming:
|
||||||
|
active: true
|
||||||
|
constantPattern: '[A-Z][_A-Z0-9]*'
|
||||||
|
propertyPattern: '[a-z][A-Za-z\d]*'
|
||||||
|
privatePropertyPattern: '(_)?[a-z][A-Za-z0-9]*'
|
||||||
|
VariableMaxLength:
|
||||||
|
active: false
|
||||||
|
maximumVariableNameLength: 64
|
||||||
|
VariableMinLength:
|
||||||
|
active: false
|
||||||
|
minimumVariableNameLength: 1
|
||||||
|
VariableNaming:
|
||||||
|
active: true
|
||||||
|
variablePattern: '[a-z][A-Za-z0-9]*'
|
||||||
|
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
|
||||||
|
excludeClassPattern: '$^'
|
||||||
|
|
||||||
|
performance:
|
||||||
|
active: true
|
||||||
|
ForEachOnRange:
|
||||||
|
active: true
|
||||||
|
SpreadOperator:
|
||||||
|
active: true
|
||||||
|
UnnecessaryTemporaryInstantiation:
|
||||||
|
active: true
|
||||||
|
|
||||||
|
potential-bugs:
|
||||||
|
active: true
|
||||||
|
DuplicateCaseInWhenExpression:
|
||||||
|
active: true
|
||||||
|
EqualsAlwaysReturnsTrueOrFalse:
|
||||||
|
active: false
|
||||||
|
EqualsWithHashCodeExist:
|
||||||
|
active: true
|
||||||
|
ExplicitGarbageCollectionCall:
|
||||||
|
active: true
|
||||||
|
InvalidRange:
|
||||||
|
active: false
|
||||||
|
IteratorHasNextCallsNextMethod:
|
||||||
|
active: false
|
||||||
|
IteratorNotThrowingNoSuchElementException:
|
||||||
|
active: false
|
||||||
|
LateinitUsage:
|
||||||
|
active: false
|
||||||
|
excludeAnnotatedProperties: ""
|
||||||
|
ignoreOnClassesPattern: ""
|
||||||
|
UnconditionalJumpStatementInLoop:
|
||||||
|
active: false
|
||||||
|
UnreachableCode:
|
||||||
|
active: true
|
||||||
|
UnsafeCallOnNullableType:
|
||||||
|
active: false
|
||||||
|
UnsafeCast:
|
||||||
|
active: false
|
||||||
|
UselessPostfixExpression:
|
||||||
|
active: false
|
||||||
|
WrongEqualsTypeParameter:
|
||||||
|
active: false
|
||||||
|
|
||||||
|
style:
|
||||||
|
active: true
|
||||||
|
CollapsibleIfStatements:
|
||||||
|
active: true
|
||||||
|
DataClassContainsFunctions:
|
||||||
|
active: false
|
||||||
|
conversionFunctionPrefix: 'to'
|
||||||
|
EqualsNullCall:
|
||||||
|
active: false
|
||||||
|
ExpressionBodySyntax:
|
||||||
|
active: false
|
||||||
|
ForbiddenComment:
|
||||||
|
active: true
|
||||||
|
values: 'TODO:,FIXME:,STOPSHIP:'
|
||||||
|
ForbiddenImport:
|
||||||
|
active: false
|
||||||
|
imports: ''
|
||||||
|
FunctionOnlyReturningConstant:
|
||||||
|
active: false
|
||||||
|
ignoreOverridableFunction: true
|
||||||
|
excludedFunctions: 'describeContents'
|
||||||
|
LoopWithTooManyJumpStatements:
|
||||||
|
active: false
|
||||||
|
maxJumpCount: 1
|
||||||
|
MagicNumber:
|
||||||
|
active: true
|
||||||
|
ignoreNumbers: '-1,0,1,2'
|
||||||
|
ignoreHashCodeFunction: false
|
||||||
|
ignorePropertyDeclaration: false
|
||||||
|
ignoreConstantDeclaration: true
|
||||||
|
ignoreCompanionObjectPropertyDeclaration: true
|
||||||
|
ignoreAnnotation: false
|
||||||
|
ignoreNamedArgument: true
|
||||||
|
ignoreEnums: false
|
||||||
|
MaxLineLength:
|
||||||
|
active: true
|
||||||
|
maxLineLength: 120
|
||||||
|
excludePackageStatements: false
|
||||||
|
excludeImportStatements: false
|
||||||
|
MayBeConst:
|
||||||
|
active: true
|
||||||
|
ModifierOrder:
|
||||||
|
active: true
|
||||||
|
NestedClassesVisibility:
|
||||||
|
active: false
|
||||||
|
NewLineAtEndOfFile:
|
||||||
|
active: true
|
||||||
|
NoTabs:
|
||||||
|
active: true
|
||||||
|
OptionalAbstractKeyword:
|
||||||
|
active: true
|
||||||
|
OptionalUnit:
|
||||||
|
active: false
|
||||||
|
OptionalWhenBraces:
|
||||||
|
active: false
|
||||||
|
ProtectedMemberInFinalClass:
|
||||||
|
active: false
|
||||||
|
RedundantVisibilityModifierRule:
|
||||||
|
active: false
|
||||||
|
ReturnCount:
|
||||||
|
active: true
|
||||||
|
max: 3
|
||||||
|
excludedFunctions: "equals"
|
||||||
|
SafeCast:
|
||||||
|
active: true
|
||||||
|
SerialVersionUIDInSerializableClass:
|
||||||
|
active: false
|
||||||
|
SpacingBetweenPackageAndImports:
|
||||||
|
active: true
|
||||||
|
ThrowsCount:
|
||||||
|
active: true
|
||||||
|
max: 2
|
||||||
|
TrailingWhitespace:
|
||||||
|
active: false
|
||||||
|
UnnecessaryAbstractClass:
|
||||||
|
active: true
|
||||||
|
UnnecessaryInheritance:
|
||||||
|
active: false
|
||||||
|
UnnecessaryParentheses:
|
||||||
|
active: false
|
||||||
|
UntilInsteadOfRangeTo:
|
||||||
|
active: false
|
||||||
|
UnusedImports:
|
||||||
|
active: false
|
||||||
|
UnusedPrivateMember:
|
||||||
|
active: false
|
||||||
|
UseDataClass:
|
||||||
|
active: false
|
||||||
|
excludeAnnotatedClasses: ""
|
||||||
|
UtilityClassWithPublicConstructor:
|
||||||
|
active: false
|
||||||
|
WildcardImport:
|
||||||
|
active: true
|
||||||
|
excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
|
Loading…
Reference in New Issue