Add @SafeDIConfiguration macro to replace CSV config#199
Merged
Conversation
Introduce a @SafeDIConfiguration macro that allows SafeDI build configuration to be expressed in Swift source code instead of CSV files. The macro decorates a struct requiring two properties: `additionalImportedModules` and `additionalDirectoriesToInclude`, both of type [StaticString] initialized with string literal arrays. CSV files are still supported (with TODO comments for removal in 2.0) but an error is raised if both are present. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #199 +/- ##
========================================
Coverage 99.90% 99.91%
========================================
Files 32 36 +4
Lines 3274 3470 +196
========================================
+ Hits 3271 3467 +196
Misses 3 3
🚀 New features to boost your workflow:
|
Don't skip children when visiting a @SafeDIConfiguration-decorated struct, so it can also participate in the dependency tree if decorated with @INSTANTIABLE. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use an uninhabited enum instead of a struct to prevent accidental instantiation. Properties are now static let, matching the constant nature of the configuration. No visibility is enforced — the type can be private, internal, public, etc. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…rmat Add SafeDIConfiguration.swift to the ExampleMultiProjectIntegration xcodeproj so the Xcode build tool plugin can see it. Also applies SwiftFormat to new files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix findSwiftFiles to not re-read swiftSourcesFilePath on the second pass for additionalDirectoriesToInclude. Add tests for the two-pass directory scanning path, invalid config values in FileVisitor, and the CSV+source conflict with includeFolders. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The decoratingNonEnum, additionalImportedModulesNotStringLiteralArray, and additionalDirectoriesToIncludeNotStringLiteralArray cases were thrown as plain errors in the macro, never used as fixable diagnostics. Their diagnostic/fixIt paths were dead code causing coverage gaps. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…itor Covers the `continue` branch when a variable binding doesn't have an identifier pattern (e.g. tuple destructuring). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rename tests to follow existing conventions and make them verify meaningful behavior rather than just exercising code paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@SafeDIConfigurationpeer macro that decorates an enum with two requiredstatic letproperties:additionalImportedModules: [StaticString]andadditionalDirectoriesToInclude: [StaticString], validated at compile time with fix-its for missing propertiesSafeDIToolto extract configuration from source files, with a second pass foradditionalDirectoriesToIncludedirectories@SafeDIConfigurationare present; CSV support retained with TODO comments for removal in 2.0ExampleMultiProjectIntegrationto use the new macro instead of CSV filesTest plan
🤖 Generated with Claude Code