pumuki 6.3.160 → 6.3.162

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.
@@ -564,11 +564,34 @@ import Testing
564
564
  struct LoginModernTests {
565
565
  @Test func login() async {}
566
566
  }
567
+ `;
568
+ const mixedWithReexportedTesting = `
569
+ import XCTest
570
+
571
+ final class LoginTests: XCTestCase {
572
+ func testLegacyLogin() {}
573
+ }
574
+
575
+ struct LoginModernTests {
576
+ @Test func login() async {}
577
+ }
578
+ `;
579
+ const ignoredCommentsAndStrings = `
580
+ import XCTest
581
+
582
+ final class LoginTests: XCTestCase {
583
+ func testLegacyLogin() {
584
+ let text = "@Test func login() async {}"
585
+ // @Suite
586
+ }
587
+ }
567
588
  `;
568
589
 
569
590
  assert.equal(hasSwiftMixedTestingFrameworksUsage(mixedSuite), true);
591
+ assert.equal(hasSwiftMixedTestingFrameworksUsage(mixedWithReexportedTesting), true);
570
592
  assert.equal(hasSwiftMixedTestingFrameworksUsage(legacyOnly), false);
571
593
  assert.equal(hasSwiftMixedTestingFrameworksUsage(modernOnly), false);
594
+ assert.equal(hasSwiftMixedTestingFrameworksUsage(ignoredCommentsAndStrings), false);
572
595
  });
573
596
 
574
597
  test('hasSwiftXCTestAssertionUsage detecta XCTAssert y XCTFail reales', () => {
@@ -729,11 +752,14 @@ test('hasSwiftNSManagedObjectBoundaryUsage detecta boundaries con NSManagedObjec
729
752
  const source = `
730
753
  func persist(_ entity: NSManagedObject) {}
731
754
  var selectedEntity: NSManagedObject?
755
+ let cachedEntities: Result<[NSManagedObject], Error>
732
756
  `;
733
757
  const ignored = `
734
758
  final class TodoEntity: NSManagedObject {}
735
759
  var selectedID: NSManagedObjectID?
736
760
  let context: NSManagedObjectContext
761
+ let text = "var selectedEntity: NSManagedObject?"
762
+ // func persist(_ entity: NSManagedObject) {}
737
763
  `;
738
764
 
739
765
  assert.equal(hasSwiftNSManagedObjectBoundaryUsage(source), true);
@@ -745,11 +771,17 @@ test('hasSwiftNSManagedObjectAsyncBoundaryUsage detecta async APIs con NSManaged
745
771
  func fetchEntity() async throws -> NSManagedObject {
746
772
  fatalError()
747
773
  }
774
+ func fetchEntities() async throws -> Result<[NSManagedObject], Error> {
775
+ fatalError()
776
+ }
748
777
  `;
749
778
  const ignored = `
750
779
  func fetchEntityID() async throws -> NSManagedObjectID {
751
780
  fatalError()
752
781
  }
782
+ func fetchContext() async throws -> NSManagedObjectContext {
783
+ fatalError()
784
+ }
753
785
  `;
754
786
 
755
787
  assert.equal(hasSwiftNSManagedObjectAsyncBoundaryUsage(source), true);
@@ -788,6 +788,10 @@ const hasSwiftTestingSuiteAttributeUsage = (source: string): boolean => {
788
788
  return hasSwiftSanitizedRegexMatch(source, /\B@(?:Test|Suite)\b/);
789
789
  };
790
790
 
791
+ const hasSwiftTestingFrameworkMarkerUsage = (source: string): boolean => {
792
+ return hasSwiftTestingImportUsage(source) || hasSwiftTestingSuiteAttributeUsage(source);
793
+ };
794
+
791
795
  const hasSwiftXCTestCaseSubclassUsage = (source: string): boolean => {
792
796
  return hasSwiftSanitizedRegexMatch(
793
797
  source,
@@ -869,11 +873,7 @@ export const hasSwiftModernizableXCTestSuiteUsage = (source: string): boolean =>
869
873
  };
870
874
 
871
875
  export const hasSwiftMixedTestingFrameworksUsage = (source: string): boolean => {
872
- if (!hasSwiftXCTestImportUsage(source) || !hasSwiftXCTestCaseSubclassUsage(source)) {
873
- return false;
874
- }
875
-
876
- return hasSwiftTestingImportUsage(source) || hasSwiftTestingSuiteAttributeUsage(source);
876
+ return hasSwiftXCTestCaseSubclassUsage(source) && hasSwiftTestingFrameworkMarkerUsage(source);
877
877
  };
878
878
 
879
879
  export const hasSwiftXCTestAssertionUsage = (source: string): boolean => {
@@ -934,17 +934,37 @@ export const hasSwiftLegacyExpectationDescriptionUsage = (source: string): boole
934
934
  });
935
935
  };
936
936
 
937
- export const hasSwiftNSManagedObjectBoundaryUsage = (source: string): boolean => {
938
- return hasSwiftSanitizedRegexMatch(
939
- source,
940
- /\bfunc\b[\s\S]{0,240}\([^)]*\bNSManagedObject\b(?!ID\b|Context\b)[^)]*\)|\b(?:var|let)\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*(?:\[[^\]]*NSManagedObject\b(?!ID\b|Context\b)[^\]]*\]|NSManagedObject\b(?!ID\b|Context\b))/g
937
+ const swiftManagedObjectBoundaryTypePattern = /\bNSManagedObject\b(?!ID\b|Context\b)/;
938
+ const swiftStoredPropertyBoundaryPattern =
939
+ /\b(?:var|let)\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*[^=\n]*\bNSManagedObject\b(?!ID\b|Context\b)/;
940
+ const swiftManagedObjectSubclassPattern =
941
+ /\b(?:final\s+)?class\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*NSManagedObject\b/;
942
+
943
+ const hasSwiftManagedObjectBoundaryTypeUsage = (source: string): boolean => {
944
+ return collectSwiftFunctionDeclarations(source).some((declaration) =>
945
+ swiftManagedObjectBoundaryTypePattern.test(declaration.signature)
941
946
  );
942
947
  };
943
948
 
949
+ export const hasSwiftNSManagedObjectBoundaryUsage = (source: string): boolean => {
950
+ if (hasSwiftManagedObjectBoundaryTypeUsage(source)) {
951
+ return true;
952
+ }
953
+
954
+ return source.split(/\r?\n/).some((line) => {
955
+ const sanitized = stripSwiftLineForSemanticScan(line);
956
+ return (
957
+ swiftStoredPropertyBoundaryPattern.test(sanitized) &&
958
+ !swiftManagedObjectSubclassPattern.test(sanitized)
959
+ );
960
+ });
961
+ };
962
+
944
963
  export const hasSwiftNSManagedObjectAsyncBoundaryUsage = (source: string): boolean => {
945
- return hasSwiftSanitizedRegexMatch(
946
- source,
947
- /\bfunc\b[\s\S]{0,240}\basync\b[\s\S]{0,200}(?:\([^)]*\bNSManagedObject\b(?!ID\b|Context\b)[^)]*\)|->\s*(?:\[[^\]]*NSManagedObject\b(?!ID\b|Context\b)[^\]]*\]|NSManagedObject\b(?!ID\b|Context\b)))/g
964
+ return collectSwiftFunctionDeclarations(source).some(
965
+ (declaration) =>
966
+ /\basync\b/.test(declaration.signature) &&
967
+ swiftManagedObjectBoundaryTypePattern.test(declaration.signature)
948
968
  );
949
969
  };
950
970
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.160",
3
+ "version": "6.3.162",
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": {