pumuki 6.3.161 → 6.3.163

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.
@@ -669,6 +669,26 @@ final class LoginModelTests: XCTestCase {
669
669
  assert.equal(hasSwiftModernizableXCTestSuiteUsage(missingQualityContract), false);
670
670
  });
671
671
 
672
+ test('detectores Swift Testing excluyen helpers y factories XCTest brownfield sin XCTestCase', () => {
673
+ const helperSource = `
674
+ import XCTest
675
+
676
+ final class AuthTestFactories {
677
+ static func makeToken() -> String {
678
+ "token"
679
+ }
680
+ }
681
+
682
+ func trackForMemoryLeaks(_ instance: AnyObject, file: StaticString = #filePath, line: UInt = #line) {
683
+ addTeardownBlock { _ = instance }
684
+ }
685
+ `;
686
+
687
+ assert.equal(hasSwiftLegacyXCTestImportUsage(helperSource), false);
688
+ assert.equal(hasSwiftModernizableXCTestSuiteUsage(helperSource), false);
689
+ assert.equal(hasSwiftXCTestAssertionUsage(helperSource), false);
690
+ });
691
+
672
692
  test('hasSwiftXCTUnwrapUsage detecta XCTUnwrap real y evita strings', () => {
673
693
  const source = `
674
694
  let value = try XCTUnwrap(optionalValue)
@@ -752,11 +772,14 @@ test('hasSwiftNSManagedObjectBoundaryUsage detecta boundaries con NSManagedObjec
752
772
  const source = `
753
773
  func persist(_ entity: NSManagedObject) {}
754
774
  var selectedEntity: NSManagedObject?
775
+ let cachedEntities: Result<[NSManagedObject], Error>
755
776
  `;
756
777
  const ignored = `
757
778
  final class TodoEntity: NSManagedObject {}
758
779
  var selectedID: NSManagedObjectID?
759
780
  let context: NSManagedObjectContext
781
+ let text = "var selectedEntity: NSManagedObject?"
782
+ // func persist(_ entity: NSManagedObject) {}
760
783
  `;
761
784
 
762
785
  assert.equal(hasSwiftNSManagedObjectBoundaryUsage(source), true);
@@ -768,11 +791,17 @@ test('hasSwiftNSManagedObjectAsyncBoundaryUsage detecta async APIs con NSManaged
768
791
  func fetchEntity() async throws -> NSManagedObject {
769
792
  fatalError()
770
793
  }
794
+ func fetchEntities() async throws -> Result<[NSManagedObject], Error> {
795
+ fatalError()
796
+ }
771
797
  `;
772
798
  const ignored = `
773
799
  func fetchEntityID() async throws -> NSManagedObjectID {
774
800
  fatalError()
775
801
  }
802
+ func fetchContext() async throws -> NSManagedObjectContext {
803
+ fatalError()
804
+ }
776
805
  `;
777
806
 
778
807
  assert.equal(hasSwiftNSManagedObjectAsyncBoundaryUsage(source), true);
@@ -845,6 +845,10 @@ export const hasSwiftLegacyXCTestImportUsage = (source: string): boolean => {
845
845
  return false;
846
846
  }
847
847
 
848
+ if (!hasSwiftXCTestCaseSubclassUsage(source) || !hasSwiftLegacyXCTestMethodUsage(source)) {
849
+ return false;
850
+ }
851
+
848
852
  if (hasSwiftLegacyXCTestUiOrPerformanceUsage(source)) {
849
853
  return false;
850
854
  }
@@ -934,17 +938,37 @@ export const hasSwiftLegacyExpectationDescriptionUsage = (source: string): boole
934
938
  });
935
939
  };
936
940
 
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
941
+ const swiftManagedObjectBoundaryTypePattern = /\bNSManagedObject\b(?!ID\b|Context\b)/;
942
+ const swiftStoredPropertyBoundaryPattern =
943
+ /\b(?:var|let)\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*[^=\n]*\bNSManagedObject\b(?!ID\b|Context\b)/;
944
+ const swiftManagedObjectSubclassPattern =
945
+ /\b(?:final\s+)?class\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*NSManagedObject\b/;
946
+
947
+ const hasSwiftManagedObjectBoundaryTypeUsage = (source: string): boolean => {
948
+ return collectSwiftFunctionDeclarations(source).some((declaration) =>
949
+ swiftManagedObjectBoundaryTypePattern.test(declaration.signature)
941
950
  );
942
951
  };
943
952
 
953
+ export const hasSwiftNSManagedObjectBoundaryUsage = (source: string): boolean => {
954
+ if (hasSwiftManagedObjectBoundaryTypeUsage(source)) {
955
+ return true;
956
+ }
957
+
958
+ return source.split(/\r?\n/).some((line) => {
959
+ const sanitized = stripSwiftLineForSemanticScan(line);
960
+ return (
961
+ swiftStoredPropertyBoundaryPattern.test(sanitized) &&
962
+ !swiftManagedObjectSubclassPattern.test(sanitized)
963
+ );
964
+ });
965
+ };
966
+
944
967
  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
968
+ return collectSwiftFunctionDeclarations(source).some(
969
+ (declaration) =>
970
+ /\basync\b/.test(declaration.signature) &&
971
+ swiftManagedObjectBoundaryTypePattern.test(declaration.signature)
948
972
  );
949
973
  };
950
974
 
@@ -655,6 +655,13 @@ const isXCTestSource = (content: string): boolean => {
655
655
  return /\bimport\s+XCTest\b/.test(content) || /\bXCTestCase\b/.test(content);
656
656
  };
657
657
 
658
+ const isXCTestSuiteSource = (content: string): boolean => {
659
+ return (
660
+ /\bclass\s+[A-Za-z_][A-Za-z0-9_]*\s*:\s*XCTestCase\b/.test(content) &&
661
+ /^\s*(?:override\s+)?func\s+test[A-Za-z0-9_]*\s*\(/m.test(content)
662
+ );
663
+ };
664
+
658
665
  const isXCTestUiOrPerformanceCompatibilitySource = (content: string): boolean => {
659
666
  return /\bXCUIApplication\b|\bXCTMetric\b|\bmeasure\s*(?:\(|\{)/.test(content);
660
667
  };
@@ -678,6 +685,9 @@ const toIosTestsQualityBlockingFinding = (params: {
678
685
  if (!isXCTestSource(testFile.content)) {
679
686
  continue;
680
687
  }
688
+ if (!isXCTestSuiteSource(testFile.content)) {
689
+ continue;
690
+ }
681
691
  if (isXCTestUiOrPerformanceCompatibilitySource(testFile.content)) {
682
692
  continue;
683
693
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pumuki",
3
- "version": "6.3.161",
3
+ "version": "6.3.163",
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": {