pumuki 6.3.224 → 6.3.226
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 +58 -0
- package/core/facts/detectors/text/ios.ts +13 -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 +15 -1
- package/package.json +1 -1
- package/skills.lock.json +14 -2
|
@@ -36,6 +36,8 @@ import {
|
|
|
36
36
|
hasSwiftLegacyXCTestImportUsage,
|
|
37
37
|
hasSwiftModernizableXCTestSuiteUsage,
|
|
38
38
|
hasSwiftNonLazyScrollForEachUsage,
|
|
39
|
+
hasSwiftViewBodyObjectCreationUsage,
|
|
40
|
+
hasSwiftUiImageDataDecodingUsage,
|
|
39
41
|
hasSwiftAssumeIsolatedUsage,
|
|
40
42
|
hasSwiftCoreDataLayerLeakUsage,
|
|
41
43
|
hasSwiftSwiftDataLayerLeakUsage,
|
|
@@ -162,6 +164,62 @@ struct FeedView: View {
|
|
|
162
164
|
assert.equal(hasSwiftNonLazyScrollForEachUsage(safe), false);
|
|
163
165
|
});
|
|
164
166
|
|
|
167
|
+
test('hasSwiftViewBodyObjectCreationUsage detecta formatter creado en body y preserva dependencia externa', () => {
|
|
168
|
+
const source = `
|
|
169
|
+
struct PriceView: View {
|
|
170
|
+
let amount: Decimal
|
|
171
|
+
|
|
172
|
+
var body: some View {
|
|
173
|
+
let formatter = NumberFormatter()
|
|
174
|
+
Text(formatter.string(from: amount as NSDecimalNumber) ?? "")
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
const safe = `
|
|
179
|
+
struct PriceView: View {
|
|
180
|
+
let formatter: NumberFormatter
|
|
181
|
+
let amount: Decimal
|
|
182
|
+
|
|
183
|
+
var body: some View {
|
|
184
|
+
Text(formatter.string(from: amount as NSDecimalNumber) ?? "")
|
|
185
|
+
let sample = "var body: some View { NumberFormatter() }"
|
|
186
|
+
// var body: some View { NumberFormatter() }
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
`;
|
|
190
|
+
|
|
191
|
+
assert.equal(hasSwiftViewBodyObjectCreationUsage(source), true);
|
|
192
|
+
assert.equal(hasSwiftViewBodyObjectCreationUsage(safe), false);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test('hasSwiftUiImageDataDecodingUsage detecta UIImage(data:) y preserva strings y comentarios', () => {
|
|
196
|
+
const source = `
|
|
197
|
+
struct AvatarView: View {
|
|
198
|
+
let imageData: Data
|
|
199
|
+
|
|
200
|
+
var body: some View {
|
|
201
|
+
if let image = UIImage(data: imageData) {
|
|
202
|
+
Image(uiImage: image)
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
`;
|
|
207
|
+
const safe = `
|
|
208
|
+
struct AvatarView: View {
|
|
209
|
+
let image: UIImage
|
|
210
|
+
|
|
211
|
+
var body: some View {
|
|
212
|
+
Image(uiImage: image)
|
|
213
|
+
let sample = "UIImage(data: imageData)"
|
|
214
|
+
// UIImage(data: imageData)
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
`;
|
|
218
|
+
|
|
219
|
+
assert.equal(hasSwiftUiImageDataDecodingUsage(source), true);
|
|
220
|
+
assert.equal(hasSwiftUiImageDataDecodingUsage(safe), false);
|
|
221
|
+
});
|
|
222
|
+
|
|
165
223
|
test('hasSwiftForceTryUsage detecta try! y descarta try?', () => {
|
|
166
224
|
const positive = `
|
|
167
225
|
func load() {
|
|
@@ -388,6 +388,19 @@ export const hasSwiftNonLazyScrollForEachUsage = (source: string): boolean => {
|
|
|
388
388
|
return nonLazyScrollableCollectionPattern.test(swiftSource);
|
|
389
389
|
};
|
|
390
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
|
+
|
|
399
|
+
export const hasSwiftUiImageDataDecodingUsage = (source: string): boolean => {
|
|
400
|
+
const swiftSource = sanitizeSwiftSourceForMultilineRegex(source);
|
|
401
|
+
return /\bUIImage\s*\(\s*data\s*:/.test(swiftSource);
|
|
402
|
+
};
|
|
403
|
+
|
|
391
404
|
export const hasSwiftDispatchQueueUsage = (source: string): boolean => {
|
|
392
405
|
return scanCodeLikeSource(source, ({ source: swiftSource, index, current }) => {
|
|
393
406
|
if (current !== 'D' || !hasIdentifierAt(swiftSource, index, 'DispatchQueue')) {
|
|
@@ -686,6 +686,8 @@ const textDetectorRegistry: ReadonlyArray<TextDetectorRegistryEntry> = [
|
|
|
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
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.' },
|
|
690
|
+
{ platform: 'ios', pathCheck: isIOSPresentationPath, excludePaths: [isSwiftTestPath], detect: TextIOS.hasSwiftUiImageDataDecodingUsage, ruleId: 'heuristics.ios.swiftui.image-data-decoding.ast', code: 'HEURISTICS_IOS_SWIFTUI_IMAGE_DATA_DECODING_AST', message: 'AST heuristic detected UIImage(data:) in SwiftUI presentation; downsample image data before rendering large images.' },
|
|
689
691
|
{ 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.' },
|
|
690
692
|
{ 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.' },
|
|
691
693
|
{ 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.' },
|
|
@@ -930,6 +930,44 @@ export const iosRules: RuleSet = [
|
|
|
930
930
|
code: 'HEURISTICS_IOS_SWIFTUI_NON_LAZY_SCROLL_FOREACH_AST',
|
|
931
931
|
},
|
|
932
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
|
+
},
|
|
952
|
+
{
|
|
953
|
+
id: 'heuristics.ios.swiftui.image-data-decoding.ast',
|
|
954
|
+
description: 'Detects UIImage(data:) decoding in SwiftUI presentation paths.',
|
|
955
|
+
severity: 'WARN',
|
|
956
|
+
platform: 'ios',
|
|
957
|
+
locked: true,
|
|
958
|
+
when: {
|
|
959
|
+
kind: 'Heuristic',
|
|
960
|
+
where: {
|
|
961
|
+
ruleId: 'heuristics.ios.swiftui.image-data-decoding.ast',
|
|
962
|
+
},
|
|
963
|
+
},
|
|
964
|
+
then: {
|
|
965
|
+
kind: 'Finding',
|
|
966
|
+
message:
|
|
967
|
+
'AST heuristic detected UIImage(data:) in SwiftUI presentation; downsample image data before rendering large images.',
|
|
968
|
+
code: 'HEURISTICS_IOS_SWIFTUI_IMAGE_DATA_DECODING_AST',
|
|
969
|
+
},
|
|
970
|
+
},
|
|
933
971
|
{
|
|
934
972
|
id: 'heuristics.ios.navigation-view.ast',
|
|
935
973
|
description: 'Detects NavigationView usage in iOS production code.',
|
|
@@ -258,6 +258,14 @@ const registryByRuleId: Record<string, SkillsDetectorBinding> = {
|
|
|
258
258
|
heuristicDetector('ios.swiftui.non-lazy-scroll-foreach', [
|
|
259
259
|
'heuristics.ios.swiftui.non-lazy-scroll-foreach.ast',
|
|
260
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
|
+
]),
|
|
265
|
+
'skills.ios.guideline.ios-swiftui-expert.suggest-image-downsampling-when-uiimage-data-is-encountered':
|
|
266
|
+
heuristicDetector('ios.swiftui.image-data-decoding', [
|
|
267
|
+
'heuristics.ios.swiftui.image-data-decoding.ast',
|
|
268
|
+
]),
|
|
261
269
|
'skills.ios.no-scrollview-shows-indicators': heuristicDetector(
|
|
262
270
|
'ios.scrollview-shows-indicators',
|
|
263
271
|
['heuristics.ios.scrollview-shows-indicators.ast']
|
|
@@ -16,7 +16,7 @@ const MARKDOWN_BOLD_PATTERN = /[*_]{1,3}/g;
|
|
|
16
16
|
const MULTISPACE_PATTERN = /\s+/g;
|
|
17
17
|
const AST_NODE_ID_PATTERN = /\bheuristics\.[a-z0-9._-]+\.ast\b/gi;
|
|
18
18
|
const RULE_KEYWORDS =
|
|
19
|
-
/\b(always|siempre|prefer|use|usar|avoid|evitar|never|nunca|must|obligatorio|required|disallow|do not|no)\b/i;
|
|
19
|
+
/\b(always|siempre|prefer|use|usar|avoid|evitar|never|nunca|must|obligatorio|required|disallow|do not|no|suggest)\b/i;
|
|
20
20
|
|
|
21
21
|
const normalizeForLookup = (value: string): string => {
|
|
22
22
|
return value
|
|
@@ -367,6 +367,20 @@ const normalizeKnownRuleTarget = (
|
|
|
367
367
|
) {
|
|
368
368
|
return 'skills.ios.guideline.ios-swiftui-expert.use-lazyvstack-lazyhstack-for-large-lists';
|
|
369
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
|
+
}
|
|
377
|
+
if (
|
|
378
|
+
includes('image downsampling') ||
|
|
379
|
+
(includes('uiimage data') && includes('downsampling')) ||
|
|
380
|
+
(includes('uiimage data') && includes('encountered'))
|
|
381
|
+
) {
|
|
382
|
+
return 'skills.ios.guideline.ios-swiftui-expert.suggest-image-downsampling-when-uiimage-data-is-encountered';
|
|
383
|
+
}
|
|
370
384
|
if (
|
|
371
385
|
includes('scrollindicators hidden') ||
|
|
372
386
|
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.226",
|
|
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:23:26.589Z",
|
|
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": "10b8966d8204f1abb91af3254cfb809bf0a3822b8d09347c28639d23e6dfc1c7",
|
|
8636
8636
|
"rules": [
|
|
8637
8637
|
{
|
|
8638
8638
|
"id": "skills.ios.guideline.ios-swiftui-expert.always-mark-state-and-stateobject-as-private-makes-dependencies-clear",
|
|
@@ -8742,6 +8742,18 @@
|
|
|
8742
8742
|
"evaluationMode": "DECLARATIVE",
|
|
8743
8743
|
"origin": "core"
|
|
8744
8744
|
},
|
|
8745
|
+
{
|
|
8746
|
+
"id": "skills.ios.guideline.ios-swiftui-expert.suggest-image-downsampling-when-uiimage-data-is-encountered",
|
|
8747
|
+
"description": "Suggest image downsampling when UIImage(data:) is used (as optional optimization, see references/image-optimization.md)",
|
|
8748
|
+
"severity": "WARN",
|
|
8749
|
+
"platform": "ios",
|
|
8750
|
+
"sourceSkill": "ios-swiftui-expert-guidelines",
|
|
8751
|
+
"sourcePath": "vendor/skills/swiftui-expert-skill/SKILL.md",
|
|
8752
|
+
"confidence": "MEDIUM",
|
|
8753
|
+
"locked": true,
|
|
8754
|
+
"evaluationMode": "AUTO",
|
|
8755
|
+
"origin": "core"
|
|
8756
|
+
},
|
|
8745
8757
|
{
|
|
8746
8758
|
"id": "skills.ios.guideline.ios-swiftui-expert.use-glasseffectid-with-namespace-for-morphing-transitions",
|
|
8747
8759
|
"description": "Use glassEffectID with @Namespace for morphing transitions",
|