chore: Update the pods and pinned SwiftFormat [skip ci] (#120)

This commit is contained in:
Jithin Roy 2023-04-14 15:24:00 -07:00 committed by GitHub
parent 05654e8bb2
commit 49eb767a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 164 additions and 92 deletions

View File

@ -4,7 +4,7 @@ version: 2.1
defaults: &defaults
macos:
xcode: '13.2.1'
xcode: '14.2.0'
working_directory: ~/aws-appsync-realtime-client-ios
environment:
BUNDLE_PATH: vendor/bundle
@ -47,8 +47,8 @@ commands:
steps:
- restore_cache:
keys:
- v1-gems-{{ checksum "~/aws-appsync-realtime-client-ios/Gemfile.lock" }}
- v1-gems-
- app-{{ .Environment.CACHE_VERSION }}-gems-{{ checksum "~/aws-appsync-realtime-client-ios/Gemfile.lock" }}
- app-{{ .Environment.CACHE_VERSION }}-gems-
check_bundle:
steps:
@ -94,12 +94,12 @@ jobs:
- restore_gems
- run:
name: Bundle install
command: bundle check --path $BUNDLE_PATH || bundle install --path $BUNDLE_PATH
command: bundle config set --local path 'vendor/bundle' && bundle install
environment:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
- save_cache:
key: v1-gems-{{ checksum "~/aws-appsync-realtime-client-ios/Gemfile.lock" }}
key: app-{{ .Environment.CACHE_VERSION }}-gems-{{ checksum "~/aws-appsync-realtime-client-ios/Gemfile.lock" }}
paths:
- vendor/bundle
build_test_appsync_realtime_client:

View File

@ -9,7 +9,7 @@ if [[ -z $test_device_id ]] ; then
echo "Runtime: '${runtime}'"
# Get the last alphabetical device (probably something in the iPhone X family, as of 2019-05-31)
devicetype=$( xcrun simctl list devicetypes iPhone | sort | tail -1 | sed 's/.*(//' | sed 's/).*//' | tr -d '[:space:]' )
devicetype=$( xcrun simctl list devicetypes "iPhone " | sort | tail -1 | sed 's/.*(//' | sed 's/).*//' | tr -d '[:space:]' )
echo "Device type: '${devicetype}'"
test_device_id=$( xcrun simctl create "circleci-test-device" "${devicetype}" "${runtime}" | tr -d '[:space:]' )

View File

@ -2,7 +2,7 @@
platform :ios, '9.0'
def include_build_tools!
pod 'SwiftFormat/CLI'
pod 'SwiftFormat/CLI', "~> 0.49.0"
pod 'SwiftLint'
end

View File

@ -1,11 +1,11 @@
PODS:
- Starscream (4.0.4)
- SwiftFormat/CLI (0.48.17)
- SwiftLint (0.45.0)
- SwiftFormat/CLI (0.49.18)
- SwiftLint (0.51.0)
DEPENDENCIES:
- Starscream (~> 4.0.4)
- SwiftFormat/CLI
- SwiftFormat/CLI (~> 0.49.0)
- SwiftLint
SPEC REPOS:
@ -16,9 +16,9 @@ SPEC REPOS:
SPEC CHECKSUMS:
Starscream: 5178aed56b316f13fa3bc55694e583d35dd414d9
SwiftFormat: 0a9044eb365d74d4a0a2cefa5fe44a4cbef382a7
SwiftLint: e5c7f1fba68eccfc51509d5b2ce1699f5502e0c7
SwiftFormat: 2402d29b26746f169cce5454d5af88314cbb2e35
SwiftLint: 1b7561918a19e23bfed960e40759086e70f4dba5
PODFILE CHECKSUM: faccccbac411bb105d282d128939114db76875b9
PODFILE CHECKSUM: e76cd9f1f864d5985d232c1d82fa76bd06a050bf
COCOAPODS: 1.11.3
COCOAPODS: 1.12.0

14
Pods/Manifest.lock generated
View File

@ -1,11 +1,11 @@
PODS:
- Starscream (4.0.4)
- SwiftFormat/CLI (0.48.17)
- SwiftLint (0.45.0)
- SwiftFormat/CLI (0.49.18)
- SwiftLint (0.51.0)
DEPENDENCIES:
- Starscream (~> 4.0.4)
- SwiftFormat/CLI
- SwiftFormat/CLI (~> 0.49.0)
- SwiftLint
SPEC REPOS:
@ -16,9 +16,9 @@ SPEC REPOS:
SPEC CHECKSUMS:
Starscream: 5178aed56b316f13fa3bc55694e583d35dd414d9
SwiftFormat: 0a9044eb365d74d4a0a2cefa5fe44a4cbef382a7
SwiftLint: e5c7f1fba68eccfc51509d5b2ce1699f5502e0c7
SwiftFormat: 2402d29b26746f169cce5454d5af88314cbb2e35
SwiftLint: 1b7561918a19e23bfed960e40759086e70f4dba5
PODFILE CHECKSUM: faccccbac411bb105d282d128939114db76875b9
PODFILE CHECKSUM: e76cd9f1f864d5985d232c1d82fa76bd06a050bf
COCOAPODS: 1.11.3
COCOAPODS: 1.12.0

View File

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {
/* Begin PBXAggregateTarget section */
@ -15,6 +15,7 @@
dependencies = (
);
name = SwiftFormat;
productName = SwiftFormat;
};
52B60EC2A583F24ACBB69C113F5488B9 /* SwiftLint */ = {
isa = PBXAggregateTarget;
@ -24,6 +25,7 @@
dependencies = (
);
name = SwiftLint;
productName = SwiftLint;
};
/* End PBXAggregateTarget section */
@ -192,7 +194,7 @@
82393BF234D31DE622FCE3F0A6D81DA8 /* Pods-AppSyncRealTimeClient-AppSyncRealTimeClientTests.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-AppSyncRealTimeClient-AppSyncRealTimeClientTests.modulemap"; sourceTree = "<group>"; };
856119884A110C4AE532855C4B44D973 /* Pods-HostApp-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-HostApp-acknowledgements.plist"; sourceTree = "<group>"; };
8637F2372A3F1500A725E0B3C2995DCA /* FrameCollector.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FrameCollector.swift; path = Sources/Framer/FrameCollector.swift; sourceTree = "<group>"; };
891B2270823847ED23F2ECFC28F935EC /* Starscream */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Starscream; path = Starscream.framework; sourceTree = BUILT_PRODUCTS_DIR; };
891B2270823847ED23F2ECFC28F935EC /* Starscream.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Starscream.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8E6E2E9C7E9DC8FAA7C03E83452794FB /* FoundationHTTPHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = FoundationHTTPHandler.swift; path = Sources/Framer/FoundationHTTPHandler.swift; sourceTree = "<group>"; };
8FBFA4F497BF24BAB2C3C2C46831CA0A /* Starscream-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Starscream-umbrella.h"; sourceTree = "<group>"; };
926BDB89A966BBC606CD53BA1871E433 /* Pods-HostApp-AppSyncRealTimeClientIntegrationTests-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-HostApp-AppSyncRealTimeClientIntegrationTests-dummy.m"; sourceTree = "<group>"; };
@ -203,7 +205,7 @@
999D7A0732B0168D9EB631C456DEC8A3 /* Pods-AppSyncRealTimeClient-AppSyncRealTimeClientTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AppSyncRealTimeClient-AppSyncRealTimeClientTests.release.xcconfig"; sourceTree = "<group>"; };
9B273836AFE7E07EE713B29F94B54285 /* Starscream.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Starscream.release.xcconfig; sourceTree = "<group>"; };
9D2BCC3D81009251CF149E4E6A0C224E /* StringHTTPHandler.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = StringHTTPHandler.swift; path = Sources/Framer/StringHTTPHandler.swift; sourceTree = "<group>"; };
9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
9FF7D529C51D3F1B0D444B08C40EE3AD /* Pods-AppSyncRTCSample-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-AppSyncRTCSample-frameworks.sh"; sourceTree = "<group>"; };
A26BD722B33E83A41BD4A44DD2BDC4E3 /* Pods-AppSyncRTCSample-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-AppSyncRTCSample-umbrella.h"; sourceTree = "<group>"; };
A31447240FB4AA22B5D3E1287DAF4DCB /* Pods-HostApp-AppSyncRealTimeClientIntegrationTests-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-HostApp-AppSyncRealTimeClientIntegrationTests-acknowledgements.markdown"; sourceTree = "<group>"; };
@ -327,7 +329,6 @@
F07B207CD9F5DF97C2D649C58C619BB7 /* WSEngine.swift */,
83681F15B53C4D30045511A41B8A97FD /* Support Files */,
);
name = Starscream;
path = Starscream;
sourceTree = "<group>";
};
@ -401,7 +402,7 @@
C5D92A24D6DBC95BE97867525C82CA97 /* Pods-AppSyncRTCSample */,
ED00F87B053026A542BE85D0CA39F88F /* Pods-HostApp */,
53FD200EDC1B7F726E251F28FC00588D /* Pods-HostApp-AppSyncRealTimeClientIntegrationTests */,
891B2270823847ED23F2ECFC28F935EC /* Starscream */,
891B2270823847ED23F2ECFC28F935EC /* Starscream.framework */,
);
name = Products;
sourceTree = "<group>";
@ -443,7 +444,6 @@
children = (
37E4C763E3D1AD54AEBD3E13FA588594 /* Support Files */,
);
name = SwiftLint;
path = SwiftLint;
sourceTree = "<group>";
};
@ -469,7 +469,6 @@
children = (
120316207F6661A29A01BB8F9BBEF8F1 /* Support Files */,
);
name = SwiftFormat;
path = SwiftFormat;
sourceTree = "<group>";
};
@ -690,7 +689,7 @@
);
name = Starscream;
productName = Starscream;
productReference = 891B2270823847ED23F2ECFC28F935EC /* Starscream */;
productReference = 891B2270823847ED23F2ECFC28F935EC /* Starscream.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
@ -699,11 +698,11 @@
BFDFE7DC352907FC980B868725387E98 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1240;
LastUpgradeCheck = 1240;
LastSwiftUpdateCheck = 1300;
LastUpgradeCheck = 1300;
};
buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */;
compatibilityVersion = "Xcode 10.0";
compatibilityVersion = "Xcode 12.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
@ -1167,22 +1166,6 @@
};
name = Debug;
};
8021953E6393470ED3D7F8DD5FD2D6A5 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = D999E258E54C8B9C1FD75659EC9F1DFA /* SwiftFormat.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
89DDD25DB9130670FEDC5E0AD0F46AE7 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = A9735D953EBECD0EBC3C1D3EC8BCAFFC /* Starscream.debug.xcconfig */;
@ -1198,7 +1181,7 @@
GCC_PREFIX_HEADER = "Target Support Files/Starscream/Starscream-prefix.pch";
INFOPLIST_FILE = "Target Support Files/Starscream/Starscream-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -1217,6 +1200,23 @@
};
name = Debug;
};
8DEF60E8A61723230ABCDDDD8B05F224 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1E6FB18A133A55AEF2676257477E2BC6 /* SwiftFormat.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
96A1F448F20C32FC078FF22CDFF73BDE /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 174519BFBCA8DC0E354AF1AB53B8650C /* Pods-HostApp.debug.xcconfig */;
@ -1290,23 +1290,6 @@
};
name = Release;
};
9E65CF2031BEEA6B85B0C9F11AAAF3C6 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1E6FB18A133A55AEF2676257477E2BC6 /* SwiftFormat.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
A2D81D764443440850CD12659BAA7370 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0C41223EE05E190DCA6549742F79399F /* Pods-AppSyncRTCSample.release.xcconfig */;
@ -1398,6 +1381,22 @@
};
name = Release;
};
B4D735C278D065C9DB708F250D0B915D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = D999E258E54C8B9C1FD75659EC9F1DFA /* SwiftFormat.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
CA547D2C7E9A8A153DC2B27FBE00B112 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -1475,7 +1474,7 @@
GCC_PREFIX_HEADER = "Target Support Files/Starscream/Starscream-prefix.pch";
INFOPLIST_FILE = "Target Support Files/Starscream/Starscream-Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -1589,8 +1588,8 @@
6B2B7DF197DF6A7CA487150557230A41 /* Build configuration list for PBXAggregateTarget "SwiftFormat" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8021953E6393470ED3D7F8DD5FD2D6A5 /* Debug */,
9E65CF2031BEEA6B85B0C9F11AAAF3C6 /* Release */,
B4D735C278D065C9DB708F250D0B915D /* Debug */,
8DEF60E8A61723230ABCDDDD8B05F224 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;

