File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,17 +153,9 @@ custom_rules:
153153 - comment
154154 - doccomment
155155 - doccomment.field
156- comments_capitalized_ignore_possible_code :
157- name : " Capitalize First Word In Comment"
158- regex : ' (// +(?!swiftlint)[a-z]+)'
159- message : " The first word of a comment should be capitalized"
160- severity : warning
161- match_kinds :
162- - comment
163- - doccomment
164156 empty_first_line :
165157 name : " Empty First Line"
166- regex : ' (extension|class) (?!(?:func|let|var))[^\{]*\{[^\n]*\n[\t ]*\w+'
158+ regex : ' (extension|class|struct ) (?!(?:func|let|var))[^\{]*\{[^\n]*\n[\t ]*\w+'
167159 message : " There should be an empty line after a class or extension declaration."
168160 severity : warning
169161 match_kinds :
@@ -212,11 +204,6 @@ custom_rules:
212204 regex : ' (^ *if \(((?!( is | > | < | (=|!|<|>)= )).)*\) \{)'
213205 message : " if should contain == true or == false"
214206 severity : warning
215- single_line_body :
216- name : " Single Line Body"
217- regex : ' (?i-sm)((if|while|do|for)*? \{(?!\n|.?(s|g)et).+?\}\n)'
218- message : " Single line bodies are not allowed"
219- severity : warning
220207 missing_closure_datatype :
221208 name : " Missing Closure Data Type"
222209 regex : ' (\{[\s]{1}(\[weak [\w]+?\][\s]{1})*?\([^:]+?\)[\s]{1}in)'
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env xcrun --sdk macosx swift
2+
3+ import Foundation
4+
5+ let env = ProcessInfo . processInfo. environment
6+
7+ guard
8+ let path = env [ " PROJECT_DIR " ] ,
9+ var url = URL ( string: " file:// " + path) ,
10+ let xcodeVersion = env [ " XCODE_VERSION_ACTUAL " ] else {
11+ exit ( 0 )
12+ }
13+
14+ url. appendPathComponent ( " Config.json " )
15+
16+ guard
17+ let data = try ? Data ( contentsOf: url) ,
18+ let json = try ? JSONSerialization . jsonObject ( with: data, options: [ ] ) as? [ String : Any ] ,
19+ let project = json [ " project " ] as? [ String : Any ] ,
20+ let projectXcodeVersion = project [ " xcode_version " ] as? String else {
21+ fatalError ( " 'xcode_version' not found, please check your Config.json " )
22+ }
23+
24+ let xcodeVersionCleaned = xcodeVersion. trimmingCharacters ( in: . init( charactersIn: " 0 " ) )
25+ let projectXcodeVersionCleaned = projectXcodeVersion. replacingOccurrences ( of: " . " , with: " " )
26+
27+ if ( xcodeVersionCleaned != projectXcodeVersionCleaned) {
28+ fatalError ( " Xcode Version mismatch: please open Project with Xcode \( projectXcodeVersion) or change Xcode Version in Config.json " )
29+ }
30+
31+ exit ( 0 )
Original file line number Diff line number Diff line change @@ -151,5 +151,5 @@ if [ $copyPRTemplate = true ]; then
151151fi
152152
153153if [ $checkXcodeVersion = true ]; then
154- ./Xcode/check-xcode-version.sh " $projectDir " || exit 1 ;
154+ ./Xcode/check-xcode-version.swift ;
155155fi
You can’t perform that action at this time.
0 commit comments