Skip to content

Fix analyze handling of Xcode 26 @response files - #6887

Draft
aryansk wants to merge 1 commit into
realm:mainfrom
aryansk:fix-analyze-xcode26-response-files-6877
Draft

Fix analyze handling of Xcode 26 @response files#6887
aryansk wants to merge 1 commit into
realm:mainfrom
aryansk:fix-analyze-xcode26-response-files-6877

Conversation

@aryansk

@aryansk aryansk commented Aug 23, 2026

Copy link
Copy Markdown

Fixes #6877

Problem

swiftlint analyze reported 0 files with exit 0 on Xcode 26 build logs:

xcodebuild ... clean build > xcodebuild.log
swiftlint analyze --compiler-log-path xcodebuild.log
# Done analyzing! Found 0 violations, 0 serious in 0 files.

Xcode 26 passes swiftc arguments via @response files (.../swiftc -module-name Sovran -Onone @/path/to/response). The log parser's expandingResponseFiles only split response files by newlines (components(separatedBy: "\n")), so space-separated files (Xcode 26) were treated as a single argument and no source files were discovered.

Quoted paths with spaces and nested @ files were also at risk, and parseCLIArguments mishandled leading quotes.

Change

  • Reuse parseCLIArguments for response file contents so both newline-separated (Xcode 25) and space-separated (Xcode 26) layouts are handled, including quoted paths and nested @ files.
  • Fix parseCLIArguments to correctly handle leading quotes and to split on whitespacesAndNewlines (not just " "), filtering empty components. This preserves existing log parsing while fixing response-file parsing.

Validation

  • Manual reproduction with temporary response files:
    • newline-separated (3 files) → 3, space-separated (3 files) → 3, quoted path with space → 2 correctly, mixed flags + files → 5
    • swiftc -module-name Sovran -Onone @/path correctly expands
    • bash -n equivalent file check passes; swift build of SwiftLintFramework target compiles (change is isolated to CompilerArgumentsExtractor.swift)

Xcode 26 passes swiftc arguments via @response files. The log
parser's expandingResponseFiles only split response files by newlines,
so space-separated files (Xcode 26) were treated as a single
argument and no source files were discovered, causing analyze to
report 0 violations with exit 0.

Fix by reusing parseCLIArguments for response files so both
newline-separated (Xcode 25) and space-separated (Xcode 26) layouts
are handled, including quoted paths and nested @ files. Also fix
parseCLIArguments to correctly handle leading quotes and to split on
whitespace/newlines instead of only spaces, and to filter empty
components.

Fixes realm#6877
@SwiftLintBot

Copy link
Copy Markdown
1 Warning
⚠️ If this is a user-facing change, please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.
20 Messages
📖 Building this branch resulted in the same binary size as when built on main.
📖 Linting Aerial with this PR took 0.64 s vs 0.63 s on main (1% slower).
📖 Linting Alamofire with this PR took 0.9 s vs 0.91 s on main (1% faster).
📖 Linting Brave with this PR took 5.96 s vs 5.95 s on main (0% slower).
📖 Linting Brigade with this PR took 16.16 s vs 15.82 s on main (2% slower).
📖 Linting DuckDuckGo with this PR took 28.37 s vs 28.48 s on main (0% faster).
📖 Linting Firefox with this PR took 10.61 s vs 10.58 s on main (0% slower).
📖 Linting Kickstarter with this PR took 6.81 s vs 6.81 s on main (0% slower).
📖 Linting Moya with this PR took 0.34 s vs 0.36 s on main (5% faster).
📖 Linting NetNewsWire with this PR took 2.33 s vs 2.33 s on main (0% slower).
📖 Linting Nimble with this PR took 0.54 s vs 0.52 s on main (3% slower).
📖 Linting PocketCasts with this PR took 6.91 s vs 6.89 s on main (0% slower).
📖 Linting Quick with this PR took 0.33 s vs 0.33 s on main (0% slower).
📖 Linting Realm with this PR took 2.83 s vs 2.82 s on main (0% slower).
📖 Linting Sourcery with this PR took 1.55 s vs 1.57 s on main (1% faster).
📖 Linting Swift with this PR took 4.25 s vs 4.23 s on main (0% slower).
📖 Linting SwiftLintPerformanceTests with this PR took 0.16 s vs 0.16 s on main (0% slower).
📖 Linting VLC with this PR took 1.21 s vs 1.23 s on main (1% faster).
📖 Linting Wire with this PR took 15.53 s vs 15.49 s on main (0% slower).
📖 Linting WordPress with this PR took 9.65 s vs 9.6 s on main (0% slower).

Here's an example of your CHANGELOG entry:

* Fix analyze handling of Xcode 26 @response files.  
  [aryansk](https://github.com/aryansk)
  [#issue_number](https://github.com/realm/SwiftLint/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by 🚫 Danger

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants