Unify swift format scripts and fix documentation

This commit is contained in:
Steffen authored and Bug Magnet committed 2025-09-30 11:11:30 +02:00
1 parent 19be6c47c4
commit 977e616b09
6 files changed
+60 -22

No files matched your search

+1 -1
View File
@@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4
- name: Run swift format lint
run: ./lint.sh -s
run: ./format.sh lint -s
working-directory: ios
ui-test-build:
+2 -2
View File
@@ -5833,7 +5833,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "./lint.sh\n";
shellScript = "./format.sh lint\n";
};
580E3F222A9861990061809D /* Run SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
@@ -5852,7 +5852,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "./lint.sh\n";
shellScript = "./format.sh lint\n";
};
A93969802CE603110032A7A0 /* Import maybenot_machines */ = {
isa = PBXShellScriptBuildPhase;
+1 -1
View File
@@ -49,7 +49,7 @@ The test device must be on the office WiFi `app-team-ios-tests` in order to be a
- `brew install ios-deploy jq`
7. Install Homebrew and dependencies
- `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"`
- `brew install xcbeautify wget swiftlint protobuf`
- `brew install xcbeautify wget protobuf`
8. Install Ruby
- `curl -sSL https://get.rvm.io | bash`
9. Install Rust and add iOS targets
+2 -15
View File
@@ -14,24 +14,11 @@ instructions document.
## Code formatting
The codebase is formatted using [SwiftFormat](https://github.com/nicklockwood/SwiftFormat). Please
The codebase is formatted using [swift-format](https://github.com/swiftlang/swift-format). Please
format all contributions using the latest version of formatter.
```
swiftformat ios/
```
Install the latest version of SwiftFormat via Homebrew:
```
brew install swiftformat
```
CI uses the latest version available on Homebrew to check formatting, so please keep your local
installation up to date, if you see it complain:
```
brew upgrade swiftformat
./ios/format.sh format
```
## Screenshots for AppStore
+54 -1
View File
@@ -1,2 +1,55 @@
#!/usr/bin/env bash
swift format format -r -p -i Mullvad* Routing* Shared TunnelObfuscationTests PacketTunnel* Operations*
set -euo pipefail
usage() {
echo "Usage: $0 [format|lint] [additional swift-format options]"
exit 1
}
if [[ $# -lt 1 ]]; then
usage
fi
command=$1
shift
case "$command" in
format|lint)
;;
*)
usage
;;
esac
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
included_folders=(
"MullvadLogging"
"MullvadMockData"
"MullvadPostQuantum"
"MullvadREST"
"MullvadRESTTests"
"MullvadRustRuntime"
"MullvadRustRuntimeTests"
"MullvadSettings"
"MullvadTypes"
"MullvadVPN"
"MullvadVPNTests"
"MullvadVPNUITests"
"Operations"
"OperationsTests"
"PacketTunnel"
"PacketTunnelCore"
"PacketTunnelCoreTests"
"Routing"
"RoutingTests"
"Shared"
"TunnelObfuscationTests"
)
cd "$script_dir"
if [[ "$command" == "lint" ]]; then
swift format lint -r -p "$@" "${included_folders[@]}"
elif [[ "$command" == "format" ]]; then
swift format format -r -p -i "$@" "${included_folders[@]}"
fi
-2
View File
@@ -1,2 +0,0 @@
#!/usr/bin/env bash
swift format lint -r -p "$@" Mullvad* Routing* Shared TunnelObfuscationTests PacketTunnel* Operations*