forked from argentlabs/web3.swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: - Add Swiftformat configuration - Add script to run swiftformat - Reformat code - Run Swiftformat Lint on CI - Add a separate script prepareForPush.sh as more lints might come in future
- Loading branch information
1 parent
b50f919
commit 2401baa
Showing
77 changed files
with
1,892 additions
and
1,480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,3 +64,5 @@ fastlane/report.xml | |
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
|
||
scripts/bin/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
SWIFT_VERSION=5.3 | ||
|
||
cd "$(dirname "$0")" | ||
|
||
./runSwiftFormat.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/sh | ||
|
||
SWIFT_VERSION=5.3 | ||
|
||
cd "$(dirname "$0")" | ||
|
||
function downloadAndUnzip { | ||
curl -L -o tool.zip $2 | ||
unzip -o -d $1/ tool.zip | ||
rm tool.zip | ||
} | ||
|
||
if ! which bin/swiftformat >/dev/null; then | ||
echo "warning: SwiftFormat not installed, installing..." | ||
|
||
mkdir -p -- "bin" | ||
cd bin | ||
rm -r ./* | ||
|
||
downloadAndUnzip "SwiftFormatTmp" "https://github.com/nicklockwood/SwiftFormat/releases/download/0.50.3/swiftformat.artifactbundle.zip" | ||
mv -f ./SwiftFormatTmp/swiftformat.artifactbundle/swiftformat-0.50.3-macos/bin/swiftformat . | ||
find . -name "*Tmp" -type d -prune -exec rm -rf '{}' + | ||
for entry in ./* | ||
do | ||
chmod +x "$entry" | ||
done | ||
cd ../ | ||
fi | ||
|
||
cleanup() { | ||
exit_code=$? | ||
if [[ ${exit_code} -eq 0 ]]; then | ||
exit 0 | ||
else | ||
echo "Need to run scripts/prepareForPush.sh script to prepare the code before a PullRequest." | ||
exit 1 | ||
fi | ||
} | ||
|
||
format() { | ||
bin/swiftformat ../web3swift/src/ --config "swiftformat.yml" --swiftversion $SWIFT_VERSION | ||
cleanup | ||
} | ||
|
||
lint() { | ||
bin/swiftformat --lint ../web3swift/src/ --config "swiftformat.yml" --swiftversion $SWIFT_VERSION | ||
cleanup | ||
} | ||
|
||
while getopts "fl" o; do | ||
case "${o}" in | ||
f) | ||
format; | ||
exit;; | ||
l) | ||
lint; | ||
exit;; | ||
*) | ||
exit;; | ||
esac | ||
done | ||
|
||
format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--acronyms ID,URL,UUID | ||
--allman false | ||
--assetliterals visual-width | ||
--beforemarks | ||
--binarygrouping 4,8 | ||
--categorymark "MARK: %c" | ||
--classthreshold 0 | ||
--closingparen balanced | ||
--closurevoid remove | ||
--commas always | ||
--conflictmarkers reject | ||
--decimalgrouping 3,6 | ||
--elseposition same-line | ||
--emptybraces no-space | ||
--enumnamespaces always | ||
--enumthreshold 0 | ||
--exponentcase lowercase | ||
--exponentgrouping disabled | ||
--extensionacl on-extension | ||
--extensionlength 0 | ||
--extensionmark "MARK: - %t + %c" | ||
--fractiongrouping disabled | ||
--fragment false | ||
--funcattributes prev-line | ||
--generictypes | ||
--groupedextension "MARK: %c" | ||
--guardelse same-line | ||
--header ignore | ||
--hexgrouping 4,8 | ||
--hexliteralcase uppercase | ||
--ifdef indent | ||
--importgrouping length | ||
--indent 4 | ||
--indentcase false | ||
--indentstrings false | ||
--lifecycle | ||
--lineaftermarks false | ||
--linebreaks lf | ||
--markcategories true | ||
--markextensions always | ||
--marktypes always | ||
--maxwidth none | ||
--modifierorder | ||
--nevertrailing | ||
--nospaceoperators | ||
--nowrapoperators | ||
--octalgrouping 4,8 | ||
--operatorfunc spaced | ||
--organizetypes actor,class,enum,struct | ||
--patternlet hoist | ||
--ranges spaced | ||
--redundanttype infer-locals-only | ||
--self remove | ||
--selfrequired | ||
--semicolons inline | ||
--shortoptionals always | ||
--smarttabs enabled | ||
--someAny true | ||
--stripunusedargs always | ||
--structthreshold 0 | ||
--tabwidth unspecified | ||
--trailingclosures | ||
--trimwhitespace always | ||
--typeattributes prev-line | ||
--typeblanklines remove | ||
--typemark "MARK: - %t" | ||
--varattributes same-line | ||
--voidtype void | ||
--wraparguments before-first | ||
--wrapcollections before-first | ||
--wrapconditions preserve | ||
--wrapparameters before-first | ||
--wrapreturntype preserve | ||
--wrapternary default | ||
--wraptypealiases preserve | ||
--xcodeindentation disabled | ||
--yodaswap always | ||
--disable enumNamespaces,extensionAccessControl,fileHeader,genericExtensions,modifierOrder,numberFormatting,opaqueGenericParameters,preferKeyPath,redundantBackticks,redundantExtensionACL,redundantFileprivate,redundantPattern,redundantRawValues,redundantSelf,sortDeclarations,spaceAroundGenerics,strongOutlets,trailingClosures,trailingCommas,unusedArguments,wrap,wrapMultilineStatementBraces,wrapSingleLineComments,yodaConditions | ||
--enable blankLineAfterImports,blankLinesBetweenImports,isEmpty,wrapConditionalBodies |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.