Skip to content

formatLicensePlateWithDashes and handleCharacterDeletion use hard-coded literal indices#117

Merged
TomerPacific merged 6 commits intomainfrom
feature/extract-magic-numbers-formatLicensePlateWithDashes
Mar 20, 2026
Merged

formatLicensePlateWithDashes and handleCharacterDeletion use hard-coded literal indices#117
TomerPacific merged 6 commits intomainfrom
feature/extract-magic-numbers-formatLicensePlateWithDashes

Conversation

@TomerPacific
Copy link
Copy Markdown
Owner

Fixes #112

This pull request refactors the handling and formatting of Israeli license plate numbers in the LicensePlateNumberDialog.kt file to improve clarity and maintainability. The main changes involve replacing ambiguous constants with more descriptive ones and updating the formatting logic to use these new constants, making the code easier to understand and modify.

Refactoring and code clarity improvements:

  • Replaced generic dash index constants (FIRST_DASH_INDEX, SECOND_DASH_INDEX) with descriptive constants for 7- and 8-digit license plate formats (e.g., SEVEN_DIGIT_FIRST_DASH_INDEX, SEVEN_DIGIT_SECOND_DASH_INDEX, etc.), and added documentation explaining the different formats.
  • Updated the handleCharacterDeletion function to use the new descriptive constants for substring operations, improving readability and reducing the risk of errors.
  • Refactored the formatLicensePlateWithDashes function to use the new constants, aligning formatting logic with the clarified license plate formats.

@TomerPacific TomerPacific self-assigned this Mar 20, 2026
Copilot AI review requested due to automatic review settings March 20, 2026 11:47
@TomerPacific TomerPacific added invalid This doesn't seem right refactor refactoring and removed invalid This doesn't seem right labels Mar 20, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors Israeli license plate formatting/deletion logic in LicensePlateNumberDialog.kt by replacing hard-coded substring indices with named constants and adding brief documentation for the supported 7- and 8-digit formats.

Changes:

  • Added documented, descriptive constants for dash/group indices used during formatting.
  • Updated handleCharacterDeletion to use the new constants instead of literal indices.
  • Updated formatLicensePlateWithDashes to use the new constants for both 7- and 8-digit formatting paths.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@TomerPacific TomerPacific merged commit 6e124a8 into main Mar 20, 2026
5 checks passed
@TomerPacific TomerPacific deleted the feature/extract-magic-numbers-formatLicensePlateWithDashes branch March 20, 2026 14:36
@TomerPacific TomerPacific mentioned this pull request Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

formatLicensePlateWithDashes uses magic number string indices

2 participants