Skip to content

Commit ced59cc

Browse files
committed
Do not validate that all parameters have documentation
In particular, not all members of syntax nodes have documentation and it is not realistic to add meaningful documentation to all of them in the near future.
1 parent 8ceb172 commit ced59cc

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/commands/VerifyDocumentation.swift

+24-1
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,34 @@ struct VerifyDocumentation: ParsableCommand {
4646
}
4747
}
4848

49+
func xcodeVersion(xcodebuildExec: URL) throws -> (major: Int, minor: Int) {
50+
let result = try ProcessRunner(
51+
executableURL: xcodebuildExec,
52+
arguments: ["-version"]
53+
).run(captureStdout: true, captureStderr: false, verbose: false)
54+
let xcodeVersionRegex = Regex {
55+
"Xcode "
56+
Capture(OneOrMore(.digit))
57+
"."
58+
Capture(OneOrMore(.digit))
59+
}
60+
guard let match = result.stdout.firstMatch(of: xcodeVersionRegex), let major = Int(match.1),
61+
let minor = Int(match.2)
62+
else {
63+
throw ScriptExectutionError(message: "Failed to extract Xcode version to verify documentation")
64+
}
65+
return (major, minor)
66+
}
67+
4968
func buildDocumentation(product: String) throws {
5069
guard let xcodebuildExec = try? Paths.xcodebuildExec else {
5170
return
5271
}
5372
logSection("Building documentation for \(product)")
73+
var otherDoccFlags = ["--warnings-as-errors"]
74+
if try xcodeVersion(xcodebuildExec: xcodebuildExec) >= (16, 0) {
75+
otherDoccFlags.append("--disable-parameters-and-returns-validation")
76+
}
5477
try ProcessRunner(
5578
executableURL: xcodebuildExec,
5679
arguments: [
@@ -60,7 +83,7 @@ struct VerifyDocumentation: ParsableCommand {
6083
"-scheme",
6184
product,
6285
"-destination", "platform=macOS",
63-
"OTHER_DOCC_FLAGS='--warnings-as-errors'",
86+
"OTHER_DOCC_FLAGS=\(otherDoccFlags.joined(separator: " "))",
6487
]
6588
).run(captureStdout: false, captureStderr: false, verbose: self.verbose)
6689
}

0 commit comments

Comments
 (0)