[ 
https://issues.apache.org/jira/browse/FINERACT-2627?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Berk Emir updated FINERACT-2627:
--------------------------------
    Description: 
SonarCloud rule java:S1155 ("Collection.isEmpty() should be used to test
for emptiness") flags multiple occurrences across the codebase where
collection emptiness is checked with `collection.size() > 0` (or `== 0`)
instead of `!collection.isEmpty()` / `collection.isEmpty()`.

This ticket started as a cleanup of the 5 occurrences in
`LoanRepositoryWrapper` (fineract-loan), and is being extended — at the
maintainer's request (see PR #5945) — to cover the remaining modules
across the codebase.

The change is purely a readability/consistency cleanup: `!collection.isEmpty()`
is equivalent to `collection.size() > 0`, so there is no behavioural, API,
or schema impact. JsonArray checks and index-bound `size()` usages are
intentionally left untouched.

Note: the fineract-savings module is covered separately in FINERACT-2630
and is therefore excluded from this ticket.

  was:
SonarCloud flags 5 occurrences in LoanRepositoryWrapper (fineract-loan module)
where collection emptiness is checked with `loans.size() > 0` instead of
`!loans.isEmpty()` (Sonar rule java:S1155).

This change replaces all 5 occurrences with `!Collection.isEmpty()`.
The behavior is identical; this is a readability/consistency cleanup only.

File: 
fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepositoryWrapper.java

        Summary: Use Collection.isEmpty() instead of size() comparison across 
the codebase  (was: Use Collection.isEmpty() instead of size() comparison in 
LoanRepositoryWrapper)

> Use Collection.isEmpty() instead of size() comparison across the codebase
> -------------------------------------------------------------------------
>
>                 Key: FINERACT-2627
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2627
>             Project: Apache Fineract
>          Issue Type: Improvement
>          Components: Loan
>            Reporter: Berk Emir
>            Priority: Minor
>
> SonarCloud rule java:S1155 ("Collection.isEmpty() should be used to test
> for emptiness") flags multiple occurrences across the codebase where
> collection emptiness is checked with `collection.size() > 0` (or `== 0`)
> instead of `!collection.isEmpty()` / `collection.isEmpty()`.
> This ticket started as a cleanup of the 5 occurrences in
> `LoanRepositoryWrapper` (fineract-loan), and is being extended — at the
> maintainer's request (see PR #5945) — to cover the remaining modules
> across the codebase.
> The change is purely a readability/consistency cleanup: 
> `!collection.isEmpty()`
> is equivalent to `collection.size() > 0`, so there is no behavioural, API,
> or schema impact. JsonArray checks and index-bound `size()` usages are
> intentionally left untouched.
> Note: the fineract-savings module is covered separately in FINERACT-2630
> and is therefore excluded from this ticket.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to