-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from wakmusic/417-swiftlint-and-swiftformat-s…
…etting 🔀 :: (#417) SwiftLint와 SwiftFormat 설정
- Loading branch information
Showing
5 changed files
with
121 additions
and
15 deletions.
There are no files selected for viewing
Empty file.
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,41 @@ | ||
#!/bin/sh | ||
|
||
FORMAT=$(which swiftformat) | ||
|
||
if [[ -e "${FORMAT}" ]]; then | ||
echo "🚀 SwiftFormat 시작..." | ||
echo "🔍 SwiftFormat 적용 경로: $(pwd)/Projects" | ||
else | ||
echo "SwiftFormat이 존재하지 않습니다. 설치해주세요 ! 'brew install swiftformat'" | ||
exit 1 | ||
fi | ||
|
||
RESULT=$($FORMAT ./Projects --config .swiftformat) | ||
|
||
if [ "$RESULT" == '' ]; then | ||
printf "\n 🎉 SwiftFormat 적용을 완료했습니다 !! \n" | ||
else | ||
echo "" | ||
printf "❌ SwiftFormat Failed 아래 내용을 확인해주세요 \n" | ||
while read -r line; do | ||
FILEPATH=$(echo $line | cut -d : -f 1) | ||
L=$(echo $line | cut -d : -f 2) | ||
C=$(echo $line | cut -d : -f 3) | ||
TYPE=$(echo $line | cut -d : -f 4 | cut -c 2-) | ||
MESSAGE=$(echo $line | cut -d : -f 5 | cut -c 2-) | ||
DESCRIPTION=$(echo $line | cut -d : -f 6 | cut -c 2-) | ||
if [ $TYPE == 'warning' ]; then | ||
printf "\n 🚧 $TYPE\n" | ||
printf " $FILEPATH:$L:$C\n" | ||
printf " 📌 $MESSAGE: - $DESCRIPTION\n" | ||
exit 0 | ||
elif [ $TYPE == 'error' ]; then | ||
printf "\n 🚨 $TYPE\n" | ||
fi | ||
printf " ✅ $FILEPATH:$L:$C\n" | ||
printf " 📌 $MESSAGE: - $DESCRIPTION\n" | ||
done <<< "$RESULT" | ||
|
||
printf "\n 🚑 커밋실패!! SwiftFormat 실행이 실패하였습니다 🥺 \n" | ||
exit 1 | ||
fi |
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,64 @@ | ||
|
||
--exclude fastlane,Tuist,Dependencies,Carthage | ||
|
||
# options | ||
--maxwidth 120 | ||
--indent 4 | ||
--trimwhitespace always # trailingSpace | ||
--lineaftermarks false # fileHeader | ||
--wraparguments before-first # wrapArguments | ||
--wrapparameters before-first # wrapArguments | ||
--wrapcollections before-first # wrapArguments | ||
|
||
# rules | ||
--rules anyObjectProtocol | ||
--rules blankLineAfterImports | ||
--rules blankLinesAroundMark | ||
--rules blankLinesAtEndOfScope | ||
--rules blankLinesAtStartOfScope | ||
--rules blankLinesBetweenImports | ||
--rules blankLinesBetweenScopes | ||
--rules braces | ||
--rules consecutiveBlankLines | ||
--rules consecutiveSpaces | ||
--rules docComments | ||
--rules duplicateImports | ||
--rules elseOnSameLine | ||
--rules emptyBraces | ||
--rules enumNamespaces | ||
--rules extensionAccessControl | ||
--rules fileHeader | ||
--rules hoistAwait | ||
--rules hoistPatternLet | ||
--rules hoistTry | ||
--rules initCoderUnavailable | ||
--rules indent | ||
--rules isEmpty | ||
--rules leadingDelimiters | ||
--rules linebreakAtEndOfFile | ||
--rules modifierOrder | ||
--rules numberFormatting | ||
--rules opaqueGenericParameters | ||
--rules redundantExtensionACL | ||
--rules redundantOptionalBinding | ||
--rules redundantParens | ||
--rules redundantVoidReturnType | ||
--rules semicolons | ||
--rules sortImports | ||
--rules spaceAroundBraces | ||
--rules spaceAroundBrackets | ||
--rules spaceAroundComments | ||
--rules spaceAroundGenerics | ||
--rules spaceAroundOperators | ||
--rules spaceInsideBraces | ||
--rules spaceInsideBrackets | ||
--rules spaceInsideComments | ||
--rules spaceInsideGenerics | ||
--rules spaceInsideParens | ||
--rules todos | ||
--rules trailingClosures | ||
--rules trailingSpace | ||
--rules typeSugar | ||
--rules void | ||
--rules wrap | ||
--rules wrapArguments |
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 |
---|---|---|
@@ -1,21 +1,19 @@ | ||
excluded: | ||
- "**/*/NeedleGenerated.swift" | ||
- "Tuist" | ||
- "Plugin" | ||
|
||
force_cast: # From https://realm.github.io/SwiftLint/force_cast.html | ||
warning # 강제 캐스팅은 error에서 warning으로 변경 | ||
|
||
disabled_rules: | ||
- trailing_whitespace | ||
- vertical_whitespace | ||
- colon | ||
- comma | ||
- comment_spacing # 주석 여백 | ||
- mark # //MARK 관련 warning | ||
- opening_brace # 괄호 열 때 줄바꿈을 했는지 안했는지, (안했으면 warning) | ||
- line_length # 한줄에 글자 수 제한 , warning: 120, error: 200 (default) | ||
- statement_position # if는 반드시 else로 끝나야한다. | ||
- identifier_name #변수명 글자 수 제한 | ||
- function_body_length | ||
- function_parameter_count | ||
- nesting | ||
identifier_name: | ||
min_length: | ||
warning: 1 | ||
|
||
nesting: | ||
type_label: | ||
warning: 3 | ||
|
||
type_name: | ||
max_length: | ||
warning: 60 |
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