Binary file not shown.

View File

@ -21,6 +21,8 @@ Table of Contents
- [Sublime Text plugin](#sublime-text-plugin)
- [Git pre-commit hook](#git-pre-commit-hook)
- [On CI using Danger](#on-ci-using-danger)
- [Bazel build](#bazel-build)
- [Docker](#docker)
- [Configuration](#configuration)
- [Options](#options)
- [Rules](#rules)
@ -44,6 +46,7 @@ SwiftFormat is a code library and command-line tool for reformatting Swift code
SwiftFormat goes above and beyond what you might expect from a code formatter. In addition to adjusting white space it can insert or remove implicit `self`, remove redundant parentheses, and correct many other deviations from the standard Swift idioms.
Why would I want to do that?
-----------------------------
@ -72,7 +75,7 @@ Command-line tool
**Installation:**
You can install the `swiftformat` command-line tool on macOS using [Homebrew](http://brew.sh/). Assuming you already have Homebrew installed, just type:
You can install the `swiftformat` command-line tool on macOS or Linux using [Homebrew](http://brew.sh/). Assuming you already have Homebrew installed, just type:
```bash
$ brew install swiftformat
@ -90,13 +93,7 @@ Alternatively, you can install the tool on macOS or Linux by using [Mint](https:
$ mint install nicklockwood/SwiftFormat
```
And then run it using:
```bash
$ mint run swiftformat
```
Or if you prefer, you can check out and build SwiftFormat manually on macOS or Linux as follows:
Or if you prefer, you can check out and build SwiftFormat manually on macOS, Linux or Windows as follows:
```bash
$ git clone https://github.com/nicklockwood/SwiftFormat
@ -106,6 +103,16 @@ $ swift build -c release
If you are installing SwiftFormat into your project directory, you can use [CocoaPods](https://cocoapods.org/) on macOS to automatically install the swiftformat binary along with your other pods - see the Xcode build phase instructions below for details.
Another option is to include the binary artifactbundle in your `Package.swift`:
```swift
.binaryTarget(
name: "SwiftFormat",
url: "https://github.com/nicklockwood/SwiftFormat/releases/download/0.49.12/swiftformat-macos.artifactbundle.zip",
checksum: "CHECKSUM"
),
```
If you would prefer not to use a package manager, you can build the command-line app manually:
1. open `SwiftFormat.xcodeproj` and build the `SwiftFormat (Application)` scheme.
@ -210,7 +217,7 @@ Alternatively, if you prefer not to use Homebrew, you'll find the latest version
**Usage:**
Once you have launched the app and restarted Xcode, you'll find a SwiftFormat option under Xcode's Editor menu.
Once you have launched the app and restarted Xcode, you'll find a SwiftFormat option under Xcode's Editor menu. If the SwiftFormat menu does not appear [this thread](https://github.com/nicklockwood/SwiftFormat/issues/494) may help.
You can configure the formatting [rules](#rules) and [options](#options) using the SwiftFormat for Xcode host application. There is currently no way to override these per-project, however, you can import and export different configurations using the File menu. You will need to do this again each time you switch projects.
@ -230,7 +237,7 @@ Alternatively, you might want to consider running SwiftFormat in [lint](#linting
To set up SwiftFormat as an Xcode build phase, do the following:
#### 1) Create a BuildTools folder & Package.swift
#### 1) Create a BuildTools folder and Package.swift
1. Create a folder called `BuildTools` in the same folder as your xcodeproj file
2. In this folder, create a file called `Package.swift`, with the following contents:
@ -242,14 +249,14 @@ let package = Package(
name: "BuildTools",
platforms: [.macOS(.v10_11)],
dependencies: [
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.48.10"),
.package(url: "https://github.com/nicklockwood/SwiftFormat", from: "0.49.0"),
],
targets: [.target(name: "BuildTools", path: "")]
)
```
3. If you are running Xcode 11.4 or later, in the `BuildTools` folder create a file called `Empty.swift` with nothing in it. This is to satisfy a change in Swift Package Manager.
#### 2) Add a Build phases to your app target
#### 2) Add a Build phase to your app target
1. Click on your project in the file list, choose your target under `TARGETS`, click the `Build Phases` tab
2. Add a `New Run Script Phase` by clicking the little plus icon in the top left
@ -266,14 +273,14 @@ You can also use `swift run -c release --package-path BuildTools swiftformat "$S
**NOTE:** You may wish to check BuildTools/Package.swift into your source control so that the version used by your run-script phase is kept in version control. It is recommended to add the following to your .gitignore file: `BuildTools/.build` and `BuildTools/.swiftpm`.
### Using Cocoapods
### Using CocoaPods
#### 1) Add the SwiftFormat CLI to your Podfile
1. Add the `swiftformat` binary to your project directory via [CocoaPods](https://cocoapods.org/), by adding the following line to your Podfile then running `pod install`:
```ruby
pod 'SwiftFormat/CLI'
pod 'SwiftFormat/CLI', '~> 0.49'
```
**NOTE:** This will only install the pre-built command-line app, not the source code for the SwiftFormat framework.
@ -376,6 +383,46 @@ To setup SwiftFormat to be used by your continuous integration system using [Dan
**NOTE:** It is recommended to add the `swiftformat` binary to your project directory to ensure the same version is used each time (see the [Xcode build phase](#xcode-build-phase) instructions above).
Bazel Build
-----------
If you use [Bazel](https://bazel.build/) to build your Swift projects and want to ensure that only properly formatted code is merged to your main branch, try [rules_swiftformat](https://github.com/cgrindel/rules_swiftformat). The repository contains Bazel rules and macros that format Swift source files using SwiftFormat, test that the formatted files exist in the workspace directory, and copy the formatted files to the workspace directory.
Docker
-----------
SwiftFormat publishes releases into [GitHub Packages](https://github.com/features/packages) Docker registry. To pull the image call:
```bash
$ docker pull ghcr.io/nicklockwood/swiftformat:latest
```
By default, the container runs `swiftformat .` Therefore, you need to provide a path either via an argument:
```bash
docker run --rm -v /local/source/path:/work ghcr.io/nicklockwood/swiftformat:latest /work
```
or by changing the working dir:
```bash
docker run --rm -v /local/source/path:/work -w /work ghcr.io/nicklockwood/swiftformat:latest
```
To check the installed SwiftFormat version:
```bash
docker run --rm ghcr.io/nicklockwood/swiftformat:latest --version
```
Linting example:
```bash
docker run --rm -v /local/source/path:/work ghcr.io/nicklockwood/swiftformat:latest /work --lint
```
Configuration
-------------
@ -438,7 +485,13 @@ Alternatively, you can use the line continuation character `\` to wrap a single
redundantSelf
```
To avoid automatically opting-in to new rules when SwiftFormat is updated, use the`--rules` argument to *only* enable the rules you specify:
To avoid automatically opting-in to new rules when SwiftFormat is updated, you can disable all rules using:
```bash
--disable all
```
And then individually enable just the rules you want. Alternatively, use the`--rules` argument to *only* enable the rules you specify:
```bash
--rules indent,linebreaks
@ -615,6 +668,13 @@ By default, `--lint` will only report lines that require formatting, but you can
If you would prefer not to see a warning for each and every formatting change, you can use the `--quiet` flag to suppress all output except errors.
Sometimes you may wish to autoformat some rules, but only lint others. To do that, use the `--lintonly` option in your config file to specify rules that should only be applied in `--lint` mode:
```
--rules braces,indent
--lintonly trailingClosures,unusedArguments
```
Error codes
-----------
@ -701,7 +761,7 @@ FAQ
*Q. What platforms does SwiftFormat support?*
> A. SwiftFormat works on macOS 10.13 (High Sierra) and above, and also runs on Ubuntu Linux.
> A. SwiftFormat works on macOS 10.13 (High Sierra) and above, and also runs on Ubuntu Linux and Windows.
*Q. What versions of Swift are supported?*
@ -758,6 +818,12 @@ Q. I don't want to be surprised by new rules added when I upgrade SwiftFormat. H
Known issues
---------------
* When using the Xcode Source Editor Extension, the SwiftFormat menu sometimes disappears from Xcode. If this happens, try moving or renaming Xcode temporarily and then changing it back. Failing that, the suggestions in [this thread](https://github.com/nicklockwood/SwiftFormat/issues/494) may help.
* The `enumNamespaces` rule replaces classes that have only static members with an `enum`. If the class is subclassed, or if there is code that depends on the class exposing certain runtime behaviors, this may break the program. To solve this you can either fix it on a per-case basis by adding a `// swiftformat:disable:next enumNamespaces` comment directive above the class declaration, or just disable the `enumNamespaces` rule completely.
* The `redundantVoidReturnType` rule can inadvertently alter the type signature for closures, for example in cases where the closure calls a `@discardableResult` function. To solve this you can either fix it on a per-case basis by adding a `// swiftformat:disable:next redundantVoidReturnType` comment directive to disable the rule for a specific call site, or you can add `--closurevoid preserve` to your [configuration](#configuration) to disable the rule completely for closures (regular functions or methods aren't affected).
* The `redundantType` rule can introduce ambiguous code in certain cases when using the default mode of `--redundanttype inferred`. This can be worked around by by using `--redundanttype explicit`, or by manually removing the redundant type reference on the affected line, or by using the `// swiftformat:disable:next redundantType` comment directive to disable the rule at the call site (or just disable the `redundantType` rule completely).
* If a type initializer or factory method returns an implicitly unwrapped optional value then the `redundantType` rule may remove the explicit type in a situation where it's actually required. To work around this you can either use `--redundanttype explicit`, or use the `// swiftformat:disable:next redundantType` comment directive to disable the rule at the call site (or just disable the `redundantType` rule completely).
@ -770,7 +836,7 @@ Known issues
* When using the `--self remove` option, the `redundantSelf` rule will remove references to `self` in autoclosure arguments, which may change the meaning of the code, or cause it not to compile. To work around this issue, use the `--selfrequired` option to provide a comma-delimited list of methods to be excluded from the rule. The `expect()` function from the popular [Nimble](https://github.com/Quick/Nimble) unit testing framework is already excluded by default. If you are using the `--self insert` option then this is not an issue.
* If you assign `SomeClass.self` to a variable and then instantiate an instance of the class using that variable, Swift requires that you use an explicit `.init()`, however, the `redundantInit` rule is not currently capable of detecting this situation and will remove the `.init`. To work around this issue, use the `// swiftformat:disable:next redundantInit` comment directive to disable the rule for any affected lines of code (or just disable the `redundantInit` rule completely).
* If you assign `SomeClass.self` to a variable and then instantiate an instance of the class using that variable, Swift requires that you use an explicit `.init()`, however, the `redundantInit` rule is not currently capable of detecting this situation in all cases, and may remove the `.init`. To work around this issue, use the `// swiftformat:disable:next redundantInit` comment directive to disable the rule for any affected lines of code (or just disable the `redundantInit` rule completely).
* The `--self insert` option can only recognize locally declared member variables, not ones inherited from superclasses or extensions in other files, so it cannot insert missing `self` references for those. Note that the reverse is not true: `--self remove` should remove *all* redundant `self` references.
@ -814,6 +880,7 @@ Credits
* [Jim Puls](https://github.com/puls) - Big Sur icon update
* [Daniele Formichelli](https://github.com/danyf90) - JSON reporter
* [Mahdi Bchatnia](https://github.com/inket) - Linux build workflow
* [Arthur Semenyutin](https://github.com/vox-humana) - Docker image
* [Nick Lockwood](https://github.com/nicklockwood) - Everything else
([Full list of contributors](https://github.com/nicklockwood/SwiftFormat/graphs/contributors))

BIN
Pods/SwiftLint/swiftlint generated

Binary file not shown.

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>${PODS_DEVELOPMENT_LANGUAGE}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>

View File

@ -5,6 +5,7 @@ LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFOR
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/Starscream
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates

View File

@ -5,6 +5,7 @@ LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFOR
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/Starscream
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates

View File

@ -5,6 +5,7 @@ LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFOR
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftFormat
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates

View File

@ -5,6 +5,7 @@ LIBRARY_SEARCH_PATHS = $(inherited) "${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFOR
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftFormat
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates

View File

@ -3,6 +3,7 @@ CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftLint
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftLint
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates

View File

@ -3,6 +3,7 @@ CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftLint
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftLint
PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates