-
Notifications
You must be signed in to change notification settings - Fork 1
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 #13 from boostcampwm-2024/feature/set-swiftlint
모든 모듈에 SwiftLint 적용
- Loading branch information
Showing
11 changed files
with
399 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# 사용하지 않는 룰 | ||
disabled_rules: | ||
# 라인의 마지막에는 빈 여백이 있으면 안 됨 => 라인 마지막에 여백 있어도 됨 | ||
- trailing_whitespace | ||
|
||
# 타입은 최대 1단계로 중첩되어야 함 => 타입여러개 중첩돼도 됨 | ||
- nesting | ||
|
||
# 함수 안은 복잡하면 안 됨 (warning: 10, error: 20) | ||
- cyclomatic_complexity | ||
|
||
# Protocol은 class-only여야 함. | ||
- class_delegate_protocol | ||
|
||
# 함수 매개변수들이 여러 개일 경우 세로로 같은 줄에 있어야 함 | ||
- vertical_parameter_alignment | ||
|
||
# Void 함수를 호출하기 위해 삼항연산자을 사용하는 것은 피해야 한다. | ||
- void_function_in_ternary | ||
|
||
# 스위치 문의 케이스는 스위치와 같은 줄에 있어야 함 | ||
- switch_case_alignment | ||
|
||
# fileprivate보다 private을 선호함. => fileprivate에 워닝 띄우지 않을꺼다 | ||
- private_over_fileprivate | ||
|
||
analyzer_rules: # => 적용on | ||
# 모든 선언은 한 번 이상 사용되어야 함 | ||
- unused_declaration | ||
|
||
# 명시적 룰 활성화 | ||
opt_in_rules: | ||
# type name은 영숫자만 포함, 대문자로 시작해 3-40자 사이어야 함 | ||
- type_name | ||
|
||
# delegate protocol은 class-only로 참조해 weak로 참조되도록 권장 | ||
- class_delegate_protocol | ||
|
||
# 닫는 괄호 ')'와 '}' 사이에는 공백이 없어야 함 | ||
- closing_brace | ||
|
||
# 클로저 내용과 괄호 사이에 공백이 있어야 함 | ||
- closure_spacing | ||
|
||
# collection elem은 vertically aligned 되어야 함 | ||
- collection_alignment | ||
|
||
# colon 사용 시 앞 공백 필수, 뒷 공백이 있으면 안 됨 | ||
- colon | ||
|
||
# comma 사용 시 앞 공백 필수, 뒷 공백이 있으면 안 됨 | ||
- comma | ||
|
||
# first(where:) != nil, firstIndex(where:) != nil 대신 contains 사용을 권장 (https://realm.github.io/SwiftLint/contains_over_first_not_nil.html) | ||
- contains_over_first_not_nil | ||
|
||
# filter.count 사용 시 isEmpty 대신 contains 사용 권장 (https://realm.github.io/SwiftLint/contains_over_filter_is_empty.html) | ||
- contains_over_filter_is_empty | ||
|
||
# filter.count가 0인지 비교할 때 contains 사용 권장 (https://realm.github.io/SwiftLint/contains_over_filter_count.html) | ||
- contains_over_filter_count | ||
|
||
# range(of:) == nil 체크 대신 contains 사용 권장 (https://realm.github.io/SwiftLint/contains_over_range_nil_comparison.html) | ||
- contains_over_range_nil_comparison | ||
|
||
# if, for, guard, switch, while, catch 사용 시 () 사용 권장하지 않음 | ||
- control_statement | ||
|
||
# deployment target 보다 낮은 버전의 @available 사용 시 warning | ||
- deployment_target | ||
|
||
# 중복 import 방지 | ||
- duplicate_imports | ||
|
||
# count가 0인지 체크할 때는 isEmpty 사용 권장 | ||
- empty_count | ||
|
||
# collection, array count 체크 시 isEmpty 사용 권장 | ||
- empty_collection_literal | ||
|
||
# string empty 체크 시 isEmpty 사용 권장 | ||
- empty_string | ||
|
||
# 강제 언래핑 사용 금지 | ||
- force_try | ||
|
||
# array, dict 사용 시 동일한 indent로 표현 | ||
- literal_expression_end_indentation | ||
|
||
# let, var 선언 시 다른 statments와 한 줄 공백이 필요함 | ||
# - let_var_whitespace # private, let, var 별로 뗄 수도 있으니까 | ||
|
||
# 수직 공백 2줄 이상 사용 지양 | ||
- vertical_whitespace | ||
|
||
# 여는 괄호 앞에서 한 줄 이상의 공백 사용 지양 | ||
- vertical_whitespace_opening_braces | ||
|
||
# 닫는 괄호 앞에서 한 줄 이상의 공백 사용 지양 | ||
- vertical_whitespace_closing_braces | ||
|
||
# delegate는 약한 참조 사용 권장 | ||
- weak_delegate | ||
|
||
force_try: | ||
severity: warning # 명시적으로 지정 | ||
|
||
line_length: | ||
warning: 120 | ||
ignores_urls: true | ||
ignores_comments: true | ||
|
||
# path | ||
included: | ||
excluded: | ||
- "*.xcodeproj" | ||
- "*.xcworkspace" | ||
- ".git" | ||
- ".gitignore" | ||
- ".github" | ||
- "README.md" | ||
reporter: "xcode" |
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
14 changes: 12 additions & 2 deletions
14
MemorialHouse/MHApplication/MHApplication/Source/ViewController.swift
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,10 +1,20 @@ | ||
import UIKit | ||
|
||
class ViewController: UIViewController { | ||
|
||
enum HI { | ||
enum Good { | ||
|
||
} | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
|
||
view.backgroundColor = .red | ||
let numb = [1, 2, 3, | ||
4, 5, 6] | ||
@available(iOS 11.0, *) | ||
func hihi() { } | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -6,3 +6,4 @@ | |
// | ||
|
||
import Foundation | ||
|
Oops, something went wrong.