pumuki 6.3.223 → 6.3.225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/facts/detectors/text/ios.test.ts +68 -0
- package/core/facts/detectors/text/ios.ts +16 -0
- package/core/facts/extractHeuristicFacts.ts +2 -0
- package/core/rules/presets/heuristics/ios.ts +38 -0
- package/integrations/config/skillsDetectorRegistry.ts +8 -0
- package/integrations/config/skillsMarkdownRules.ts +14 -0
- package/package.json +1 -1
- package/skills.lock.json +3 -3
|
@@ -35,6 +35,8 @@ import {
|
|
|
35
35
|
hasSwiftMixedTestingFrameworksUsage,
|
|
36
36
|
hasSwiftLegacyXCTestImportUsage,
|
|
37
37
|
hasSwiftModernizableXCTestSuiteUsage,
|
|
38
|
+
hasSwiftNonLazyScrollForEachUsage,
|
|
39
|
+
hasSwiftViewBodyObjectCreationUsage,
|
|
38
40
|
hasSwiftAssumeIsolatedUsage,
|
|
39
41
|
hasSwiftCoreDataLayerLeakUsage,
|
|
40
42
|
hasSwiftSwiftDataLayerLeakUsage,
|
|
@@ -123,6 +125,72 @@ test('hasSwiftAnyViewUsage ignora comentarios, strings y coincidencias parciales
|
|
|
123
125
|
assert.equal(hasSwiftAnyViewUsage(source), false);
|
|
124
126
|
});
|
|
125
127
|
|
|
128
|
+
test('hasSwiftNonLazyScrollForEachUsage detecta ScrollView con stack no lazy y preserva LazyVStack', () => {
|
|
129
|
+
const source = `
|
|
130
|
+
struct FeedView: View {
|
|
131
|
+
let items: [Item]
|
|
132
|
+
|
|
133
|
+
var body: some View {
|
|
134
|
+
ScrollView {
|
|
135
|
+
VStack(spacing: 12) {
|
|
136
|
+
ForEach(items) { item in
|
|
137
|
+
FeedRow(item: item)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
`;
|
|
144
|
+
const safe = `
|
|
145
|
+
struct FeedView: View {
|
|
146
|
+
let items: [Item]
|
|
147
|
+
|
|
148
|
+
var body: some View {
|
|
149
|
+
ScrollView {
|
|
150
|
+
LazyVStack(spacing: 12) {
|
|
151
|
+
ForEach(items) { item in
|
|
152
|
+
FeedRow(item: item)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
let sample = "ScrollView { VStack { ForEach(items) } }"
|
|
157
|
+
// ScrollView { VStack { ForEach(items) } }
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
`;
|
|
161
|
+
|
|
162
|
+
assert.equal(hasSwiftNonLazyScrollForEachUsage(source), true);
|
|
163
|
+
assert.equal(hasSwiftNonLazyScrollForEachUsage(safe), false);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
test('hasSwiftViewBodyObjectCreationUsage detecta formatter creado en body y preserva dependencia externa', () => {
|
|
167
|
+
const source = `
|
|
168
|
+
struct PriceView: View {
|
|
169
|
+
let amount: Decimal
|
|
170
|
+
|
|
171
|
+
var body: some View {
|
|
172
|
+
let formatter = NumberFormatter()
|
|
173
|
+
Text(formatter.string(from: amount as NSDecimalNumber) ?? "")
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
`;
|
|
177
|
+
const safe = `
|
|
178
|
+
struct PriceView: View {
|
|
179
|
+
let formatter: NumberFormatter
|
|
180
|
+
let amount: Decimal
|
|
181
|
+
|
|
182
|
+
var body: some View {
|
|
183
|
+
Text(formatter.string(from: amount as NSDecimalNumber) ?? "")
|
|
184
|
+
let sample = "var body: some View { NumberFormatter() }"
|
|
185
|
+
// var body: some View { NumberFormatter() }
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
`;
|
|
189
|
+
|
|
190
|
+
assert.equal(hasSwiftViewBodyObjectCreationUsage(source), true);
|
|
191
|
+
assert.equal(hasSwiftViewBodyObjectCreationUsage(safe), false);
|
|
192
|
+
});
|
|
193
|
+
|
|
126
194
|
test('hasSwiftForceTryUsage detecta try! y descarta try?', () => {
|
|
127
195
|
const positive = `
|
|
128
196
|
func load() {
|
|
@@ -380,6 +380,22 @@ export const hasSwiftAnyViewUsage = (source: string): boolean => {
|
|
|
380
380
|
});
|
|
381
381
|
};
|
|
382
382
|
|
|
383
|
+
export const hasSwiftNonLazyScrollForEachUsage = (source: string): boolean => {
|
|
384
|
+
const swiftSource = sanitizeSwiftSourceForMultilineRegex(source);
|
|
385
|
+
const nonLazyScrollableCollectionPattern =
|
|
386
|
+
/\bScrollView\s*(?:\([^)]*\))?\s*\{[\s\S]{0,2000}\b(?:VStack|HStack)\s*(?:\([^)]*\))?\s*\{[\s\S]{0,1200}\bForEach\s*\(/;
|
|
387
|
+
|
|
388
|
+
return nonLazyScrollableCollectionPattern.test(swiftSource);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
export const hasSwiftViewBodyObjectCreationUsage = (source: string): boolean => {
|
|
392
|
+
const swiftSource = sanitizeSwiftSourceForMultilineRegex(source);
|
|
393
|
+
const viewBodyObjectCreationPattern =
|
|
394
|
+
/\bvar\s+body\s*:\s*some\s+View\s*\{[\s\S]{0,2400}\b(?:DateFormatter|NumberFormatter|RelativeDateTimeFormatter|ISO8601DateFormatter|ByteCountFormatter|MeasurementFormatter|DateComponentsFormatter)\s*\(/;
|
|
395
|
+
|
|
396
|
+
return viewBodyObjectCreationPattern.test(swiftSource);
|
|
397
|
+
};
|
|
398
|
+
|
|
383
399
|
export const hasSwiftDispatchQueueUsage = (source: string): boolean => {
|
|
384
400
|
return scanCodeLikeSource(source, ({ source: swiftSource, index, current }) => {
|
|
385
401
|
if (current !== 'D' || !hasIdentifierAt(swiftSource, index, 'DispatchQueue')) {
|
|
@@ -685,6 +685,8 @@ const textDetectorRegistry: ReadonlyArray<TextDetectorRegistryEntry> = [
|
|
|
685
685
|
{ platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftExplicitColorStaticMemberUsage, ruleId: 'heuristics.ios.swiftui.explicit-color-static-member.ast', code: 'HEURISTICS_IOS_SWIFTUI_EXPLICIT_COLOR_STATIC_MEMBER_AST', message: 'AST heuristic detected Color.* static member usage where SwiftUI static member lookup may be preferred.' },
|
|
686
686
|
{ platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftClosureBasedViewBuilderContentUsage, ruleId: 'heuristics.ios.swiftui.closure-based-viewbuilder-content.ast', code: 'HEURISTICS_IOS_SWIFTUI_CLOSURE_BASED_VIEWBUILDER_CONTENT_AST', message: 'AST heuristic detected closure-based content storage; @ViewBuilder let content: Content remains the preferred SwiftUI container baseline.' },
|
|
687
687
|
{ platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftRedundantReactiveStateAssignmentUsage, ruleId: 'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast', code: 'HEURISTICS_IOS_SWIFTUI_REDUNDANT_REACTIVE_STATE_ASSIGNMENT_AST', message: 'AST heuristic detected reactive state assignment without a value-change guard; check for value changes before assigning state in hot paths.' },
|
|
688
|
+
{ platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftNonLazyScrollForEachUsage, ruleId: 'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast', code: 'HEURISTICS_IOS_SWIFTUI_NON_LAZY_SCROLL_FOREACH_AST', message: 'AST heuristic detected ScrollView with a non-lazy stack feeding ForEach; LazyVStack/LazyHStack remain the preferred baseline for large scrollable collections.' },
|
|
689
|
+
{ platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftViewBodyObjectCreationUsage, ruleId: 'heuristics.ios.swiftui.body-object-creation.ast', code: 'HEURISTICS_IOS_SWIFTUI_BODY_OBJECT_CREATION_AST', message: 'AST heuristic detected formatter object creation inside SwiftUI body; keep body simple and move expensive objects out of render paths.' },
|
|
688
690
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftNavigationViewUsage, ruleId: 'heuristics.ios.navigation-view.ast', code: 'HEURISTICS_IOS_NAVIGATION_VIEW_AST', message: 'AST heuristic detected NavigationView usage.' },
|
|
689
691
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftForegroundColorUsage, ruleId: 'heuristics.ios.foreground-color.ast', code: 'HEURISTICS_IOS_FOREGROUND_COLOR_AST', message: 'AST heuristic detected foregroundColor usage.' },
|
|
690
692
|
{ platform: 'ios', pathCheck: isIOSSwiftPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftCornerRadiusUsage, ruleId: 'heuristics.ios.corner-radius.ast', code: 'HEURISTICS_IOS_CORNER_RADIUS_AST', message: 'AST heuristic detected cornerRadius usage.' },
|
|
@@ -911,6 +911,44 @@ export const iosRules: RuleSet = [
|
|
|
911
911
|
code: 'HEURISTICS_IOS_SWIFTUI_REDUNDANT_REACTIVE_STATE_ASSIGNMENT_AST',
|
|
912
912
|
},
|
|
913
913
|
},
|
|
914
|
+
{
|
|
915
|
+
id: 'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast',
|
|
916
|
+
description: 'Detects ScrollView content backed by non-lazy stacks and ForEach.',
|
|
917
|
+
severity: 'WARN',
|
|
918
|
+
platform: 'ios',
|
|
919
|
+
locked: true,
|
|
920
|
+
when: {
|
|
921
|
+
kind: 'Heuristic',
|
|
922
|
+
where: {
|
|
923
|
+
ruleId: 'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast',
|
|
924
|
+
},
|
|
925
|
+
},
|
|
926
|
+
then: {
|
|
927
|
+
kind: 'Finding',
|
|
928
|
+
message:
|
|
929
|
+
'AST heuristic detected ScrollView with a non-lazy stack feeding ForEach; LazyVStack/LazyHStack remain the preferred baseline for large scrollable collections.',
|
|
930
|
+
code: 'HEURISTICS_IOS_SWIFTUI_NON_LAZY_SCROLL_FOREACH_AST',
|
|
931
|
+
},
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
id: 'heuristics.ios.swiftui.body-object-creation.ast',
|
|
935
|
+
description: 'Detects expensive formatter object creation inside SwiftUI body.',
|
|
936
|
+
severity: 'WARN',
|
|
937
|
+
platform: 'ios',
|
|
938
|
+
locked: true,
|
|
939
|
+
when: {
|
|
940
|
+
kind: 'Heuristic',
|
|
941
|
+
where: {
|
|
942
|
+
ruleId: 'heuristics.ios.swiftui.body-object-creation.ast',
|
|
943
|
+
},
|
|
944
|
+
},
|
|
945
|
+
then: {
|
|
946
|
+
kind: 'Finding',
|
|
947
|
+
message:
|
|
948
|
+
'AST heuristic detected formatter object creation inside SwiftUI body; keep body simple and move expensive objects out of render paths.',
|
|
949
|
+
code: 'HEURISTICS_IOS_SWIFTUI_BODY_OBJECT_CREATION_AST',
|
|
950
|
+
},
|
|
951
|
+
},
|
|
914
952
|
{
|
|
915
953
|
id: 'heuristics.ios.navigation-view.ast',
|
|
916
954
|
description: 'Detects NavigationView usage in iOS production code.',
|
|
@@ -254,6 +254,14 @@ const registryByRuleId: Record<string, SkillsDetectorBinding> = {
|
|
|
254
254
|
heuristicDetector('ios.swiftui.redundant-reactive-state-assignment', [
|
|
255
255
|
'heuristics.ios.swiftui.redundant-reactive-state-assignment.ast',
|
|
256
256
|
]),
|
|
257
|
+
'skills.ios.guideline.ios-swiftui-expert.use-lazyvstack-lazyhstack-for-large-lists':
|
|
258
|
+
heuristicDetector('ios.swiftui.non-lazy-scroll-foreach', [
|
|
259
|
+
'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast',
|
|
260
|
+
]),
|
|
261
|
+
'skills.ios.guideline.ios-swiftui-expert.no-object-creation-in-body':
|
|
262
|
+
heuristicDetector('ios.swiftui.body-object-creation', [
|
|
263
|
+
'heuristics.ios.swiftui.body-object-creation.ast',
|
|
264
|
+
]),
|
|
257
265
|
'skills.ios.no-scrollview-shows-indicators': heuristicDetector(
|
|
258
266
|
'ios.scrollview-shows-indicators',
|
|
259
267
|
['heuristics.ios.scrollview-shows-indicators.ast']
|
|
@@ -360,6 +360,20 @@ const normalizeKnownRuleTarget = (
|
|
|
360
360
|
) {
|
|
361
361
|
return 'skills.ios.guideline.ios-swiftui-expert.avoid-redundant-state-updates-in-onreceive-onchange-scroll-handlers';
|
|
362
362
|
}
|
|
363
|
+
if (
|
|
364
|
+
(includes('lazyvstack') && includes('lazyhstack') && includes('large lists')) ||
|
|
365
|
+
(includes('lazyvstack') && includes('foreach') && includes('scrollview')) ||
|
|
366
|
+
(includes('lazyhstack') && includes('foreach') && includes('scrollview'))
|
|
367
|
+
) {
|
|
368
|
+
return 'skills.ios.guideline.ios-swiftui-expert.use-lazyvstack-lazyhstack-for-large-lists';
|
|
369
|
+
}
|
|
370
|
+
if (
|
|
371
|
+
includes('no object creation in body') ||
|
|
372
|
+
(includes('object creation') && includes('body')) ||
|
|
373
|
+
(includes('body kept simple') && includes('pure'))
|
|
374
|
+
) {
|
|
375
|
+
return 'skills.ios.guideline.ios-swiftui-expert.no-object-creation-in-body';
|
|
376
|
+
}
|
|
363
377
|
if (
|
|
364
378
|
includes('scrollindicators hidden') ||
|
|
365
379
|
includes('scroll indicators hidden') ||
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pumuki",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.225",
|
|
4
4
|
"description": "Enterprise-grade AST Intelligence System with multi-platform support (iOS, Android, Backend, Frontend) and Feature-First + DDD + Clean Architecture enforcement. Includes dynamic violations API for intelligent querying.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
package/skills.lock.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "1.0",
|
|
3
3
|
"compilerVersion": "1.0.0",
|
|
4
|
-
"generatedAt": "2026-05-13T16:
|
|
4
|
+
"generatedAt": "2026-05-13T16:19:49.576Z",
|
|
5
5
|
"bundles": [
|
|
6
6
|
{
|
|
7
7
|
"name": "android-guidelines",
|
|
@@ -8632,7 +8632,7 @@
|
|
|
8632
8632
|
"name": "ios-swiftui-expert-guidelines",
|
|
8633
8633
|
"version": "1.0.0",
|
|
8634
8634
|
"source": "file:vendor/skills/swiftui-expert-skill/SKILL.md",
|
|
8635
|
-
"hash": "
|
|
8635
|
+
"hash": "2acbd66e86e9e809f0c4bdb5d215618096f5773e359085e3a4dc707b83c1ebb1",
|
|
8636
8636
|
"rules": [
|
|
8637
8637
|
{
|
|
8638
8638
|
"id": "skills.ios.guideline.ios-swiftui-expert.always-mark-state-and-stateobject-as-private-makes-dependencies-clear",
|
|
@@ -8787,7 +8787,7 @@
|
|
|
8787
8787
|
"sourcePath": "vendor/skills/swiftui-expert-skill/SKILL.md",
|
|
8788
8788
|
"confidence": "MEDIUM",
|
|
8789
8789
|
"locked": true,
|
|
8790
|
-
"evaluationMode": "
|
|
8790
|
+
"evaluationMode": "AUTO",
|
|
8791
8791
|
"origin": "core"
|
|
8792
8792
|
},
|
|
8793
8793
|
{
|