Skip to content

Commit

Permalink
ci(bank-sdk): Update detekt and adjust for Compose (#518)
Browse files Browse the repository at this point in the history
ci(bank-sdk): Update detekt version and baselines. Generate default detekt config. Adjust detekt for compose
  • Loading branch information
ndubkov-distcotech authored Aug 6, 2024
1 parent aa13e9c commit 26be54c
Show file tree
Hide file tree
Showing 5 changed files with 864 additions and 33 deletions.
9 changes: 5 additions & 4 deletions bank-sdk/example-app/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>ComplexMethod:ConfigurationViewModel.kt$ConfigurationViewModel$fun configureGiniBank(context: Context)</ID>
<ID>CyclomaticComplexMethod:ConfigurationViewModel.kt$ConfigurationViewModel$fun configureGiniBank(context: Context)</ID>
<ID>EmptyFunctionBlock:CustomOnButtonLoadingIndicatorAdapter.kt$CustomOnButtonLoadingIndicatorAdapter${}</ID>
<ID>LongMethod:ConfigurationActivity.kt$ConfigurationActivity$private fun setConfigurationFeatures()</ID>
<ID>LongMethod:ConfigurationActivity.kt$ConfigurationActivity$private fun updateUIWithConfigurationObject(configuration: Configuration)</ID>
Expand Down Expand Up @@ -81,15 +81,16 @@
<ID>NewLineAtEndOfFile:PermissionHandler.kt$net.gini.android.bank.sdk.exampleapp.core.PermissionHandler.kt</ID>
<ID>NewLineAtEndOfFile:ResultWrapper.kt$net.gini.android.bank.sdk.exampleapp.core.ResultWrapper.kt</ID>
<ID>NewLineAtEndOfFile:SplashActivity.kt$net.gini.android.bank.sdk.exampleapp.ui.SplashActivity.kt</ID>
<ID>SwallowedException:ExampleApp.kt$ExampleApp$catch (e: IllegalStateException) { // ignore }</ID>
<ID>SwallowedException:ExampleApp.kt$ExampleApp$e: IllegalStateException</ID>
<ID>TooGenericExceptionCaught:PayActivity.kt$PayActivity$t: Throwable</ID>
<ID>TooGenericExceptionCaught:ResultWrapper.kt$throwable: Throwable</ID>
<ID>TooManyFunctions:ExtractionsActivity.kt$ExtractionsActivity : AppCompatActivityExtractionsAdapterInterface</ID>
<ID>TooManyFunctions:MainActivity.kt$MainActivity : AppCompatActivity</ID>
<ID>UnusedParameter:ExtractionsActivity.kt$ExtractionsActivity$binding: ActivityExtractionsBinding</ID>
<ID>UnusedPrivateMember:ClientBankSDKFragment.kt$ClientBankSDKFragment$private fun overrideBankSDKConfiguration()</ID>
<ID>UnusedPrivateMember:ExtractionsActivity.kt$ExtractionsActivity$binding: ActivityExtractionsBinding</ID>
<ID>UnusedPrivateMember:ExtractionsActivity.kt$ExtractionsActivity$private fun hideProgressIndicator(binding: ActivityExtractionsBinding)</ID>
<ID>UnusedPrivateMember:ExtractionsActivity.kt$ExtractionsActivity$private fun showProgressIndicator(binding: ActivityExtractionsBinding)</ID>
<ID>UnusedPrivateMember:MainActivity.kt$MainActivity.Companion$private const val REQUEST_CONFIGURATION = 3</ID>
<ID>UnusedPrivateProperty:ClientCaptureSDKFragment.kt$ClientCaptureSDKFragment$val capture = GiniCapture.Builder() .setGiniCaptureNetworkService(networkService) .setFileImportEnabled(true) .setDocumentImportEnabledFileTypes(DocumentImportEnabledFileTypes.PDF_AND_IMAGES) .setQRCodeScanningEnabled(true) .setFlashButtonEnabled(true) .setMultiPageEnabled(true) .build()</ID>
<ID>UnusedPrivateProperty:MainActivity.kt$MainActivity.Companion$private const val REQUEST_CONFIGURATION = 3</ID>
</CurrentIssues>
</SmellBaseline>
33 changes: 24 additions & 9 deletions bank-sdk/sdk/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>ComplexMethod:Configuration.kt$internal fun GiniCapture.Builder.applyConfiguration(configuration: CaptureConfiguration): GiniCapture.Builder</ID>
<ID>CyclomaticComplexMethod:Configuration.kt$internal fun GiniCapture.Builder.applyConfiguration(configuration: CaptureConfiguration): GiniCapture.Builder</ID>
<ID>EmptyFunctionBlock:DigitalInvoiceBottomSheet.kt$DigitalInvoiceBottomSheet${ }</ID>
<ID>EmptyFunctionBlock:DigitalInvoiceScreenPresenter.kt$DigitalInvoiceScreenPresenter${ }</ID>
<ID>EmptyFunctionBlock:DigitalOnboardingScreenPresenter.kt$DigitalOnboardingScreenPresenter${ }</ID>
Expand All @@ -12,6 +12,20 @@
<ID>EmptyFunctionBlock:LineItemsAdapter.kt$ViewHolder.AddonViewHolder${ }</ID>
<ID>EmptyFunctionBlock:TextExtensions.kt$&lt;no name provided>${ }</ID>
<ID>ForbiddenComment:DigitalInvoiceOnboardingFragment.kt$DigitalInvoiceOnboardingFragment$* You should show the `DigitalInvoiceOnboardingFragment` when the * [DigitalInvoiceFragmentListener.showOnboarding()] is called. * * Include the `DigitalInvoiceOnboardingFragment` into your layout by using the [DigitalInvoiceOnboardingFragment.createInstance()] factory method to create * an instance and display it using the [androidx.fragment.app.FragmentManager]. * * A [DigitalInvoiceOnboardingFragmentListener] instance must be available before the `DigitalInvoiceOnboardingFragment` is attached to an activity. Failing * to do so will throw an exception. The listener instance can be provided either implicitly by making the hosting Activity implement the * [DigitalInvoiceOnboardingFragmentListener] interface or explicitly by setting the listener using [DigitalInvoiceOnboardingFragment.listener]. * * Your Activity is automatically set as the listener in [DigitalInvoiceOnboardingFragment.onCreate()]. * * ### Customizing the Digital Invoice Onboarding Screen * * TODO: PPL-14: Customization guide for return assistant - Android</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable @Preview private fun ScreenReadyStatePreviewLight()</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable @Preview(uiMode = UI_MODE_NIGHT_YES) private fun ScreenReadyStatePreviewDark()</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun FooterSection( totalAmount: SkontoData.Amount, savedAmount: SkontoData.Amount, discountValue: BigDecimal, colors: SkontoFooterSectionColors, isBottomNavigationBarEnabled: Boolean, isSkontoSectionActive: Boolean, onBackClicked: () -> Unit, onProceedClicked: () -> Unit, modifier: Modifier = Modifier, customBottomNavBarAdapter: InjectedViewAdapterInstance&lt;SkontoNavigationBarBottomAdapter>?, )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun InfoBanner( colors: SkontoSectionColors.InfoBannerColors, text: String, clickable: Boolean, onClicked: () -> Unit, modifier: Modifier = Modifier, icon: Painter = painterResource(id = R.drawable.gbs_icon_important_info), )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun InfoDialog( text: String, colors: SkontoInfoDialogColors, onDismissRequest: () -> Unit, modifier: Modifier = Modifier, )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun NavigationActionBack( onClick: () -> Unit, modifier: Modifier = Modifier, )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun ScreenContent( navigateBack: () -> Unit, viewModel: SkontoFragmentViewModel, modifier: Modifier = Modifier, screenColorScheme: SkontoScreenColors = SkontoScreenColors.colors(), isBottomNavigationBarEnabled: Boolean, customBottomNavBarAdapter: InjectedViewAdapterInstance&lt;SkontoNavigationBarBottomAdapter>?, )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun ScreenReadyState( onBackClicked: () -> Unit, onProceedClicked: () -> Unit, state: SkontoFragmentContract.State.Ready, onDiscountSectionActiveChange: (Boolean) -> Unit, onDiscountAmountChange: (BigDecimal) -> Unit, onDueDateChanged: (LocalDate) -> Unit, onFullAmountChange: (BigDecimal) -> Unit, isBottomNavigationBarEnabled: Boolean, customBottomNavBarAdapter: InjectedViewAdapterInstance&lt;SkontoNavigationBarBottomAdapter>?, modifier: Modifier = Modifier, screenColorScheme: SkontoScreenColors = SkontoScreenColors.colors(), onInfoBannerClicked: () -> Unit, onInfoDialogDismissed: () -> Unit, )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun ScreenReadyStatePreview()</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun ScreenStateContent( state: SkontoFragmentContract.State, onDiscountSectionActiveChange: (Boolean) -> Unit, onSkontoAmountChange: (BigDecimal) -> Unit, onFullAmountChange: (BigDecimal) -> Unit, onDueDateChanged: (LocalDate) -> Unit, onBackClicked: () -> Unit, onProceedClicked: () -> Unit, isBottomNavigationBarEnabled: Boolean, customBottomNavBarAdapter: InjectedViewAdapterInstance&lt;SkontoNavigationBarBottomAdapter>?, onInfoBannerClicked: () -> Unit, onInfoDialogDismissed: () -> Unit, modifier: Modifier = Modifier, screenColorScheme: SkontoScreenColors = SkontoScreenColors.colors() )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun SkontoSection( colors: SkontoSectionColors, amount: SkontoData.Amount, dueDate: LocalDate, infoPaymentInDays: Int, infoDiscountValue: BigDecimal, onActiveChange: (Boolean) -> Unit, onSkontoAmountChange: (BigDecimal) -> Unit, onDueDateChanged: (LocalDate) -> Unit, onInfoBannerClicked: () -> Unit, edgeCase: SkontoFragmentContract.SkontoEdgeCase?, modifier: Modifier = Modifier, isActive: Boolean, )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun TopAppBar( onBackClicked: () -> Unit, modifier: Modifier = Modifier, isBottomNavigationBarEnabled: Boolean, colors: GiniTopBarColors, )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun WithoutSkontoSection( colors: WithoutSkontoSectionColors, amount: SkontoData.Amount, modifier: Modifier = Modifier, onFullAmountChange: (BigDecimal) -> Unit, isActive: Boolean, )</ID>
<ID>FunctionNaming:SkontoFragment.kt$@Composable private fun YourInvoiceScanSection( modifier: Modifier = Modifier, colorScheme: SkontoInvoiceScanSectionColors, )</ID>
<ID>LongMethod:Configuration.kt$internal fun GiniCapture.Builder.applyConfiguration(configuration: CaptureConfiguration): GiniCapture.Builder</ID>
<ID>LongMethod:SkontoFragment.kt$@Composable private fun FooterSection( totalAmount: SkontoData.Amount, savedAmount: SkontoData.Amount, discountValue: BigDecimal, colors: SkontoFooterSectionColors, isBottomNavigationBarEnabled: Boolean, isSkontoSectionActive: Boolean, onBackClicked: () -> Unit, onProceedClicked: () -> Unit, modifier: Modifier = Modifier, customBottomNavBarAdapter: InjectedViewAdapterInstance&lt;SkontoNavigationBarBottomAdapter>?, )</ID>
<ID>LongMethod:SkontoFragment.kt$@Composable private fun ScreenReadyState( onBackClicked: () -> Unit, onProceedClicked: () -> Unit, state: SkontoFragmentContract.State.Ready, onDiscountSectionActiveChange: (Boolean) -> Unit, onDiscountAmountChange: (BigDecimal) -> Unit, onDueDateChanged: (LocalDate) -> Unit, onFullAmountChange: (BigDecimal) -> Unit, isBottomNavigationBarEnabled: Boolean, customBottomNavBarAdapter: InjectedViewAdapterInstance&lt;SkontoNavigationBarBottomAdapter>?, modifier: Modifier = Modifier, screenColorScheme: SkontoScreenColors = SkontoScreenColors.colors(), onInfoBannerClicked: () -> Unit, onInfoDialogDismissed: () -> Unit, )</ID>
Expand Down Expand Up @@ -44,7 +58,6 @@
<ID>MaxLineLength:BigDecimalExtensions.kt$internal</ID>
<ID>MaxLineLength:CaptureFlowActivity.kt$CaptureFlowActivity$* Entry point for Screen API. It exists for the purpose of communication between Capture SDK's Screen API and Return Assistant.</ID>
<ID>MaxLineLength:CaptureFlowFragment.kt$CaptureFlowFragment$// To be the first to handle back button pressed events we need to set this fragment as the primary navigation fragment</ID>
<ID>MaxLineLength:Configuration.kt$CaptureConfiguration$*</ID>
<ID>MaxLineLength:Configuration.kt$CaptureConfiguration$* Enable and configure the document import feature or disable it by passing in [DocumentImportEnabledFileTypes.NONE].</ID>
<ID>MaxLineLength:DigitalInvoice.kt$DigitalInvoice$private</ID>
<ID>MaxLineLength:DigitalInvoice.kt$DigitalInvoice$selectableLineItems.map { sli -> if (sli.lineItem.id == selectableLineItem.lineItem.id) selectableLineItem else sli }</ID>
Expand Down Expand Up @@ -135,10 +148,10 @@
<ID>SerialVersionUIDInSerializableClass:SkontoData.kt$SkontoData : Serializable</ID>
<ID>SerialVersionUIDInSerializableClass:SkontoData.kt$SkontoData$Amount : Serializable</ID>
<ID>SerialVersionUIDInSerializableClass:SkontoData.kt$SkontoData$SkontoPaymentMethod : Serializable</ID>
<ID>SwallowedException:CaptureFlowFragment.kt$CaptureFlowFragment$catch (e: Exception) { finishWithResult(result) }</ID>
<ID>SwallowedException:CaptureFlowFragment.kt$CaptureFlowFragment$catch (notUsed: DigitalInvoiceException) { tryShowingSkontoScreen(result) return }</ID>
<ID>SwallowedException:DigitalInvoiceAddon.kt$DigitalInvoiceAddon.Companion$catch (e: Exception) { Pair(null, null) }</ID>
<ID>SwallowedException:LineItem.kt$LineItem$catch (e: Exception) { Triple(BigDecimal.ZERO, "", null) }</ID>
<ID>SwallowedException:CaptureFlowFragment.kt$CaptureFlowFragment$e: Exception</ID>
<ID>SwallowedException:CaptureFlowFragment.kt$CaptureFlowFragment$notUsed: DigitalInvoiceException</ID>
<ID>SwallowedException:DigitalInvoiceAddon.kt$DigitalInvoiceAddon.Companion$e: Exception</ID>
<ID>SwallowedException:LineItem.kt$LineItem$e: Exception</ID>
<ID>ThrowsCount:SkontoDataExtractor.kt$SkontoDataExtractor.Companion$fun extractSkontoData( extractions: Map&lt;String, GiniCaptureSpecificExtraction>, compoundExtractions: Map&lt;String, GiniCaptureCompoundExtraction>, ): SkontoData</ID>
<ID>TooGenericExceptionCaught:CaptureFlowFragment.kt$CaptureFlowFragment$e: Exception</ID>
<ID>TooGenericExceptionCaught:DigitalInvoiceAddon.kt$DigitalInvoiceAddon.Companion$e: Exception</ID>
Expand All @@ -153,19 +166,21 @@
<ID>TooManyFunctions:DigitalInvoiceFragment.kt$DigitalInvoiceFragment : FragmentViewLineItemsAdapterListener</ID>
<ID>TooManyFunctions:DigitalInvoiceOnboardingFragment.kt$DigitalInvoiceOnboardingFragment : FragmentView</ID>
<ID>TooManyFunctions:DigitalInvoiceScreenPresenter.kt$DigitalInvoiceScreenPresenter : Presenter</ID>
<ID>TooManyFunctions:GiniBank.kt$GiniBank$GiniBank</ID>
<ID>TooManyFunctions:GiniBank.kt$GiniBank</ID>
<ID>TooManyFunctions:LineItemDetailsScreenContract.kt$LineItemDetailsScreenContract$View : GiniCaptureBaseView</ID>
<ID>TooManyFunctions:LineItemDetailsScreenPresenter.kt$LineItemDetailsScreenPresenter : Presenter</ID>
<ID>TooManyFunctions:ReturnReasonsDialog.kt$ReturnReasonDialog : BottomSheetDialogFragment</ID>
<ID>TooManyFunctions:SkontoFragment.kt$net.gini.android.bank.sdk.capture.skonto.SkontoFragment.kt</ID>
<ID>TooManyFunctions:SkontoFragmentViewModel.kt$SkontoFragmentViewModel : ViewModel</ID>
<ID>TopLevelPropertyNaming:PaymentRequestIntent.kt$internal const val Scheme = "ginipay" // It has to match the scheme in query tag in manifest</ID>
<ID>TopLevelPropertyNaming:PaymentRequestIntent.kt$private const val PaymentPath = "payment"</ID>
<ID>UnusedPrivateMember:DigitalInvoiceFragment.kt$private const val TAG_WHAT_IS_THIS_DIALOG = "TAG_WHAT_IS_THIS_DIALOG"</ID>
<ID>UnusedPrivateMember:SkontoDataExtractor.kt$SkontoDataExtractor.Companion$val skontoAmountDiscounted = skontoDiscountData.extractDataByKeys( "skontoAmountDiscounted", "skontoAmountDiscountedCalculated" )</ID>
<ID>UnusedPrivateMember:SkontoFragment.kt$@Composable @Preview private fun ScreenReadyStatePreviewLight()</ID>
<ID>UnusedPrivateMember:SkontoFragment.kt$@Composable @Preview(uiMode = UI_MODE_NIGHT_YES) private fun ScreenReadyStatePreviewDark()</ID>
<ID>UnusedPrivateMember:SkontoFragment.kt$@Composable private fun YourInvoiceScanSection( modifier: Modifier = Modifier, colorScheme: SkontoInvoiceScanSectionColors, )</ID>
<ID>UnusedPrivateProperty:DigitalInvoiceFragment.kt$private const val TAG_WHAT_IS_THIS_DIALOG = "TAG_WHAT_IS_THIS_DIALOG"</ID>
<ID>UnusedPrivateProperty:SkontoDataExtractor.kt$SkontoDataExtractor.Companion$val skontoAmountDiscounted = skontoDiscountData.extractDataByKeys( "skontoAmountDiscounted", "skontoAmountDiscountedCalculated" )</ID>
<ID>UseCheckOrError:AutoClearedValue.kt$AutoClearedValue$throw IllegalStateException( "should never call auto-cleared-value get when it might not be available" )</ID>
<ID>UseCheckOrError:LineItemsAdapter.kt$ViewType.Companion$throw IllegalStateException("Unknow adapter view type id: $viewTypeId")</ID>
<ID>UtilityClassWithPublicConstructor:LineItemsValidator.kt$LineItemsValidator</ID>
<ID>UtilityClassWithPublicConstructor:SkontoDataExtractor.kt$SkontoDataExtractor</ID>
<ID>WildcardImport:CoroutineContinuationHelper.kt$import kotlinx.coroutines.*</ID>
Expand Down
Loading

0 comments on commit 26be54c

Please sign in to comment.