Skip to content

Conversation

RubenHalman
Copy link
Contributor

This PR improves the Hardcoded ID rule in Lightning Flow Scanner by replacing the existing prefix-based approach with a more efficient and generic regex:

/[a-zA-Z0-9]{5}0[a-zA-Z0-9]{9}([a-zA-Z0-9]{3})?/gi

✅ More Accurate Detection – The new regex directly matches Salesforce IDs based on their structure:

- Starts with 5 alphanumeric characters
- 6th character is always "0"
- Followed by 9 more alphanumeric characters
- Optionally includes 3-character checksum (for 18-character IDs)

✅ Performance Boost – Eliminates the need to check against a static list of prefixes.

✅ Maintenance Reduction – Removed JSON files containing all Salesforce object ID prefixes, which were previously a maintenance burden, requiring constant updates for new object types.

Let me know if you’d like any tweaks! 😊
PS: I used git commit --no-verify -m since there were ESLint errors showing on existing files preventing a commit.

@RubenHalman RubenHalman added the enhancement New feature or request label Mar 7, 2025
@junners junners merged commit ad1b90c into master Mar 7, 2025
3 checks passed
@junners junners deleted the hardcodedids branch March 7, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants