SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

analyze finds 0 files in Xcode 26 build logs and reports success

Open kroussevrb opened this issue 3 months ago • 1 comments

New Issue Checklist

Bug Description

swiftlint analyze finds no files in build logs produced by Xcode 26 and reports success:

$ xcodebuild -project App.xcodeproj -scheme "App" -destination generic/platform=iOS clean build > xcodebuild.log
$ swiftlint analyze --compiler-log-path xcodebuild.log
Done analyzing! Found 0 violations, 0 serious in 0 files.
$ echo $?
0

Xcode 26 passes the compiler arguments through @response files, so the log no longer contains the source file lists the log parser looks for:

SwiftDriver Sovran normal arm64 com.apple.xcode.tools.swift.compiler (in target 'Sovran' from project 'Sovran')
    builtin-SwiftDriver -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -module-name Sovran -Onone @/Users/me/Library/Developer/Xcode/DerivedData/.../Sovran-OutputFileMap.json ...

The exit code 0 plus "0 violations" makes the breakage easy to miss: our CI lane kept reporting green while unused_declaration and unused_import had not run on a single file.

Things I tried:

  • Building with EMIT_FRONTEND_COMMAND_LINES=YES: the log then contains full swift-frontend invocations, but analyze still reports 0 files (the parser appears to only match swiftc driver lines).
  • Expanding the @response files inline into the log: analyze then finds the files, but SourceKit rejects the argument set, apparently over the explicit-modules flags - 35,000+ cursor info failed: Loading the standard library failed errors over the first 102 files, and no usable results.

Two candidate improvements, independently useful:

  1. Expand @response file references when extracting compiler arguments from the log (and/or accept swift-frontend lines from EMIT_FRONTEND_COMMAND_LINES=YES).
  2. Exit non-zero, or at least warn loudly, when a compiler log yields 0 analyzable files - "Found 0 violations in 0 files" reads as a pass today.

Environment

  • SwiftLint version: 0.65.0 (same behavior on 0.52.4)
  • Xcode version: Xcode 26.6 (Build 17F113), macOS 26.6.2
  • Installation method used: prebuilt binary (portable_swiftlint.zip)
  • Configuration file: only analyzer_rules: [unused_declaration, unused_import] is relevant; no nested configurations

kroussevrb avatar Aug 20 '26 10:08 kroussevrb

Thanks for the report — the @response file handling is clear. I'll put up a fix for the analyzer's log parser.

aryansk avatar Aug 23 '26 13:08 aryansk