Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Aman-Mittal
Copy link
Contributor

@Aman-Mittal Aman-Mittal commented Aug 24, 2025

Description

This PR introduces a series of code improvements across multiple modules of the Fineract codebase, focusing on the following:

Consistent Usage of Constants: Replaces hard-coded parameter strings with static final constants for maintainability and to reduce typos, especially in charge-related domain logic.
Refactoring for Readability and Conciseness: Refactors lambda expressions, string handling, and API annotations for improved readability and conciseness.
API and Enum String Improvements: Simplifies and standardizes the use of replaceAll("", " ") with replace("", " ") in enums' toString() methods for better performance and clarity.
Annotation and Parameter Handling Enhancements: Refactors repeated annotation arrays into single annotations when only one response is present, and utilizes parameter constants in APIs for uniformity.
Minor Logic Improvements: Streamlines logic checks and improves predicate usage to leverage Java language features more effectively.
Detailed Changes
fineract-charge:

Introduces constants for frequently used parameter names in the Charge domain class.
Refactors code to use these constants instead of string literals.
Improves validation, update logic, and makes locale handling more explicit.
fineract-accounting/closure/api:

Refactors OpenAPI annotations for clarity and removes unnecessary arrays where only one response is used.
Uses multi-line string for improved documentation readability.
fineract-core:

Updates enums to use replace("", " ") instead of replaceAll("", " ") for the toString method.
Refactors parameter name handling in API helpers for consistency.
fineract-investor:

Streamlines branch closure checks in accounting helpers.
Uses parameter constants in API resources for command handling, improving code maintainability and reducing duplication.
fineract-loan:

Updates enum string conversion as above for consistency.
fineract-progressive-loan:

Refactors predicates in the advanced payment schedule transaction processor to use concise lambda syntax.
Other Minor Updates:

Cleans up test step definitions in Acme modules for better clarity and removes commented-out code.
Adds missing constants and improves readability in calendar recurrence utilities.
Motivation
Reduce duplication and risk of typos by centralizing parameter names.
Improve code readability and maintainability.
Standardize how string replacements are performed in enums.
Ensure OpenAPI annotations are concise and maintainable.
Leverage Java language features for more concise lambda and predicate definitions.
Impact
No functional changes or breaking API modifications.
Internal refactoring to aid future development and reduce maintenance overhead.
Improved clarity for contributors and API consumers.

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Write the commit message as per https://github.com/apache/fineract/#pull-requests
  • Acknowledge that we will not review PRs that are not passing the build ("green") - it is your responsibility to get a proposed PR to pass the build, not primarily the project's maintainers.
  • Create/update unit or integration tests for verifying the changes made.
  • Follow coding conventions at https://cwiki.apache.org/confluence/display/FINERACT/Coding+Conventions.
  • Add required Swagger annotation and update API documentation at fineract-provider/src/main/resources/static/legacy-docs/apiLive.htm with details of any API changes
  • Submission is not a "code dump". (Large changes can be made "in repository" via a branch. Ask on the developer mailing list for guidance, if required.)

FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.

@Aman-Mittal
Copy link
Contributor Author

#4959

Re Raised with squash commits

@Aman-Mittal
Copy link
Contributor Author

@galovics Please run workflow and review.
Aman-Mittal@bebed72

final boolean active = command.booleanPrimitiveValueOfParameterNamed("active");
final MonthDay feeOnMonthDay = command.extractMonthDayNamed("feeOnMonthDay");
final Integer feeInterval = command.integerValueOfParameterNamed("feeInterval");
final MonthDay feeOnMonthDay = command.extractMonthDayNamed(FEE_ON_MONTH_DAT_PARAM_NAME);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FEE_ON_MONTH_DAT_PARAM_NAME typo in the name. It should be FEE_ON_MONTH_DAY_PARAM_NAME, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed now

}

public static final String CHARGE_TIME_PARAM_NAME = "chargeTimeType";
public static final String CHARGE_CALCULATION_TIME_PARAM_NAME = "chargeCalculationType";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For chargeCalculationType param this should be rather named to CHARGE_CALCULATION_TYPE_PARAM_NAME, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

