Added Empty Statement Check and enforced checkstyle

This commit is contained in:
thesmallstar
2020-05-15 19:43:16 +02:00
committed by Michael Vorburger ⛑️
parent 297e483742
commit 9eccd61333
14 changed files with 24 additions and 27 deletions
@@ -59,7 +59,7 @@
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/> <property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
</module> </module>
<module name="OneStatementPerLine"/> <module name="OneStatementPerLine"/>
<module name="EmptyStatement"/>
<!-- TODO Enable many more checks (go about this one by one, step by step, raise separate PRs fixing and then enforcing): <!-- TODO Enable many more checks (go about this one by one, step by step, raise separate PRs fixing and then enforcing):
<module name="HiddenField"> <module name="HiddenField">
@@ -68,7 +68,6 @@
<property name="ignoreSetter" value="true" /> <property name="ignoreSetter" value="true" />
<property name="setterCanReturnItsClass" value="true" /> <property name="setterCanReturnItsClass" value="true" />
</module> </module>
<module name="EmptyStatement"/>
<module name="FinalClass"/> <module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/> <module name="HideUtilityClassConstructor"/>
@@ -73,7 +73,7 @@ public class GlobalConfigInterestChargedFromDateSameAsDisbursalDateTest {
.toString(); .toString();
Integer updateConfigId = this.globalConfigurationHelper Integer updateConfigId = this.globalConfigurationHelper
.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec, .updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec,
configId.toString(), newBooleanValue);; configId.toString(), newBooleanValue);
Assert.assertNotNull(updateConfigId); Assert.assertNotNull(updateConfigId);
break; break;
} }
@@ -73,17 +73,17 @@ public class ProvisioningTransactionHelper {
} }
public Map retrieveProvisioningEntry(final Integer provisioningEntry) { public Map retrieveProvisioningEntry(final Integer provisioningEntry) {
String url = "/fineract-provider/api/v1/provisioningentries/"+provisioningEntry+"?"+Utils.TENANT_IDENTIFIER; ; String url = "/fineract-provider/api/v1/provisioningentries/"+provisioningEntry+"?"+Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, url, "") ; return Utils.performServerGet(requestSpec, responseSpec, url, "") ;
} }
public Map retrieveProvisioningEntries(final Integer provisioningEntry) { public Map retrieveProvisioningEntries(final Integer provisioningEntry) {
String url = "/fineract-provider/api/v1/provisioningentries/entries?entryId="+provisioningEntry+"&"+Utils.TENANT_IDENTIFIER; ; String url = "/fineract-provider/api/v1/provisioningentries/entries?entryId="+provisioningEntry+"&"+Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, url, "") ; return Utils.performServerGet(requestSpec, responseSpec, url, "") ;
} }
public Map retrieveAllProvisioningEntries() { public Map retrieveAllProvisioningEntries() {
String url = "/fineract-provider/api/v1/provisioningentries?dateFormat=dd MMMM yyyy"+"&"+"locale=en"+"&"+Utils.TENANT_IDENTIFIER; ; String url = "/fineract-provider/api/v1/provisioningentries?dateFormat=dd MMMM yyyy"+"&"+"locale=en"+"&"+Utils.TENANT_IDENTIFIER;
return Utils.performServerGet(requestSpec, responseSpec, url, "") ; return Utils.performServerGet(requestSpec, responseSpec, url, "") ;
} }
@@ -222,7 +222,7 @@ public class CenterImportHandler implements ImportHandler {
gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat)); gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat));
Type groupCollectionType = new TypeToken<Collection<GroupGeneralData>>() {}.getType(); Type groupCollectionType = new TypeToken<Collection<GroupGeneralData>>() {}.getType();
gsonBuilder.registerTypeAdapter(groupCollectionType,new GroupIdSerializer()); gsonBuilder.registerTypeAdapter(groupCollectionType,new GroupIdSerializer());
String payload= gsonBuilder.create().toJson(centers.get(rowIndex));; String payload= gsonBuilder.create().toJson(centers.get(rowIndex));
final CommandWrapper commandRequest = new CommandWrapperBuilder() // final CommandWrapper commandRequest = new CommandWrapperBuilder() //
.createCenter() // .createCenter() //
.withJson(payload) // .withJson(payload) //
@@ -238,7 +238,7 @@ public class GroupImportHandler implements ImportHandler {
gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat)); gsonBuilder.registerTypeAdapter(LocalDate.class, new DateSerializer(dateFormat));
Type clientCollectionType = new TypeToken<Collection<ClientData>>() {}.getType(); Type clientCollectionType = new TypeToken<Collection<ClientData>>() {}.getType();
gsonBuilder.registerTypeAdapter(clientCollectionType,new ClientIdSerializer()); gsonBuilder.registerTypeAdapter(clientCollectionType,new ClientIdSerializer());
String payload= gsonBuilder.create().toJson(groups.get(rowIndex));; String payload= gsonBuilder.create().toJson(groups.get(rowIndex));
final CommandWrapper commandRequest = new CommandWrapperBuilder() // final CommandWrapper commandRequest = new CommandWrapperBuilder() //
.createGroup() // .createGroup() //
.withJson(payload) // .withJson(payload) //
@@ -318,7 +318,7 @@ public class LoanImportHandler implements ImportHandler {
CommandProcessingResult result=null; CommandProcessingResult result=null;
loanId=""; loanId="";
try { try {
String status = statuses.get(i);; String status = statuses.get(i);
progressLevel = getProgressLevel(status); progressLevel = getProgressLevel(status);
if (progressLevel == 0&& loans.get(i)!=null) { if (progressLevel == 0&& loans.get(i)!=null) {
@@ -264,7 +264,7 @@ public class SavingsImportHandler implements ImportHandler {
if (progressLevel == 0) { if (progressLevel == 0) {
CommandProcessingResult result = importSavings(i,dateFormat); CommandProcessingResult result = importSavings(i,dateFormat);
savingsId = result.getSavingsId();; savingsId = result.getSavingsId();
progressLevel = 1; progressLevel = 1;
} else } else
savingsId = ImportHandlerUtils.readAsLong(SavingsConstants.SAVINGS_ID_COL, savingsSheet.getRow(savings.get(i).getRowIndex())); savingsId = ImportHandlerUtils.readAsLong(SavingsConstants.SAVINGS_ID_COL, savingsSheet.getRow(savings.get(i).getRowIndex()));
@@ -490,7 +490,7 @@ private WorkbookPopulator populateCenterWorkbook(Long officeId,Long staffId){
if (officeId!=null) { if (officeId!=null) {
String activeAccounts="sa.status_enum = 300"; String activeAccounts="sa.status_enum = 300";
SearchParameters searchParameters = SearchParameters.from(activeAccounts, officeId, null, null, null); SearchParameters searchParameters = SearchParameters.from(activeAccounts, officeId, null, null, null);
savingsAccounts = savingsAccountReadPlatformService.retrieveAll(searchParameters).getPageItems();; savingsAccounts = savingsAccountReadPlatformService.retrieveAll(searchParameters).getPageItems();
}else { }else {
savingsAccounts= savingsAccountReadPlatformService.retrieveAll(null).getPageItems(); savingsAccounts= savingsAccountReadPlatformService.retrieveAll(null).getPageItems();
} }
@@ -100,7 +100,7 @@ public class ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl implement
if(this.provisioningEntriesReadPlatformService.retrieveProvisioningEntryDataByCriteriaId(criteriaId) != null) { if(this.provisioningEntriesReadPlatformService.retrieveProvisioningEntryDataByCriteriaId(criteriaId) != null) {
throw new ProvisioningCriteriaCannotBeDeletedException(criteriaId) ; throw new ProvisioningCriteriaCannotBeDeletedException(criteriaId) ;
} }
this.provisioningCriteriaRepository.deleteById(criteriaId); ; this.provisioningCriteriaRepository.deleteById(criteriaId);
return new CommandProcessingResultBuilder().withEntityId(criteriaId).build(); return new CommandProcessingResultBuilder().withEntityId(criteriaId).build();
} }
@@ -118,18 +118,18 @@ public class Address extends AbstractPersistableCustom {
this.latitude = latitude; this.latitude = latitude;
this.longitude = longitude; this.longitude = longitude;
this.createdBy = createdBy; this.createdBy = createdBy;
//this.createdOn = createdOn; // this.createdOn = createdOn;
this.updatedBy = updatedBy; this.updatedBy = updatedBy;
//this.updatedOn = updatedOn; // this.updatedOn = updatedOn;
if (createdOn != null) { if (createdOn != null) {
this.createdOn = createdOn.toDate(); this.createdOn = createdOn.toDate();
} }
if (updatedOn != null) { if (updatedOn != null) {
this.updatedOn = updatedOn.toDate(); this.updatedOn = updatedOn.toDate();
} }
} }
@@ -167,8 +167,6 @@ public class Address extends AbstractPersistableCustom {
final LocalDate updatedOn = command.localDateValueOfParameterNamed("updatedOn"); final LocalDate updatedOn = command.localDateValueOfParameterNamed("updatedOn");
return new Address(street, addressLine1, addressLine2, addressLine3, townVillage, city, countyDistrict, return new Address(street, addressLine1, addressLine2, addressLine3, townVillage, city, countyDistrict,
stateProvince, country, postalCode, latitude, longitude, createdBy, createdOn, updatedBy, updatedOn); stateProvince, country, postalCode, latitude, longitude, createdBy, createdOn, updatedBy, updatedOn);
} }
@@ -384,7 +382,7 @@ public class Address extends AbstractPersistableCustom {
} }
public void setUpdatedOn(LocalDate updatedOn) { public void setUpdatedOn(LocalDate updatedOn) {
this.updatedOn = updatedOn.toDate();; this.updatedOn = updatedOn.toDate();
} }
} }
@@ -268,7 +268,7 @@ public class LoanTransactionData {
final PaymentDetailData paymentDetailData = null; final PaymentDetailData paymentDetailData = null;
final CurrencyData currency = null; final CurrencyData currency = null;
final BigDecimal unrecognizedIncomePortion = null; final BigDecimal unrecognizedIncomePortion = null;
final BigDecimal principalPortion = null;; final BigDecimal principalPortion = null;
final BigDecimal interestPortion = null; final BigDecimal interestPortion = null;
final BigDecimal feeChargesPortion = null; final BigDecimal feeChargesPortion = null;
final BigDecimal penaltyChargesPortion = null; final BigDecimal penaltyChargesPortion = null;
@@ -279,7 +279,7 @@ public class TaxValidator {
.validateDateAfter(existing.startDate()); .validateDateAfter(existing.startDate());
} }
if(mapping.getTaxComponent()!= null && !existing.getTaxComponent().getId().equals(mapping.getTaxComponent().getId())){ if(mapping.getTaxComponent()!= null && !existing.getTaxComponent().getId().equals(mapping.getTaxComponent().getId())){
baseDataValidator.reset().parameter(TaxApiConstants.taxComponentIdParamName).failWithCode("update.not.supported");; baseDataValidator.reset().parameter(TaxApiConstants.taxComponentIdParamName).failWithCode("update.not.supported");
} }
} else if (mapping.endDate() != null) { } else if (mapping.endDate() != null) {
baseDataValidator.reset().parameter(TaxApiConstants.endDateParamName).failWithCode("not.supported.for.new.association"); baseDataValidator.reset().parameter(TaxApiConstants.endDateParamName).failWithCode("not.supported.for.new.association");
@@ -140,7 +140,7 @@ public class SpmApiResource {
public void activateOrDeactivateSurvey(@PathParam("id") final Long id, @QueryParam("command") final String command) { public void activateOrDeactivateSurvey(@PathParam("id") final Long id, @QueryParam("command") final String command) {
this.securityContext.authenticatedUser(); this.securityContext.authenticatedUser();
if(command != null && command.equalsIgnoreCase("activate")){ if(command != null && command.equalsIgnoreCase("activate")){
this.spmService.activateSurvey(id);; this.spmService.activateSurvey(id);
}else if(command != null && command.equalsIgnoreCase("deactivate")){ }else if(command != null && command.equalsIgnoreCase("deactivate")){
this.spmService.deactivateSurvey(id); this.spmService.deactivateSurvey(id);
}else{ }else{
@@ -82,7 +82,7 @@ public class Survey extends AbstractPersistableCustom {
public void setQuestions(List<Question> questions) { public void setQuestions(List<Question> questions) {
if(this.questions != null){ if(this.questions != null){
this.questions.clear();; this.questions.clear();
}else{ }else{
this.questions = new ArrayList<>(); this.questions = new ArrayList<>();
} }