From 2323450e71d1508e6ff218d48b856aefa04542d0 Mon Sep 17 00:00:00 2001 From: Manthan Surkar Date: Thu, 18 Jun 2020 04:05:24 +0530 Subject: [PATCH] FINERACT-821 Added and Enforced ModifierOrder Checkstyle --- fineract-provider/build.gradle | 31 ++++++++++++- .../config/checkstyle/checkstyle.xml | 3 +- .../AccountNumberPreferencesTest.java | 2 +- .../integrationtests/AccountTransferTest.java | 2 +- .../AccountingScenarioIntegrationTest.java | 2 +- .../ActuatorIntegrationTest.java | 2 +- .../BatchRequestsIntegrationTest.java | 2 +- .../CenterIntegrationTest.java | 2 +- .../ClientLoanIntegrationTest.java | 2 +- .../ClientSavingsIntegrationTest.java | 2 +- .../integrationtests/ClientStatusChecker.java | 2 +- .../ConcurrencyIntegrationTest.java | 2 +- .../ExternalServicesConfigurationTest.java | 2 +- .../integrationtests/FixedDepositTest.java | 2 +- ...SavingsInterestPostingIntegrationTest.java | 2 +- .../GroupLoanIntegrationTest.java | 2 +- .../GroupSavingsIntegrationTest.java | 2 +- .../fineract/integrationtests/GroupTest.java | 2 +- .../integrationtests/HookIntegrationTest.java | 2 +- .../LoanApplicationApprovalTest.java | 2 +- .../LoanApplicationUndoLastTrancheTest.java | 2 +- .../LoanDisbursalDateValidationTest.java | 2 +- ...oanDisbursementDetailsIntegrationTest.java | 2 +- ...RepaymentRescheduleAtDisbursementTest.java | 2 +- .../LoanRescheduleRequestTest.java | 2 +- .../LoanReschedulingWithinCenterTest.java | 2 +- ...iveInterestAndWriteOffIntegrationTest.java | 2 +- .../integrationtests/NotificationApiTest.java | 2 +- .../PasswordPreferencesIntegrationTest.java | 2 +- .../RecurringDepositTest.java | 2 +- .../fineract/integrationtests/RolesTest.java | 2 +- .../SkipRepaymentOnMonthFirstTest.java | 2 +- .../UserAdministrationTest.java | 2 +- .../integrationtests/XBRLIntegrationTest.java | 2 +- .../client/ClientEntityImportHandlerTest.java | 2 +- .../loan/LoanImportHandlerTest.java | 2 +- .../office/OfficeImportHandlerTest.java | 2 +- .../savings/SavingsImportHandlerTest.java | 2 +- .../integrationtests/common/BatchHelper.java | 2 +- .../common/CalendarHelper.java | 2 +- .../integrationtests/common/CenterDomain.java | 2 +- .../integrationtests/common/CenterHelper.java | 2 +- .../integrationtests/common/ClientHelper.java | 2 +- .../common/CommonConstants.java | 2 +- .../common/CurrenciesHelper.java | 2 +- .../common/GlobalConfigurationHelper.java | 2 +- .../integrationtests/common/GroupHelper.java | 2 +- .../common/HolidayHelper.java | 2 +- .../integrationtests/common/HookHelper.java | 2 +- .../integrationtests/common/ImageHelper.java | 2 +- .../common/NotificationHelper.java | 2 +- .../integrationtests/common/OfficeHelper.java | 2 +- .../common/ProvisioningIntegrationTest.java | 4 +- .../common/SchedulerJobHelper.java | 2 +- .../common/StandingInstructionsHelper.java | 2 +- .../integrationtests/common/SurveyHelper.java | 2 +- .../common/TaxComponentHelper.java | 2 +- .../common/TaxGroupHelper.java | 2 +- .../integrationtests/common/Utils.java | 2 +- .../common/WorkingDaysHelper.java | 2 +- .../common/charges/ChargesHelper.java | 14 +++--- .../FixedDepositAccountHelper.java | 4 +- .../FixedDepositAccountStatusChecker.java | 2 +- .../FixedDepositProductHelper.java | 2 +- .../loans/LoanApplicationTestBuilder.java | 2 +- .../common/loans/LoanTransactionHelper.java | 2 +- .../common/organisation/CampaignsHelper.java | 2 +- .../common/organisation/CurrencyHelper.java | 2 +- .../EntityDatatableChecksHelper.java | 2 +- .../EntityDatatableChecksIntegrationTest.java | 2 +- .../common/organisation/StaffHelper.java | 2 +- .../provisioning/ProvisioningHelper.java | 6 +-- .../common/rates/RatesHelper.java | 6 +-- .../RecurringDepositAccountHelper.java | 2 +- .../RecurringDepositAccountStatusChecker.java | 2 +- .../RecurringDepositProductHelper.java | 2 +- .../common/savings/AccountTransferHelper.java | 2 +- .../common/savings/SavingsAccountHelper.java | 2 +- .../SavingsApplicationTestBuilder.java | 2 +- .../common/savings/SavingsProductHelper.java | 2 +- .../common/savings/SavingsStatusChecker.java | 2 +- .../common/shares/ShareAccountHelper.java | 2 +- .../shares/ShareAccountIntegrationTests.java | 2 +- .../common/shares/ShareProductHelper.java | 2 +- .../AccountNumberPreferencesHelper.java | 2 +- .../common/system/DatatableHelper.java | 2 +- .../interoperation/InteropHelper.java | 2 +- .../interoperation/InteropTest.java | 12 ++--- .../loanaccount/guarantor/GuarantorTest.java | 2 +- .../guarantor/GuarantorTestBuilder.java | 2 +- ...bleInstallmentsDecliningBalanceHelper.java | 2 +- .../VariableInstallmentsFlatHelper.java | 2 +- .../VariableInstallmentsIntegrationTest.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...inancialActivityAccountFoundException.java | 2 +- ...ancialActivityAccountInvalidException.java | 2 +- ...tivityAccountWritePlatformServiceImpl.java | 2 +- .../GLAccountReadPlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...lEntryRunningBalanceUpdateServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../ProvisioningEntriesApiConstants.java | 12 ++--- ...sioningEntriesReadPlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../AdHocScheduledJobRunnerServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../service/AuditReadPlatformServiceImpl.java | 4 +- ...CommandSourceWritePlatformServiceImpl.java | 2 +- .../AccountNumberFormatEnumerations.java | 10 ++--- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../TemplatePopulateImportConstants.java | 30 ++++++------- .../center/CenterImportHandler.java | 2 +- .../ChartOfAccountsImportHandler.java | 2 +- .../client/ClientEntityImportHandler.java | 2 +- .../client/ClientPersonImportHandler.java | 2 +- .../FixedDepositImportHandler.java | 2 +- .../FixedDepositTransactionImportHandler.java | 2 +- .../group/GroupImportHandler.java | 2 +- .../guarantor/GuarantorImportHandler.java | 2 +- .../JournalEntriesImportHandler.java | 2 +- .../importhandler/loan/LoanImportHandler.java | 2 +- .../LoanRepaymentImportHandler.java | 2 +- .../office/OfficeImportHandler.java | 2 +- .../RecurringDepositImportHandler.java | 2 +- ...urringDepositTransactionImportHandler.java | 2 +- .../savings/SavingsImportHandler.java | 2 +- .../SavingsTransactionImportHandler.java | 2 +- .../SharedAccountImportHandler.java | 2 +- .../staff/StaffImportHandler.java | 2 +- .../users/UserImportHandler.java | 2 +- .../populator/AbstractWorkbookPopulator.java | 2 +- .../ChartOfAccountsWorkbook.java | 2 +- .../FixedDepositWorkbookPopulator.java | 2 +- .../LoanRepaymentWorkbookPopulator.java | 2 +- .../service/BulkImportEventListener.java | 2 +- ...ulkImportWorkbookPopulatorServiceImpl.java | 2 +- .../BulkImportWorkbookServiceImpl.java | 2 +- ...mpaignWritePlatformCommandHandlerImpl.java | 2 +- .../EmailMessageJobEmailServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../service/SmsCampaignDomainServiceImpl.java | 2 +- ...mpaignDropdownReadPlatformServiceImpl.java | 2 +- ...msCampaignWritePlatformServiceJpaImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../infrastructure/core/api/DateAdapter.java | 2 +- .../core/boot/ApplicationExitUtil.java | 2 +- .../core/boot/JDBCDriverConfig.java | 6 +-- .../core/exception/MultiException.java | 2 +- ...tatableCommandFromApiJsonDeserializer.java | 4 +- ...onedConnectionCleanupShutdownListener.java | 2 +- .../core/service/SearchParameters.java | 2 +- .../service/TenantDatabaseUpgradeService.java | 2 +- .../api/DatatablesApiResource.java | 2 +- .../api/EntityDatatableChecksApiResource.java | 2 +- ...tatableChecksWritePlatformServiceImpl.java | 2 +- .../service/GenericDataServiceImpl.java | 2 +- .../service/ReadReportingServiceImpl.java | 4 +- .../ReadWriteNonCoreDataServiceImpl.java | 10 ++--- .../ReportWritePlatformServiceImpl.java | 2 +- .../FileSystemContentRepository.java | 2 +- .../S3ContentRepository.java | 2 +- .../documentmanagement/data/ImageData.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../FineractEntityAccessReadServiceImpl.java | 2 +- .../FineractEntityAccessWriteServiceImpl.java | 2 +- .../hooks/processor/ProcessorHelper.java | 2 +- .../hooks/processor/TwilioHookProcessor.java | 2 +- .../hooks/processor/WebHookService.java | 10 ++--- .../jobs/service/JobRegisterServiceImpl.java | 2 +- .../service/SchedulerTriggerListener.java | 2 +- .../reportmailingjob/helper/IPv4Helper.java | 2 +- .../ReportMailingJobEmailServiceImpl.java | 2 +- ...ortMailingJobWritePlatformServiceImpl.java | 4 +- .../TenantAwareBasicAuthenticationFilter.java | 2 +- .../TenantAwareTenantIdentifierFilter.java | 2 +- ...SpringSecurityPlatformSecurityContext.java | 2 +- .../security/utils/ColumnValidator.java | 2 +- .../security/utils/SQLBuilder.java | 2 +- .../security/utils/SQLInjectionValidator.java | 12 ++--- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../survey/api/PovertyLineApiConstants.java | 2 +- .../survey/api/SurveyApiConstants.java | 2 +- .../survey/data/ClientScoresOverview.java | 14 +++--- .../survey/data/LikelihoodStatus.java | 4 +- .../service/WriteLikelihoodServiceImpl.java | 2 +- .../service/InteropServiceImpl.java | 2 +- .../mix/service/XBRLResultServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../OfficeReadPlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../ProvisioningCriteriaConstants.java | 44 +++++++++---------- ...ingCriteriaDefinitionJsonDeserializer.java | 8 ++-- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../staff/domain/StaffRepository.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../data/CashierTransactionDataValidator.java | 2 +- .../TellerWritePlatformServiceJpaImpl.java | 2 +- .../organisation/teller/util/DateRange.java | 2 +- .../AccountTransfersApiResourceSwagger.java | 10 ++--- ...gInstructionHistoryApiResourceSwagger.java | 2 +- .../domain/StandingInstructionRepository.java | 4 +- ...ntAssociationsReadPlatformServiceImpl.java | 2 +- ...ngInstructionWritePlatformServiceImpl.java | 2 +- ...sReadPlatformServiceJpaRepositoryImpl.java | 2 +- .../api/AccountsApiResourceSwagger.java | 18 ++++---- .../calendar/service/CalendarUtils.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../api/ClientAddressApiResourcesSwagger.java | 10 ++--- .../api/ClientChargesApiResourceSwagger.java | 12 ++--- .../ClientIdentifiersApiResourceSwagger.java | 14 +++--- .../ClientTransactionsApiResourceSwagger.java | 6 +-- .../client/api/ClientsApiResourceSwagger.java | 24 +++++----- .../client/domain/AccountNumberGenerator.java | 14 +++--- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...FamilyMembersWritePlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../CollectionSheetApiResourceSwagger.java | 4 +- .../api/FloatingRatesApiResourceSwagger.java | 12 ++--- .../FloatingRateWritePlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../group/api/CentersApiResourceSwagger.java | 22 +++++----- .../group/api/GroupsApiResourceSwagger.java | 24 +++++----- .../CenterReadPlatformServiceImpl.java | 2 +- .../service/GroupReadPlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...erestRateChartSlabsApiResourceSwagger.java | 6 +-- .../InterestRateChartsApiResourceSwagger.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../api/LoanScheduleApiResourceSwagger.java | 4 +- .../LoanTransactionsApiResourceSwagger.java | 12 ++--- .../api/LoansApiResourceSwagger.java | 12 ++--- ...ritePlatformServiceJpaRepositoryIImpl.java | 2 +- .../RescheduleLoansApiConstants.java | 2 +- ...heduleRequestWritePlatformServiceImpl.java | 2 +- .../LoanAccrualPlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../service/LoanArrearsAgingServiceImpl.java | 2 +- .../service/LoanSchedularServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../service/RecalculateInterestPoster.java | 2 +- .../api/LoanProductsApiResourceSwagger.java | 14 +++--- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../note/api/NotesApiResourceSwagger.java | 14 +++--- .../api/PaymentTypeApiResourceSwagger.java | 14 +++--- .../api/ProductsApiResourceSwagger.java | 10 ++--- .../rate/service/RateWriteServiceImpl.java | 2 +- ...ixedDepositAccountsApiResourceSwagger.java | 20 ++++----- ...ixedDepositProductsApiResourceSwagger.java | 14 +++--- ...AccountTransactionsApiResourceSwagger.java | 10 ++--- ...ringDepositAccountsApiResourceSwagger.java | 20 ++++----- ...ringDepositProductsApiResourceSwagger.java | 14 +++--- ...vingsAccountChargesApiResourceSwagger.java | 20 ++++----- .../SavingsAccountsApiResourceSwagger.java | 20 ++++----- .../SavingsProductsApiResourceSwagger.java | 16 +++---- .../domain/SavingsAccountAssembler.java | 2 +- ...DepositAccountReadPlatformServiceImpl.java | 6 +-- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...DepositProductReadPlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../service/SavingsSchedularServiceImpl.java | 2 +- ...SelfAccountTransferApiResourceSwagger.java | 6 +-- ...elfBeneficiariesTPTApiResourceSwagger.java | 14 +++--- .../api/SelfClientsApiResourceSwagger.java | 14 +++--- .../api/SelfLoansApiResourceSwagger.java | 20 ++++----- .../pockets/api/PocketApiResourceSwagger.java | 6 +-- .../SelfRunReportApiResourceSwagger.java | 2 +- .../api/SelfSavingsApiResourceSwagger.java | 8 ++-- .../SelfAuthenticationApiResourceSwagger.java | 2 +- .../api/SelfUserApiResourceSwagger.java | 4 +- .../SelfUserDetailsApiResourceSwagger.java | 2 +- .../SelfShareAccountsApiResourceSwagger.java | 8 ++-- ...urchasedSharesReadPlatformServiceImpl.java | 2 +- ...eAccountChargeReadPlatformServiceImpl.java | 2 +- .../ShareAccountReadPlatformServiceImpl.java | 8 ++-- .../ShareProductReadPlatformServiceImpl.java | 2 +- .../api/TaxComponentApiResourceSwagger.java | 10 ++--- .../tax/api/TaxGroupApiResourceSwagger.java | 8 ++-- .../ScheduledJobRunnerServiceImpl.java | 2 +- .../service/TemplateMergeService.java | 2 +- .../useradministration/domain/AppUser.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../PermissionReadPlatformServiceImpl.java | 2 +- ...WritePlatformServiceJpaRepositoryImpl.java | 2 +- .../org/apache/fineract/common/Utils.java | 2 +- .../mix/report/service/XBRLBuilderTest.java | 2 +- .../fineract/notification/Listener.java | 2 +- 299 files changed, 631 insertions(+), 601 deletions(-) diff --git a/fineract-provider/build.gradle b/fineract-provider/build.gradle index 8e8bec066..e4cd4b95d 100644 --- a/fineract-provider/build.gradle +++ b/fineract-provider/build.gradle @@ -210,9 +210,38 @@ spotless { eclipse().configFile '../config/fineractdev-formatter.xml' endWithNewline() trimTrailingWhitespace() + + // Enforce style modifier order + custom 'Modifier ordering', { + def modifierRanking = [ + public : 1, + protected : 2, + private : 3, + abstract : 4, + default : 5, + static : 6, + final : 7, + transient : 8, + volatile : 9, + synchronized: 10, + native : 11, + strictfp : 12] + // Find any instance of multiple modifiers. Lead with a non-word character to avoid + // accidental matching against for instance, "an alternative default value" + it.replaceAll(/\W(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, { + // Do not replace the leading non-word character. Identify the modifiers + it.replaceAll(/(?:public |protected |private |abstract |default |static |final |transient |volatile |synchronized |native |strictfp ){2,}/, { + // Sort the modifiers according to the ranking above + it.split().sort({ modifierRanking[it] }).join(' ') + ' ' + } + ) + } + ) + } + } - lineEndings 'UNIX' + lineEndings 'UNIX' } rat { diff --git a/fineract-provider/config/checkstyle/checkstyle.xml b/fineract-provider/config/checkstyle/checkstyle.xml index 01ad7efe7..5720b78a5 100644 --- a/fineract-provider/config/checkstyle/checkstyle.xml +++ b/fineract-provider/config/checkstyle/checkstyle.xml @@ -173,6 +173,7 @@ value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/> +