Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2b6e0ee

Browse files
authored
Do not triggerreturn_value_from_void_function in initializers (realm#5429)
1 parentfc2a18e commit2b6e0ee

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

‎CHANGELOG.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@
134134
[SimplyDanny](https://github.com/SimplyDanny)
135135
[#3852](https://github.com/realm/SwiftLint/pull/3852)
136136

137+
* Don't trigger the`return_value_from_void_function` warning from initializers.
138+
[mrbkap](https://github.com/mrbkap)
139+
137140
##0.54.0: Macro-Economic Forces
138141

139142
####Breaking

‎Source/SwiftLintBuiltInRules/Rules/Idiomatic/ReturnValueFromVoidFunctionRule.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private extension Syntax {
5757
return node
5858
}
5959

60-
ifself.is(ClosureExprSyntax.self) ||self.is(VariableDeclSyntax.self){
60+
ifself.is(ClosureExprSyntax.self) ||self.is(VariableDeclSyntax.self)||self.is(InitializerDeclSyntax.self){
6161
returnnil
6262
}
6363

‎Source/SwiftLintBuiltInRules/Rules/Idiomatic/ReturnValueFromVoidFunctionRuleExamples.swift‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,17 @@ internal struct ReturnValueFromVoidFunctionRuleExamples {
4545
}
4646
"""),
4747
Example("""
48+
func baz() {
49+
enum Foo {
50+
case bar
51+
52+
init?(arg: String?) {
53+
return nil
54+
}
55+
}
56+
}
57+
""", excludeFromDocumentation:true),
58+
Example("""
4859
func test() {
4960
guard condition else {
5061
return

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp