Skip to content

Commit

Permalink
fix SwiftFormat caching
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrence-forooghian committed Aug 1, 2024
1 parent 9cb8053 commit 6c1be26
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ DerivedData/

# Other things to ignore:
/node_modules
/.swiftformat-cache
4 changes: 3 additions & 1 deletion script/format/check
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

set -e

swift package plugin --allow-writing-to-package-directory swiftformat --lint
# Without specifying --cache we get a warning of "Failed to write cache file at /Users/lawrence/Library/Caches/com.charcoaldesign.swiftformat/swiftformat.cache."; presumably this is to do with sandboxing restrictions imposed on Swift package scripts.
swift package plugin --allow-writing-to-package-directory swiftformat --cache .swiftformat-cache --lint

npm run format:check
4 changes: 3 additions & 1 deletion script/format/fix
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

set -e

swift package plugin --allow-writing-to-package-directory swiftformat
# (See the `check` script for why we specify --cache. The repetition is because, according to https://github.com/nicklockwood/SwiftFormat/issues/1651#issuecomment-2009943414, you can’t use a .swiftformat file to specify the --cache option.)
swift package plugin --allow-writing-to-package-directory swiftformat --cache .swiftformat-cache

npm run format:fix

0 comments on commit 6c1be26

Please sign in to comment.