Do you have any idea how I can integrate Xcode generated source code?
Using Xcode 15.2, periphery 2.18.0. I want to use periphery also to scan generated code from SwiftGen, R.swift, Xcode or macros. For SwiftGen and R.swift it's not a big deal, because their output files are part of the Xcode project directly. But for Xcode-generated code like GeneratedAssetSymbols.swift or macros like #Preview it doesn't work. Maybe you have an idea how I can solve this. The GeneratedAssetSymbols.swift is located at ~/Library/Developer/Xcode/DerivedData/YourProject-abc123/Build/Intermediates.noindex/YourProject.build/Debug-iphonesimulator/YourProject.build/DerivedSources/*.swift. The macros are located at /private/var/folders/x4/pm..._.../T/swift-generated-sources
Same thing for xcode package plugin generated code. Stored at ~/Library/Developer/Xcode/DerivedData/*/SourcePackages/Plugins/*.output/**/*.
This issue should now be resolved in 3.0.0. Let me know if you continue to experience this issue and I will reinvestigate.
@ileitch Thanks for the info. I've tested the latest version 3.0.1. The unused color which I've added to my color catalog and be part of the Xcode generated output file GeneratedAssetSymbols.swift in ~/Library/Developer/Xcode/DerivedData/YourProject-abc123/Build/Intermediates.noindex/YourProject.build/Debug-iphonesimulator/YourProject.build/DerivedSources/*.swift hasn't detected as unused code. Do you have any idea? I've tried a lot of configurations especially with the path parameter --report-include.
@AF-cgi This file is not scanned because Periphery excludes paths matching the pattern **/*?.build/**/*. Unfortunately, I don't think relaxing this pattern to allow GeneratedAssetSymbols.swift to be scanned is necessarily the correct solution. This file also contains other declarations that will be identified as unused, but due to its generated nature, you cannot selectively remove only the unused declarations. I think we will need a new mechanism to detect unused color assets. I moved that discussion to https://github.com/peripheryapp/periphery/issues/860.
Results with the exclude pattern removed:
<snip>/GeneratedAssetSymbols.swift:47:16: warning: Property 'unused' is unused
<snip>/GeneratedAssetSymbols.swift:88:16: warning: Property 'unused' is unused
<snip>/GeneratedAssetSymbols.swift:117:13: warning: Initializer 'init(thinnableName:bundle:)' is unused
<snip>/GeneratedAssetSymbols.swift:142:25: warning: Initializer 'init(thinnableResource:)' is unused
<snip>/GeneratedAssetSymbols.swift:181:13: warning: Initializer 'init(thinnableResource:)' is unused
<snip>/GeneratedAssetSymbols.swift:194:13: warning: Initializer 'init(thinnableResource:)' is unused
<snip>/GeneratedAssetSymbols.swift:209:13: warning: Initializer 'init(thinnableName:bundle:)' is unused
@Lommelun If you can provide an example of a package plugin that generates sources, I can take a look.