Skip to content

refactor: simplify LinkShareViewHolder.setSubline()#16463

Draft
joshtrichards wants to merge 7 commits intomasterfrom
jtr/refactor-downloadLimit
Draft

refactor: simplify LinkShareViewHolder.setSubline()#16463
joshtrichards wants to merge 7 commits intomasterfrom
jtr/refactor-downloadLimit

Conversation

@joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented Feb 7, 2026

Changes:

  • fix: Replace toInt() with NumberFormat.parse() to handle locale-specific grouping separators (e.g., "1,000" or "1.000"). Add validation for empty and negative inputs with inline error messages.
  • refactor: use NumberFormat consistently
  • refactor: remove redundant null check (already handled by remainingDownloadLimit())
  • refactor: miscellaneous code tidying
  • docs: miscellaneous additions/clarifications/tidying

Also addresses CI/CD detekt output:

/home/runner/actions-runner/_work/android/android/app/src/main/java/com/owncloud/android/ui/adapter/LinkShareViewHolder.kt - 10min debt
	ReturnCount - [Function setSubline has 3 return statements which exceeds the limit of 2.] at /home/runner/actions-runner/_work/android/android/app/src/main/java/com/owncloud/android/ui/adapter/LinkShareViewHolder.kt:101:17

No functional changes - simplifies logic while maintaining identical behavior.

  • Tests written, or not not needed

Changes:
- Remove redundant fileDownloadLimit null check (already handled by
  remainingDownloadLimit() extension function)
- Remove unnecessary intermediate variable
- Add KDoc documenting the method's behavior

No functional changes - simplifies logic while maintaining identical
behavior.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
And also guard against <0 while permitting 0

Signed-off-by: Josh <josh.t.richards@gmail.com>
Replace toInt() with NumberFormat.parse() to handle locale-specific
grouping separators (e.g., "1,000" or "1.000"). Add validation for
empty and negative inputs with inline error messages.

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@github-actions
Copy link

github-actions bot commented Feb 7, 2026

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

@github-actions
Copy link

github-actions bot commented Feb 7, 2026

test-Unit test failed, but no output was generated. Maybe a preliminary stage failed.

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.

1 participant