Fix flaky InternalApiUsageDetectorTest due to Kotlin reserved keywords in package regex#3522
Merged
Merged
Conversation
…s in package regex Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
InternalApiUsageDetectorTest due to Kotlin reserved keywords in package regex
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3522 +/- ##
===========================================
+ Coverage 72.21% 72.24% +0.02%
===========================================
Files 965 965
Lines 35643 35643
Branches 5948 5948
===========================================
+ Hits 25739 25747 +8
+ Misses 8278 8275 -3
+ Partials 1626 1621 -5 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes a flaky test in
InternalApiUsageDetectorTestwhere Forge-generated package names could contain Kotlin reserved keywords (e.g.org.do,com.datadog.for), causing the lint test runner to fail when parsing the generated Kotlin stubs.Motivation
The
@StringForgeryregex patterns(com|org|fr)\\.[a-z]{1,10}andcom\\.datadog(|\\.[a-z]{1,13})could generate segments likedo,for,fun,val, etc. — all reserved Kotlin keywords — as package name components. When embedded inpackagedeclarations inside lint test stubs, these caused anIllegalStateExceptionin the lint test runner.Fix: append
pkgto each variable-length segment, making it impossible for the generated value to be a reserved word.Additional Notes
No behaviour change — the tests only care whether the package starts with
com.datadogor not; the exact suffix is irrelevant to the detector logic.