You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: compose-stability-analyzer-idea/src/main/kotlin/com/skydoves/compose/stability/idea/settings/StabilityProjectSettingsState.kt
+1-4Lines changed: 1 addition & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -71,10 +71,7 @@ public class StabilityProjectSettingsState :
Copy file name to clipboardExpand all lines: compose-stability-analyzer-idea/src/main/kotlin/com/skydoves/compose/stability/idea/settings/StabilitySettingsState.kt
+42-10Lines changed: 42 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -144,11 +144,7 @@ public class StabilitySettingsState : PersistentStateComponent<StabilitySettings
144
144
.filter { it.isNotEmpty() &&!it.startsWith("#") } // Support comments
145
145
.map { pattern ->
146
146
try {
147
-
// Convert glob-style wildcards to regex
148
-
pattern
149
-
.replace(".", "\\.")
150
-
.replace("*", ".*")
151
-
.toRegex()
147
+
stabilityPatternToRegex(pattern)
152
148
} catch (e:Exception) {
153
149
// If regex is invalid, treat as literal string
154
150
Regex.escape(pattern).toRegex()
@@ -183,11 +179,7 @@ public class StabilitySettingsState : PersistentStateComponent<StabilitySettings
183
179
// Convert patterns to regex
184
180
patterns.mapNotNull { pattern ->
185
181
try {
186
-
// Convert glob-style wildcards to regex
187
-
pattern
188
-
.replace(".", "\\.")
189
-
.replace("*", ".*")
190
-
.toRegex()
182
+
stabilityPatternToRegex(pattern)
191
183
} catch (e:Exception) {
192
184
null// Skip invalid patterns
193
185
}
@@ -203,3 +195,43 @@ public class StabilitySettingsState : PersistentStateComponent<StabilitySettings
203
195
}
204
196
}
205
197
}
198
+
199
+
/**
200
+
* Converts a Compose stability configuration pattern to a [Regex].
201
+
*
202
+
* Follows the same semantics as the Compose compiler's stability configuration file:
203
+
* - `**` matches any sequence of characters including dots (multi-segment wildcard)
204
+
* - `*` matches any sequence of characters except dots (single-segment wildcard)
205
+
* - `.` is treated as a literal dot
206
+
* - All other characters are regex-escaped
207
+
*
208
+
* Examples:
209
+
* - `com.datalayer.*` matches `com.datalayer.Foo` but NOT `com.datalayer.sub.Foo`
210
+
* - `com.datalayer.**` matches `com.datalayer.Foo` AND `com.datalayer.sub.Foo`
Copy file name to clipboardExpand all lines: compose-stability-analyzer-idea/src/test/kotlin/com/skydoves/compose/stability/idea/settings/StabilitySettingsStateTest.kt
+47-9Lines changed: 47 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -114,8 +114,9 @@ class StabilitySettingsStateTest {
114
114
val patterns = settings.getIgnoredPatternsAsRegex()
115
115
assertEquals(1, patterns.size)
116
116
117
+
// Single * matches only one package segment (no dots)
0 commit comments