humanReadable = "Daily";
} else {
humanReadable = "Every " + recur.getInterval() + " days";
humanReadable = every + recur.getInterval() + " days";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary change... does not help on the readability...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted this change

@Aman-Mittal Aman-Mittal force-pushed the FINERACT-2346/sonarqube-fixes branch from 908a70e to d8a8e2f Compare August 28, 2025 11:29
@Aman-Mittal Aman-Mittal marked this pull request as draft August 28, 2025 11:53
@Aman-Mittal Aman-Mittal force-pushed the FINERACT-2346/sonarqube-fixes branch 2 times, most recently from 9fe8151 to f68c48f Compare August 28, 2025 12:00
@Aman-Mittal Aman-Mittal marked this pull request as ready for review August 28, 2025 12:16
@Aman-Mittal Aman-Mittal force-pushed the FINERACT-2346/sonarqube-fixes branch from f68c48f to b649334 Compare August 28, 2025 15:37
@Aman-Mittal
Copy link
Contributor Author

@adamsaghy

Need to update the kafka image tag as current image pull will not work

Run docker compose -f docker-compose-postgresql-kafka.yml up --scale fineract-worker=1 -d
time="2025-08-29T04:41:07Z" level=warning msg="/home/runner/work/fineract/fineract/docker-compose-postgresql-kafka.yml: the attribute version is obsolete, it will be ignored, please remove it to avoid potential confusion"
db Pulling
kafka Pulling
kafka Error manifest for bitnami/kafka:4.0.0-debian-12-r2 not found: manifest unknown: manifest unknown
db Interrupted
Error response from daemon: manifest for bitnami/kafka:4.0.0-debian-12-r2 not found: manifest unknown: manifest unknown

according to website

Important Notice: Upcoming changes to the Bitnami Catalog
This image is part of the brownout announced at https://github.com/bitnami/containers/issues/83267⁠

Beginning August 28th, 2025, Bitnami will evolve its public catalog to offer a curated set of hardened, security-focused images under the new Bitnami Secure Images initiative⁠. As part of this transition:

Bitnami will begin deprecating support for non-hardened, Debian-based software images in its free tier and will gradually remove tags from the public catalog. As a result, community users will have access to a reduced number of hardened images. These images are published only under the “latest” tag and are intended for development purposes
All existing container images have been migrated from the public catalog (docker.io/bitnami) to the “Bitnami Legacy” repository (docker.io/bitnamilegacy), where they will no longer receive updates.
For production workloads and long-term support, users are encouraged to adopt Bitnami Secure Images, which include hardened containers, smaller attack surfaces, CVE transparency (via VEX/KEV), SBOMs, and enterprise support.
These changes aim to improve the security posture of all Bitnami users by promoting best practices for software supply chain integrity and up-to-date deployments. For more details, visit the Bitnami Secure Images announcement⁠.

for rest you can run the workflow again

@Aman-Mittal
Copy link
Contributor Author

Aman-Mittal commented Aug 29, 2025

I have ran the workflow in my fork aside from kafka all checks are passing accept kafka

Aman-Mittal@b649334

@Aman-Mittal Aman-Mittal requested a review from adamsaghy August 29, 2025 15:21
@IOhacker
Copy link
Contributor

IOhacker commented Sep 4, 2025

LGTM

Comment on lines +91 to +107
@Operation(summary = "Retrieve an Accounting Closure", description = """
Example Requests:
glclosures/1
/glclosures/1?fields=officeName,closingDate""")
Copy link
Contributor

@adamsaghy adamsaghy Sep 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing one place the description to use textblock, but left the others unchanged is not an improvement. Please either undo it or change everywhere!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done as suggested replaced all description Types to textbox that i can find.

Comment on lines 783 to 789

public static final String CHARGE_TIME_PARAM_NAME = "chargeTimeType";
public static final String CHARGE_CALCULATION_TYPE_PARAM_NAME = "chargeCalculationType";
public static final String FEE_ON_MONTH_DAY_PARAM_NAME = "feeOnMonthDay";
public static final String FEE_INTERVAL_PARAM_NAME = "feeInterval";
public static final String LOCALE_PARAM_NAME = "locale";
public static final String FEE_FREQUENCY_PARAM_NAME = "feeFrequency";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be on the top of the class, not at the bottom.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@adamsaghy adamsaghy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please kindly see my review!

@Aman-Mittal Aman-Mittal force-pushed the FINERACT-2346/sonarqube-fixes branch from b649334 to 440b7f0 Compare September 23, 2025 15:25
@Aman-Mittal Aman-Mittal force-pushed the FINERACT-2346/sonarqube-fixes branch from 440b7f0 to b478abc Compare September 23, 2025 16:47
@Aman-Mittal
Copy link
Contributor Author

@adamsaghy Please rerun workflow and review my changes again.

Workflow run crosschecked at my forked branch
Aman-Mittal@b478abc

@adamsaghy adamsaghy merged commit c50113a into apache:develop Oct 15, 2025
42 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants