diff --git a/app/src/androidTest/java/org/mozilla/fenix/ExampleInstrumentedTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ExampleInstrumentedTest.kt index d475f55fa..fc6446668 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ExampleInstrumentedTest.kt @@ -2,10 +2,12 @@ package org.mozilla.fenix import android.support.test.InstrumentationRegistry import android.support.test.runner.AndroidJUnit4 +import androidx.test.InstrumentationRegistry +import androidx.test.runner.AndroidJUnit4 import org.junit.Test import org.junit.runner.RunWith - +/* ktlint-disable no-wildcard-imports */ import org.junit.Assert.* /** diff --git a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt index b98c9d53c..6c1e2e4d0 100644 --- a/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt +++ b/app/src/main/java/org/mozilla/fenix/IntentReceiverActivity.kt @@ -24,4 +24,4 @@ class IntentReceiverActivity : Activity() { startActivity(intent) finish() } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt index 0c5c00406..f6a4c3379 100644 --- a/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/browser/BrowserFragment.kt @@ -27,7 +27,8 @@ class BrowserFragment : Fragment() { private lateinit var sessionFeature: SessionFeature override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, + inflater: LayoutInflater, + container: ViewGroup?, savedInstanceState: Bundle? ): View? { return inflater.inflate(R.layout.fragment_browser, container, false) diff --git a/app/src/main/java/org/mozilla/fenix/components/Utilities.kt b/app/src/main/java/org/mozilla/fenix/components/Utilities.kt index c13593373..f742cbb29 100644 --- a/app/src/main/java/org/mozilla/fenix/components/Utilities.kt +++ b/app/src/main/java/org/mozilla/fenix/components/Utilities.kt @@ -6,7 +6,6 @@ import mozilla.components.feature.intent.IntentProcessor import mozilla.components.feature.search.SearchUseCases import mozilla.components.feature.session.SessionUseCases - /** * Component group for miscellaneous components. */ diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/Toolbar.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/Toolbar.kt index 391c6a003..b86282ec4 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/Toolbar.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/Toolbar.kt @@ -139,4 +139,4 @@ class Toolbar( private fun openSettingsActivity() { // TODO Open Settings } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarIntegration.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarIntegration.kt index 7febb562b..3b626cd15 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarIntegration.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/ToolbarIntegration.kt @@ -33,10 +33,10 @@ class ToolbarIntegration( init { 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.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( context.resources.getDrawable( @@ -81,4 +81,9 @@ class ToolbarIntegration( fun stop() { toolbarFeature.stop() } + + companion object { + const val browserActionMarginDp = 8 + const val urlBoxMargin = 8 + } } diff --git a/app/src/main/java/org/mozilla/fenix/ext/Context.kt b/app/src/main/java/org/mozilla/fenix/ext/Context.kt index d2718aa28..7f8567bbf 100644 --- a/app/src/main/java/org/mozilla/fenix/ext/Context.kt +++ b/app/src/main/java/org/mozilla/fenix/ext/Context.kt @@ -7,7 +7,10 @@ package org.mozilla.fenix.ext import android.content.ActivityNotFoundException import android.content.Context 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 mozilla.components.support.base.log.Log import mozilla.components.support.base.log.Log.Priority.WARN diff --git a/app/src/main/java/org/mozilla/fenix/ext/Fragment.kt b/app/src/main/java/org/mozilla/fenix/ext/Fragment.kt index 53516a60a..3a3d98327 100644 --- a/app/src/main/java/org/mozilla/fenix/ext/Fragment.kt +++ b/app/src/main/java/org/mozilla/fenix/ext/Fragment.kt @@ -10,4 +10,4 @@ import org.mozilla.fenix.components.Components * Get the requireComponents of this application. */ val androidx.fragment.app.Fragment.requireComponents: Components - get() = requireContext().components \ No newline at end of file + get() = requireContext().components diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt index 962fb2ba7..f7c812164 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeFragment.kt @@ -7,14 +7,11 @@ package org.mozilla.fenix.home import android.content.res.Resources import android.graphics.drawable.BitmapDrawable import android.os.Bundle -import android.transition.TransitionInflater import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.core.view.ViewCompat import androidx.fragment.app.Fragment import androidx.navigation.Navigation -import androidx.navigation.fragment.FragmentNavigator import kotlinx.android.synthetic.main.fragment_home.* import kotlinx.android.synthetic.main.fragment_home.view.* import org.mozilla.fenix.R @@ -26,7 +23,8 @@ import kotlin.math.roundToInt class HomeFragment : Fragment() { override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, + inflater: LayoutInflater, + container: ViewGroup?, savedInstanceState: Bundle? ): View? { val view = inflater.inflate(R.layout.fragment_home, container, false) @@ -42,10 +40,15 @@ class HomeFragment : Fragment() { } 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 -> Navigation.findNavController(it).navigate(R.id.action_homeFragment_to_searchFragment, null, null) } layoutComponents(homeLayout) } + + companion object { + const val toolbarPaddingDp = 12f + } } diff --git a/app/src/main/java/org/mozilla/fenix/home/SearchView.kt b/app/src/main/java/org/mozilla/fenix/home/SearchView.kt index f3cb48755..b348d78c5 100644 --- a/app/src/main/java/org/mozilla/fenix/home/SearchView.kt +++ b/app/src/main/java/org/mozilla/fenix/home/SearchView.kt @@ -20,21 +20,25 @@ class SearchView(context: Context, attrs: AttributeSet) : FrameLayout(context, a fun transitionToLight() { background = lightToDark - lightToDark.reverseTransition(500) + lightToDark.reverseTransition(transitionDurationMs) } fun transitionToDark() { background = lightToDark - lightToDark.startTransition(500) + lightToDark.startTransition(transitionDurationMs) } fun transitionToDarkFromNoBorder() { background = darkToNoBorder - darkToNoBorder.reverseTransition(500) + darkToNoBorder.reverseTransition(transitionDurationMs) } fun transitionToDarkNoBorder() { background = darkToNoBorder - darkToNoBorder.startTransition(500) + darkToNoBorder.startTransition(transitionDurationMs) } -} \ No newline at end of file + + companion object { + const val transitionDurationMs = 500 + } +} diff --git a/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsAdapter.kt b/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsAdapter.kt index 434e5fa31..01ed6d104 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsAdapter.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsAdapter.kt @@ -11,12 +11,11 @@ import android.widget.TextView import androidx.recyclerview.widget.RecyclerView import org.mozilla.fenix.R - -class SessionsAdapter() : RecyclerView.Adapter() { +class SessionsAdapter : RecyclerView.Adapter() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { val view = LayoutInflater.from(parent.context).inflate(viewType, parent, false) - return when(viewType) { + return when (viewType) { HeaderViewHolder.LAYOUT_ID -> HeaderViewHolder(view) EmptyListViewHolder.LAYOUT_ID -> EmptyListViewHolder(view) else -> EmptyListViewHolder(view) @@ -37,7 +36,7 @@ class SessionsAdapter() : RecyclerView.Adapter() { } } - private class HeaderViewHolder(private val view: View): RecyclerView.ViewHolder(view) { + private class HeaderViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { val headerText = view.findViewById(R.id.header_text) companion object { @@ -45,7 +44,7 @@ class SessionsAdapter() : RecyclerView.Adapter() { } } - private class EmptyListViewHolder(private val view: View): RecyclerView.ViewHolder(view) { + private class EmptyListViewHolder(private val view: View) : RecyclerView.ViewHolder(view) { companion object { const val LAYOUT_ID = R.layout.session_list_empty } diff --git a/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsComponent.kt b/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsComponent.kt index b0e8e5b62..b9afd97de 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsComponent.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsComponent.kt @@ -7,14 +7,18 @@ package org.mozilla.fenix.home.sessions import android.annotation.SuppressLint import android.view.ViewGroup 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) : UIComponent(bus) { override var initialState: SessionsState = SessionsState(emptyList()) - override val reducer : (SessionsState, SessionsChange) -> SessionsState = { state, change -> + override val reducer: (SessionsState, SessionsChange) -> SessionsState = { state, change -> when (change) { is SessionsChange.SessionsChanged -> state // copy state with changes here } diff --git a/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsLayouts.kt b/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsLayouts.kt index c86725f9c..46f5ea604 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsLayouts.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsLayouts.kt @@ -4,7 +4,10 @@ import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout.LayoutParams.PARENT_ID import kotlinx.android.synthetic.main.component_sessions.* 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.mozilla.fenix.home.HomeFragment @@ -19,4 +22,4 @@ fun HomeFragment.layoutComponents(layout: ConstraintLayout) { ) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsUIView.kt b/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsUIView.kt index 5029f0252..2975e6579 100644 --- a/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsUIView.kt +++ b/app/src/main/java/org/mozilla/fenix/home/sessions/SessionsUIView.kt @@ -29,7 +29,5 @@ class SessionsUIView(container: ViewGroup, bus: ActionBusFactory) : } override fun updateView() = Consumer { - } - } diff --git a/app/src/main/java/org/mozilla/fenix/mvi/ActionBusFactory.kt b/app/src/main/java/org/mozilla/fenix/mvi/ActionBusFactory.kt index e4a2ab39f..c1c6f6fc0 100644 --- a/app/src/main/java/org/mozilla/fenix/mvi/ActionBusFactory.kt +++ b/app/src/main/java/org/mozilla/fenix/mvi/ActionBusFactory.kt @@ -154,4 +154,3 @@ inline fun LifecycleOwner?.createDestroyObservable(): Observable { }) } } - diff --git a/app/src/main/java/org/mozilla/fenix/mvi/UIComponent.kt b/app/src/main/java/org/mozilla/fenix/mvi/UIComponent.kt index 3beea9e26..4e43a9575 100644 --- a/app/src/main/java/org/mozilla/fenix/mvi/UIComponent.kt +++ b/app/src/main/java/org/mozilla/fenix/mvi/UIComponent.kt @@ -9,15 +9,19 @@ import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.Disposable import io.reactivex.schedulers.Schedulers -abstract class UIComponent(open val bus: ActionBusFactory) { +abstract class UIComponent(open val bus: ActionBusFactory) { abstract var initialState: S abstract val reducer: Reducer val uiView: UIView by lazy { initView() } abstract fun initView(): UIView open fun getContainerId() = uiView.containerId - inline fun getUserInteractionEvents(): Observable = bus.getSafeManagedObservable(A::class.java) - inline fun getModelChangeEvents(): Observable = bus.getSafeManagedObservable(C::class.java) + + inline fun getUserInteractionEvents(): + Observable = bus.getSafeManagedObservable(A::class.java) + + inline fun getModelChangeEvents(): + Observable = bus.getSafeManagedObservable(C::class.java) /** * Render the ViewState to the View through the Reducer diff --git a/app/src/main/java/org/mozilla/fenix/mvi/UIView.kt b/app/src/main/java/org/mozilla/fenix/mvi/UIView.kt index 1116b5c19..1e73e21b9 100644 --- a/app/src/main/java/org/mozilla/fenix/mvi/UIView.kt +++ b/app/src/main/java/org/mozilla/fenix/mvi/UIView.kt @@ -11,7 +11,8 @@ import io.reactivex.functions.Consumer import kotlinx.android.extensions.LayoutContainer abstract class UIView( - private val container: ViewGroup, val bus: ActionBusFactory + private val container: ViewGroup, + val bus: ActionBusFactory ) : LayoutContainer { abstract val view: View diff --git a/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt b/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt index 6c9f6da69..37aff5027 100644 --- a/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt +++ b/app/src/main/java/org/mozilla/fenix/search/SearchFragment.kt @@ -4,15 +4,12 @@ package org.mozilla.fenix.search import android.os.Bundle -import android.transition.TransitionInflater import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.content.ContextCompat -import androidx.core.view.ViewCompat import androidx.fragment.app.Fragment import androidx.navigation.Navigation -import androidx.navigation.fragment.FragmentNavigator import kotlinx.android.synthetic.main.fragment_search.* import mozilla.components.browser.domains.autocomplete.ShippedDomainsProvider import mozilla.components.feature.awesomebar.AwesomeBarFeature @@ -25,7 +22,8 @@ class SearchFragment : Fragment() { private lateinit var awesomeBarFeature: AwesomeBarFeature override fun onCreateView( - inflater: LayoutInflater, container: ViewGroup?, + inflater: LayoutInflater, + container: ViewGroup?, savedInstanceState: Bundle? ): View? { return inflater.inflate(R.layout.fragment_search, container, false) @@ -58,11 +56,10 @@ class SearchFragment : Fragment() { requireComponents.core.sessionManager, requireComponents.useCases.tabsUseCases.selectTab) - toolbar_wrapper.clipToOutline = false toolbar.apply { textColor = ContextCompat.getColor(context, R.color.searchText) - textSize = 14f + textSize = toolbarTextSizeSp hint = context.getString(R.string.search_hint) hintColor = ContextCompat.getColor(context, R.color.searchText) } @@ -71,4 +68,8 @@ class SearchFragment : Fragment() { private fun userDidSearch() { Navigation.findNavController(toolbar).navigate(R.id.action_searchFragment_to_browserFragment, null, null) } + + companion object { + const val toolbarTextSizeSp = 14f + } } diff --git a/app/src/test/java/org/mozilla/fenix/ExampleUnitTest.kt b/app/src/test/java/org/mozilla/fenix/ExampleUnitTest.kt index fe77bc2a9..8e685cac9 100644 --- a/app/src/test/java/org/mozilla/fenix/ExampleUnitTest.kt +++ b/app/src/test/java/org/mozilla/fenix/ExampleUnitTest.kt @@ -1,7 +1,7 @@ package org.mozilla.fenix import org.junit.Test - +/* ktlint-disable no-wildcard-imports */ import org.junit.Assert.* /** diff --git a/config/detekt.yml b/config/detekt.yml new file mode 100644 index 000000000..8fbfa1a6c --- /dev/null +++ b/config/detekt.yml @@ -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.*'