yellow-cap
(Artem Chernousov)
1
Hello, guys. Faced with this problem. Swift-format error shown, if I have the line break between the error word in the function parameters.
swift-format shows an error:
func test(
error: Error
) {
print("test \(error)")
}
swift-format doesn't show an error
func test(error: Error) {
print("test \(error)")
}
swift-format version: 0.50500.0 Thanks.
xwu
(Xiaodi Wu)
2
What is the error you are referring to?
yellow-cap
(Artem Chernousov)
3
Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure
swift-format seems to be printing out every single file to the console, and Xcode interprets any line starting with error: as an error. That’s kind of funny and unfortunate.
What is the contents of your script phase for running swift format?
2 Likes
yellow-cap
(Artem Chernousov)
5
Xcode interprets any line starting with error: as an error.
Same thoughts.
if which swift-format >/dev/null; then
swift-format format -r ${PROJECT_DIR} --configuration .swift-format.json
swift-format lint -r ${PROJECT_DIR} --configuration .swift-format.json
else
echo "warning: swift-format not installed"
fi
allevato
(Tony Allevato)
6
Make sure that you use the -i or --in-place flag on the format command to write the output back to the original file, otherwise it gets written to standard output.
2 Likes