Brightify/Cuckoo
56.8
Adequate · 1 October 2026
6.8k
lines of production code
Swift
primary language
2
measurements over time
What this system is
Cuckoo is a code generation and mocking framework for Swift and Objective-C that automates the creation of test doubles for protocols, classes, and async methods. It provides a command-line generator and SPM plugins to produce mock code, alongside a runtime library that supports stubbing, verification, and argument matching for both XCTest and the Swift Testing framework. The system also includes infrastructure for mocking Objective-C APIs via OCMock and manages its own build and release pipelines using Tuist and Fastlane.
How it got here
2016 — Swift 6 migration and stubbing overhaul
12 changes.
The project underwent a significant architectural refactoring to support Swift 6 strict concurrency, including migrating to Tuist for project management and updating core dependencies. This period focused on rebuilding the stubbing and verification infrastructure with a type-safe, trait-based system to handle complex types like throwing functions and closures. Concurrently, native support for the Swift Testing framework and enhanced collection matchers were introduced to modernize the mocking capabilities.
2018–2023 — OCMock support and build system modernization
12 changes.
This period focused on extending the mocking framework to support Objective-C via OCMock integration and introducing a new DSL for mock initialization. Concurrently, the project modernized its development infrastructure by migrating the generator to the Tuist build system while restoring local Xcode build support and automating release pipelines.
2024 — SwiftSyntax migration and SPM integration
10 changes.
The project underwent a comprehensive internal rewrite to migrate its parser and token models to SwiftSyntax, significantly improving support for modern Swift concurrency and complex language features. This period also introduced Swift Package Manager plugins for flexible mock generation and refactored the CLI to use TOML configuration, while stabilizing the codebase with new templates and test coverage.
Features
Add OCMockWrapper header for OCMock integration
The OCMockWrapper module now includes a public header that imports the OCMock framework, enabling consumers of this wrapper to access OCMock functionality through a unified interface.
OCMockWrapper · high confidence
Add Swift Package Manager plugins for per-file and per-module mock generation
The Generator/Plugin directory now includes three new Swift Package Manager build-tool plugins: CuckooPluginDirectory, CuckooPluginFile, and CuckooPluginModular. CuckooPluginDirectory provides a prebuild command that runs the CuckooGenerator against the entire project, while CuckooPluginFile and CuckooPluginModular provide build commands that generate mocks for individual source files or per-module, respectively. These plugins enable users to integrate Cuckoo mock generation directly into their SPM and Xcode projects via the PackagePlugin and XcodeProjectPlugin APIs, supporting both standard and test targets.
Generator/Plugin · high confidence
Add initial Objective-C mocking support via OCMock helpers
This change introduces a new \OCMock/ObjCHelpers\ module that provides the underlying Objective-C infrastructure for mocking. It adds helper categories and classes—including \NSInvocation+OCMockWrapper\, \OCMockObject+CuckooMockObject\, \StringProxy\, and \ObjectiveCatcher\—to bridge Swift test code with the OCMock library. Specifically, the \CuckooMockObject\ proxy intercepts invocations to replace closure arguments with an \any\ matcher, enabling Swift closures to be matched in Objective-C mock expectations, while \StringProxy\ allows string methods to be constrained using OCMock constraints.
OCMock/ObjCHelpers · high confidence
Add support for stubbing throwing functions
The stubbing API now supports functions that throw errors. New types (StubThrowingFunction, StubNoReturnThrowingFunction) and their protocol/class variants allow users to stub methods that return a value or void while throwing, enabling configuration of throw behaviors via the new StubFunctionThenThrowTrait and StubFunctionThenThrowingTrait.
Source/Stubbing/StubFunction · high confidence
Added ArgumentCaptor and generic return type hints for verification
Users can now capture arguments passed to methods using the new ArgumentCaptor class, which stores all captured values and provides a matcher for use in verification. Additionally, a new \_\_DoNotUse struct with a with(returnType:) helper allows users to explicitly specify return types when verifying generic functions, resolving type inference issues.
Source/Verification · high confidence
Automated release pipeline for Cuckoo generator
The project now includes a Fastlane Fastfile that automates the release process for the Cuckoo generator. This pipeline handles version bumping of the podspec, building the generator binary, updating version files, generating a changelog from recent commits, and publishing the release to GitHub. It ensures the podspec is valid via linting before creating a non-draft GitHub release, uploading the compiled binary as an asset, and finally pushing the updated podspec to CocoaPods.
.fastlane · high confidence
Cuckoo framework version 0.10.2 introduces Swift Testing support and concurrency mocking
This update brings the Cuckoo mocking framework to version 0.10.2, adding native support for the new Swift Testing framework alongside existing XCTest compatibility. The core library now enables mocking of asynchronous and concurrent methods, allowing developers to test async code paths effectively. Additionally, the framework introduces a \DefaultValueRegistry\ that provides sensible default return values for common types (such as \Int\, \String\, \Array\, \Set\, \Dictionary\, and \Optional\) and tuples, reducing boilerplate when stubbing methods that return these types. The public API is exposed via a new \CuckooFunctions.swift\ module, which includes DSL functions like \stub\, \when\, \verify\, \reset\, \clearStubs\, \clearInvocations\, and \verifyNoMoreInteractions\ to streamline mock interactions.
Source · high confidence
Initial support for mocking Objective-C classes and protocols
This change introduces the foundational components for mocking Objective-C code within the OCMock module. It adds a bridging header to expose OCMock headers to Swift, implements a \NSValueConvertible\ protocol to handle type conversions for numeric and geometric values, and provides Swift wrappers for OCMock's core functionalities. Specifically, it adds \objcStub\ for setting up stubs on protocols and classes, \objcVerify\ for verifying method invocations with quantifiers, and a suite of matchers (\objcAny\, \objcIsNil\, \objcIsEqual\, etc.) and argument closures to facilitate interaction with Objective-C APIs.
OCMock · high confidence
Introduce new Mock initialization DSL and thread-local manager support
This change introduces a new initialization DSL for creating mocks, adding \CreateMock.swift\ and \MockBuilder.swift\ to provide a structured way to configure mock instances via a builder pattern. It also adds \ThreadLocal.swift\ and \MockManager+preconfigured.swift\ to support thread-local storage for the mock manager, enabling preconfigured manager state to be safely isolated per thread during mock creation and configuration.
Source/Initialization · high confidence
New collection and closure matchers for stubbing and verification
The matching library now supports detailed verification of complex parameters. You can verify that collections contain specific elements using \containsAnyOf\ and \containsAllOf\ for Arrays, Sets, and Dictionaries (including key and value checks). Additionally, stubbing and verification now handle closures comprehensively, with matchers for any closure, throwing closures, async closures, and Sendable closures, supporting up to 7 parameters. The \CallMatcher\ struct and helper functions (\times\, \never\, \atLeast\, \atMost\) provide precise control over call count assertions.
Source/Matching · high confidence
New stubbing action traits for return, throw, and implementation behavior
This change introduces a new set of Swift protocols and extensions in the \Source/Stubbing/StubFunction/Trait\ directory that define specific behaviors for stubbed functions. Users can now configure stubs to return specific values (including multiple values in order), throw errors, do nothing, call the real implementation, or invoke a custom throwing or non-throwing implementation block. These traits provide a structured, composable way to define stub responses, supporting both single and variadic argument patterns for returns and throws.
Source/Stubbing/StubFunction/Trait · high confidence
Restored local build support via Generator.xcodeproj
The Generator project now includes a Generator.xcodeproj file, enabling developers to build and run the generator tool directly within Xcode. This change re-introduces the Xcode project structure (including workspace configuration) that was previously removed, facilitating local development and debugging of the code generation logic without relying solely on command-line or Carthage-based builds.
Generator/Generator.xcodeproj · high confidence
Support for stubbing optional and throwing properties
The stubbing API now supports properties that return optional values or throw errors. Users can stub optional properties using the new \ToBeStubbedOptionalProperty\ protocol and its implementations, which allow matching against optional types. Additionally, throwing properties are supported via the \ToBeStubbedThrowingProperty\ protocol, enabling stubs that can simulate error conditions. These changes extend the existing property stubbing capabilities to cover more complex Swift type scenarios.
Source/Stubbing/ToBeStubbedProperty · high confidence
Architecture
Generator project migrated to Tuist build system
The Generator project has been converted from its previous build configuration to Tuist, introducing a new Project.swift definition that manages the Cuckoonator command-line tool and its tests. This change updates the project structure to use specific dependency versions (such as SwiftSyntax 600.1.0–603.0.0, XcodeProj 9.9.0, and TOMLKit 0.6.0) and configures build schemes to handle executable copying and launch arguments, effectively changing how the generator is built and integrated within the Tuist ecosystem.
Generator · high confidence
Behavioural changes
Added Info.plist files for Cuckoo platform targets
Added Info.plist configuration files for iOS, macOS, tvOS, and watchOS targets, including their respective test and mock bundles. These files define standard bundle identifiers, package types (frameworks and bundles), and versioning metadata required for the respective platform builds.
Derived · high confidence
Added generated Info.plist files for the main app and test bundle
The build process now generates standard Info.plist files for the Cuckoonator application and its test bundle. These files provide essential metadata such as bundle identifiers, version strings, and copyright information, ensuring the app and tests are correctly configured for execution on iOS/macOS platforms.
Generator/Derived · high confidence
Adds internal helper extensions for SwiftSyntax and concurrency
The Generator's internal helper utilities now include new convenience extensions for SwiftSyntax (such as creating string literals and conditionally wrapping expressions with try/await) and modern concurrency patterns (async map/forEach and concurrent operations with task groups). Additional helper extensions for Array uniquing, FileKit path resolution, and String manipulation have also been added to support the underlying code generation logic.
Generator/Sources/Internal/Helpers · high confidence
CLI rewritten with TOML configuration and SwiftSyntax
The CLI tool has been rewritten to use SwiftSyntax for parsing and now accepts configuration via TOML files (Cuckoofile.toml) instead of the previous format. Users can now define modules, source paths, output directories, and generation options (such as protocols-only mode, inheritance handling, and regex filtering) in a structured TOML file. The tool also supports reading source lists directly from Xcode project targets and includes a verbose logging mode for debugging generation issues.
Generator/Sources/CLI · high confidence
Introduce Tuist project helpers and add watchOS support
This change adds new helper files within the Tuist directory to streamline project configuration, including a shell execution utility, environment variable convenience methods, and target reference extensions. It also introduces a PlatformType enum that explicitly adds watchOS as a supported platform alongside iOS, macOS, and tvOS, complete with specific deployment targets (watchOS 8.0, iOS 13.0, macOS 10.15, tvOS 13.0) and corresponding device destinations.
Tuist · high confidence
Introduce new stubbing infrastructure with typed actions and call tracking
The stubbing module has been refactored to use a new, type-safe architecture. Users can now define stubs using the \Stub\ protocol and \ConcreteStub\ classes, which support generic input, output, and error types. The behavior of stubs is controlled via the new \StubAction\ enum, allowing for specific outcomes such as returning a value, throwing an error, calling the real implementation, or invoking a custom closure. Additionally, the \StubCall\ protocol and \ConcreteStubCall\ struct provide standardized tracking of method invocations, including parameter details formatted as strings for debugging or verification purposes.
Source/Stubbing · high confidence
Migrate project management to Tuist and update dependencies
The project has switched from manual Xcode project management to Tuist for generating the workspace and project structure, introducing a new \Project.swift\ configuration and a \Makefile\ for development workflows. This change includes the addition of a \Cuckoofile.toml\ for configuring mock generation options and sources, and updates the Swift Package Manager dependencies to specific versions (e.g., SwiftSyntax 601.0.1, XcodeProj 9.4.3) recorded in \.package.resolved\. The generator binary has been renamed to \cuckoonator\, and the \run\ script and \build\_generator\ script have been updated to support this new build and generation pipeline.
(repo-wide) · high confidence
Property verification API refactored to use methods instead of properties
The property verification API has been updated so that the \get\ operation is now invoked as a method call (\get()\) rather than a property access. This change applies to \VerifyProperty\, \VerifyOptionalProperty\, and the new \VerifyReadOnlyProperty\ structs, ensuring consistent method-based syntax for verifying property getters and setters.
Source/Verification/VerifyProperty · high confidence
Refactored internal generator infrastructure and added file header handling
The internal generator logic has been restructured to improve code organization and maintainability. A new FileHeaderHandler has been introduced to manage the generation of file headers and import statements, including support for public and testable imports. The core GeneratorHelper has been updated to utilize a Stencil-based templating environment with custom extensions for handling generic types, parameter matchers, and nested closures, while also adding logic to escape Swift reserved keywords. Additionally, new internal utility types have been added: an OrderedSet wrapper for maintaining unique, ordered collections of imports, a generic Reference class for value indirection, and a TypeGuesser for inferring Swift types from string literals.
Generator/Sources/Internal · high confidence
Refactored mock protocol hierarchy and proxy interfaces
The mock framework's internal structure has been reorganized to improve separation of concerns. The \Mock\ protocol now explicitly inherits from \HasMockManager\ and \HasSuperclass\, and defines associated types for \Stubbing\ and \Verification\ proxies. New protocols \StubbingProxy\ and \VerificationProxy\ standardize the initialization of these components, while \Mocked\ provides a generic constraint for mock types. Additionally, \ClassMock\ and \ProtocolMock\ are introduced to distinguish between class and protocol mocks, with \ClassMock\ adding the capability to enable superclass spying.
Source/Mock · high confidence
Restored local build support with Xcode scheme for Cuckoonator
The Generator project now includes an Xcode scheme (Generator.xcscheme) that enables local building and running of the Cuckoonator tool directly within Xcode. This configuration sets up the build action to produce the executable, defines test targets for CuckoonatorTests, and configures the launch action to run the tool with default command-line arguments (--configuration ./Cuckoofile and --verbose) and a specific environment variable (PROJECT\_DIR), facilitating easier local development and debugging of the generator.
Generator/Generator.xcodeproj/xcshareddata · high confidence
Rewritten mock generation templates with improved protocol and concurrency support
The internal template engine for generating mocks has been completely rewritten to support modern Swift features and improve correctness. Generated mocks now conform to \@unchecked Sendable\ and use the \any\ keyword for existential types, ensuring better compatibility with Swift's concurrency model. The generator now correctly handles protocol composition, associated types, and typealiases, and includes specific fixes for throwing methods, default implementations, and keyword escaping in property names. Additionally, the new templates support typed throws and streamline generic parameter handling.
Generator/Sources/Internal/Templates · high confidence
Rewrote token model to use SwiftSyntax
The internal token model in the Generator has been completely rewritten to use SwiftSyntax, replacing the previous implementation. This change introduces new types for parsing accessibility, attributes, complex types (including closures, optionals, and generics), and method signatures, enabling more robust handling of Swift language features such as async/await, throws, and protocol associated types in generated mocks.
Generator/Sources/Internal/Tokens · high confidence
Source code crawler rewritten to use SwiftSyntax
The internal source crawler in the Generator has been migrated from its previous implementation to use the SwiftSyntax and SwiftParser libraries. This change updates how the generator parses Swift files, enabling more robust handling of language constructs such as typealiases, protocol composition, and generic parameters, which improves the accuracy of the generated mock code.
Generator/Sources/Internal/Crawlers · high confidence
Test coverage
Added comprehensive test coverage for Swift stubbing capabilities; Added test bundle configuration; Added test coverage for Objective-C mocking capabilities; Added unit tests for OrderedSet; Expanded Swift test suite for mocking and verification.
Dependencies
Cuckoo 2.4.0 release with Swift 6 support and updated dependencies
This release updates the Cuckoo mocking framework to version 2.4.0, raising the minimum Swift version to 6.0 and updating the SwiftSyntax dependency to the 601.x series to ensure compatibility with Swift 6 strict concurrency checking. The CocoaPods specification now enforces higher minimum deployment targets (iOS 13.0, macOS 10.15, watchOS 8.0, tvOS 13.0) and pins OCMock to version 3.9.3. Additionally, the Swift Package Manager manifest exposes the generator as an executable and includes plugins, while the Ruby development environment is updated to use Fastlane 2.228.0 and CocoaPods 1.16.2.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 62 → 57 (-5.1)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 96 → 95 (-1.1)
- Architecture 91 → 91 (-0.2)
- Maturity 56 → 56 (+0.0)
- Readiness 68 → 43 (-25.2)
- Security 56 → 72 (+16.3)
Resolved (8)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Duplicated block (24 lines × 2) (Source/Stubbing/ToBeStubbedProperty/ToBeStubbedReadOnlyProperty.swift)
- Low cohesion: Crawler (LCOM4 5) (Generator/Sources/Internal/Crawlers/Crawler.swift)
- Off-boarding risk: anonymized user #1
- Outdated: cocoapods
- Outdated: fastlane
- Outdated: json
New (17)
- Conflicting creation patterns. CreateMock.swift provides a generic factory method createMock that returns a typed mock, while CuckooFunctions.swift provides a stub function that seems to operate on an existing mock instance M. The relationship between Stubbing passed to createMock and the Stubbing passed to CuckooFunctions.stub is unclear, and users may not know which entry point to use for setting up stubs.
- Coverage not measured — Swift suite
- Duplicate configuration methods on different types. MockBuilder and MockManager both expose enableDefaultStubImplementation(). This mirrors the enableSuperclassSpy inconsistency and suggests a split responsibility that is not clearly defined in the API surface.
- Duplicate configuration methods on different types. MockBuilder and MockManager both expose enableSuperclassSpy(). It is unclear if these are independent configurations or if one delegates to the other, leading to potential confusion about which object controls the mock's behavior.
- Duplicated block (12 lines × 2) (Source/Matching/Matchable.swift)
- Duplicated block (7 lines × 2) (Generator/Sources/Internal/Tokens/WrappableType.swift)
- Duplicated block (9 lines × 2) (Source/Stubbing/ToBeStubbedProperty/ToBeStubbedProperty.swift)
- Duplicated block (9 lines × 2) (Source/Stubbing/ToBeStubbedProperty/ToBeStubbedProperty.swift)
- High CVE: [GHSA redacted] (Gemfile.lock)
- Inconsistent reset semantics. CuckooFunctions.swift.reset takes a HasMockManager (likely resetting mock state/invocations), while DefaultValueRegistry.reset resets default value registrations. While technically distinct, the naming reset is overloaded with different scopes (mock instance vs. global registry) without clear contextual differentiation in the function name.
- Low cohesion: Crawler (LCOM4 4) (Generator/Sources/Internal/Crawlers/Crawler.swift)
- MethodTooLong: MockManager.preconfiguredManager (Source/MockManager.swift)
- Off-boarding risk: anonymized user #1
- Outdated: rainbow
- Outdated: swift-argument-parser
- Outdated: xcodeproj
- Projects may be oversized for their cohesion
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
Brightify/Cuckoo was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 1 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 7cef6391ef36c684759f38a91968bbf97e12e02b — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-e569280dd5e2.