Apply SwiftFormat (#44)

* add .swiftFormat

add Run script for swiftFormat

* Remove some conditions
This commit is contained in:
Kwangmin Bae 2021-06-11 00:04:46 +09:00 committed by GitHub
parent 93edcee7dd
commit bbfbd32f34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 0 deletions

18
.swiftformat Normal file
View File

@ -0,0 +1,18 @@
# version: 0.47.5
--indent 4 #indent
--self init-only # redundantSelf
--semicolons never # semicolons
--stripunusedargs closure-only # unusedArguments
--maxwidth 140 #wrap
--assetliterals visual-width #wrap
--wraparguments after-first # wrapArguments
--wrapparameters after-first # wrapArguments
--wrapcollections before-first # wrapArguments
--wrapconditions after-first # wrapArguments
--funcattributes prev-line # wrapAttributes
--typeattributes prev-line # wrapAttributes
--varattributes prev-line # wrapAttributes
--enable isEmpty
--disable strongOutlets,yodaConditions

View File

@ -427,6 +427,7 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 535870712669D21700D05A09 /* Build configuration list for PBXNativeTarget "JellyfinPlayer tvOS" */; buildConfigurationList = 535870712669D21700D05A09 /* Build configuration list for PBXNativeTarget "JellyfinPlayer tvOS" */;
buildPhases = ( buildPhases = (
62F49E8926721894002F2064 /* SwiftFormat */,
5358705C2669D21600D05A09 /* Sources */, 5358705C2669D21600D05A09 /* Sources */,
5358705D2669D21600D05A09 /* Frameworks */, 5358705D2669D21600D05A09 /* Frameworks */,
5358705E2669D21600D05A09 /* Resources */, 5358705E2669D21600D05A09 /* Resources */,
@ -451,6 +452,7 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 5377CC1B263B596B003A4E83 /* Build configuration list for PBXNativeTarget "JellyfinPlayer iOS" */; buildConfigurationList = 5377CC1B263B596B003A4E83 /* Build configuration list for PBXNativeTarget "JellyfinPlayer iOS" */;
buildPhases = ( buildPhases = (
62F49E8826721881002F2064 /* SwiftFormat */,
5377CBED263B596A003A4E83 /* Sources */, 5377CBED263B596A003A4E83 /* Sources */,
5377CBEE263B596A003A4E83 /* Frameworks */, 5377CBEE263B596A003A4E83 /* Frameworks */,
5377CBEF263B596A003A4E83 /* Resources */, 5377CBEF263B596A003A4E83 /* Resources */,
@ -577,6 +579,45 @@
}; };
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
62F49E8826721881002F2064 /* SwiftFormat */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = SwiftFormat;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT\"/Scripts/SwiftFormat.sh\n";
};
62F49E8926721894002F2064 /* SwiftFormat */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = SwiftFormat;
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"$SRCROOT\"/Scripts/SwiftFormat.sh \n";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
5358705C2669D21600D05A09 /* Sources */ = { 5358705C2669D21600D05A09 /* Sources */ = {
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;

6
Scripts/SwiftFormat.sh Executable file
View File

@ -0,0 +1,6 @@
# Type a script or drag a script file from your workspace to insert its path.
if which swiftformat >/dev/null; then
swiftformat . --lint --lenient
else
echo "warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat"
fi