Skip to content

Commit 6f3c649

Browse files
committed
feat(Scripts): Update swift-format
1 parent f4cd125 commit 6f3c649

File tree

4 files changed

+68
-22
lines changed

4 files changed

+68
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
/*.xcodeproj
55
xcuserdata/
66
Scripts/.installed
7+
Scripts/.bin

.swift-format

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,56 @@
11
{
2-
"version": 1,
3-
"lineLength": 120,
4-
"indentation": {
5-
"spaces": 2
6-
},
7-
"maximumBlankLines": 1,
8-
"respectsExistingLineBreaks": true,
9-
"respectsCompactFunctions": true,
10-
"lineBreakBeforeControlFlowKeywords": true,
11-
"lineBreakBeforeEachArgument": true
12-
}
2+
"fileScopedDeclarationPrivacy" : {
3+
"accessLevel" : "private"
4+
},
5+
"indentation" : {
6+
"spaces" : 2
7+
},
8+
"indentConditionalCompilationBlocks" : true,
9+
"indentSwitchCaseLabels" : false,
10+
"lineBreakAroundMultilineExpressionChainComponents" : false,
11+
"lineBreakBeforeControlFlowKeywords" : false,
12+
"lineBreakBeforeEachArgument" : false,
13+
"lineBreakBeforeEachGenericRequirement" : false,
14+
"lineLength" : 100,
15+
"maximumBlankLines" : 1,
16+
"prioritizeKeepingFunctionOutputTogether" : false,
17+
"respectsExistingLineBreaks" : true,
18+
"rules" : {
19+
"AllPublicDeclarationsHaveDocumentation" : false,
20+
"AlwaysUseLowerCamelCase" : true,
21+
"AmbiguousTrailingClosureOverload" : true,
22+
"BeginDocumentationCommentWithOneLineSummary" : false,
23+
"DoNotUseSemicolons" : true,
24+
"DontRepeatTypeInStaticProperties" : true,
25+
"FileScopedDeclarationPrivacy" : true,
26+
"FullyIndirectEnum" : true,
27+
"GroupNumericLiterals" : true,
28+
"IdentifiersMustBeASCII" : true,
29+
"NeverForceUnwrap" : false,
30+
"NeverUseForceTry" : false,
31+
"NeverUseImplicitlyUnwrappedOptionals" : false,
32+
"NoAccessLevelOnExtensionDeclaration" : true,
33+
"NoBlockComments" : true,
34+
"NoCasesWithOnlyFallthrough" : true,
35+
"NoEmptyTrailingClosureParentheses" : true,
36+
"NoLabelsInCasePatterns" : true,
37+
"NoLeadingUnderscores" : false,
38+
"NoParensAroundConditions" : true,
39+
"NoVoidReturnOnFunctionSignature" : true,
40+
"OneCasePerLine" : true,
41+
"OneVariableDeclarationPerLine" : true,
42+
"OnlyOneTrailingClosureArgument" : true,
43+
"OrderedImports" : true,
44+
"ReturnVoidInsteadOfEmptyTuple" : true,
45+
"UseEarlyExits" : false,
46+
"UseLetInEveryBoundCaseVariable" : true,
47+
"UseShorthandTypeNames" : true,
48+
"UseSingleLinePropertyGetter" : true,
49+
"UseSynthesizedInitializer" : true,
50+
"UseTripleSlashForDocumentationComments" : true,
51+
"UseWhereClausesInForLoops" : false,
52+
"ValidateDocumentationComments" : false
53+
},
54+
"tabWidth" : 2,
55+
"version" : 1
56+
}

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
install_format:
1+
install_formatter:
22
./scripts/install_swift-format
33

44
format:
5-
./scripts/.installed/swift-format --in-place --recursive \
5+
./Scripts/.bin/swift-format \
6+
--in-place --recursive \
67
./Package.swift ./Sources ./Tests
78

89
test:
9-
swift test --enable-test-discovery
10+
swift test --enable-test-discovery

Scripts/install_swift-format

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@ _get_parent_dir_abs_path() {
44
echo "$(cd "$(dirname "$1")" && pwd)"
55
}
66

7-
# ––––––––––––––––––––––––––– config –––––––––––––––––––––––––––
7+
# ––––––––––––––––––––––––––– Config –––––––––––––––––––––––––––
88

99
TOOL_NAME="swift-format"
1010
TOOL_OWNER="apple"
11-
TOOL_CHECKOUT="tags/0.50400.0"
11+
TOOL_VERSION="0.50600.1"
1212

13-
# ––––––––––––––––––––––––– constants ––––––––––––––––––––––––––
13+
# ––––––––––––––––––––––––– Constants ––––––––––––––––––––––––––
1414

1515
SCRIPT_DIR=$(_get_parent_dir_abs_path $0)
16-
TOOLS_INSTALL_PATH="${SCRIPT_DIR}/.installed"
16+
TOOLS_INSTALL_PATH="${SCRIPT_DIR}/.bin"
1717
TOOL_INSTALL_PATH="${TOOLS_INSTALL_PATH}/${TOOL_NAME}"
1818
TEMP_INSTALL_PATH="${TOOLS_INSTALL_PATH}/install-${TOOL_NAME}"
1919

20-
# ––––––––––––––––––––––––––– steps ––––––––––––––––––––––––––––
20+
# ––––––––––––––––––––––––––– Steps ––––––––––––––––––––––––––––
2121

2222
tool_fetch() {
2323
git clone "https://github.com/${TOOL_OWNER}/${TOOL_NAME}.git"
2424
cd "${TOOL_NAME}"
25-
git checkout ${TOOL_CHECKOUT}
25+
git checkout "tags/${TOOL_CHECKOUT}"
2626
}
2727

2828
tool_build() {
29-
swift build --product="${TOOL_NAME}" -c release --disable-sandbox
29+
swift build --product="${TOOL_NAME}" -c release --disable-sandbox --build-path '.build'
3030
}
3131

3232
tool_install() {
3333
install "${TEMP_INSTALL_PATH}/${TOOL_NAME}/.build/release/${TOOL_NAME}" "${TOOLS_INSTALL_PATH}"
3434
}
3535

36-
# ––––––––––––––––––––––––––– script –––––––––––––––––––––––––––
36+
# ––––––––––––––––––––––––––– Script –––––––––––––––––––––––––––
3737

3838
set_bold=$(tput bold)
3939
set_normal=$(tput sgr0)

0 commit comments

Comments
 (0)