SwiftFormat: "Failed to format any files" on second run with --config option

Adding this on the build phase: ${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat" "$SRCROOT" ' --config ' "$SRCROOT/../swiftformart"

fails on the second run: Failed to format any files.

Adding this: ``${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat" “$SRCROOT” `

Works fine all the times.

version:

  • SwiftFormat/CLI (0.44.6)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 23 (16 by maintainers)

Most upvoted comments

I’ve taken steps to solve these issues in 0.44.11, in particular by removing the “Failed to format any files” error and only failing for more specific error cases. Let me know if this doesn’t solve the issue(s).

@PompeiaPaetenari the latest release (0.44.12) now logs the file path of any .swiftformat files it encounters while formatting. That should help you track down the rogue config file.

Perfect, I will give this a try.

Brilliant! I never would have found this otherwise… and not much we can do about Carthage.

/Carthage/Checkouts/fork-PhoneNumberKit/.swiftformat
warning: --ranges option is deprecated. Use --nospaceoperators instead.

@turtlemaster19 the issue with your project is fixed on the develop branch.

@brunofgs and @PompeiaPaetenari your issues are unrelated and I still don’t have a way to reproduce them, but you can try the develop branch and see if it solves them.

@turtlemaster19 What you posted was the verbose log of the swift run command, not the swiftformat command. I assume if you add --verbose in your build script you should see that output as well, but I was just doing it in terminal.