You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
False positive implicit_getter violation when mentioning word "set" in a comment in custom getter of a read-write var #3149
Mentioning word "set" (without parentheses) in a comment in a get of a read-write var with both get and set defined triggers SwiftLint to think that this is a read-only property.
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint --path Test.swift --no-cache --enable-all-rules
Loading configuration from '.swiftlint.yml'
Linting Swift files at paths Test.swift
Linting 'Test.swift' (1/1)
/Users/yas/code/caremobile/Test.swift:3:9: warning: Implicit Getter Violation: Computed read-only properties should avoid using the get keyword. (implicit_getter)
Done linting! Found 1 violation, 0 serious in 1 file.
Oh, thanks. I somehow missed that PR during my search for existing reports.
Based on the description I guess it is indeed supposed to fix this issue... But I'm running current SwiftLint version (0.39.1), which includes that fix, and I'm still getting the issue. So perhaps there is something else needs to be done. Maybe something around swift version check? Not sure...
I found another false-positive. When the set is before the get you get warning. If it is the other way round then everything is all right. I believe another rule could be created to formalize the order of get-set.
Linting Swift files at paths
Linting 'lint.swift' (1/1)
/Users/kaspar/Downloads/swiftlint-issue/lint.swift:6:9: warning: Implicit Getter Violation: Computed read-only properties should avoid using the get keyword. (implicit_getter)
Done linting! Found 1 violation, 0 serious in 1 file.
Reacted by Lennart Stolz, Nick Thompson and Efthymios Liapatis
The fix will go in the next release, either 0.39.2 or 0.40.0, depending on how we choose to version it. That’ll be in the next few days probably. Depends on if we think we can get more Swift 5.2 fixes in time.
Activity
freak4pc commentedon Mar 26, 2020
Pretty sure this fixes it?
#3099
yas375 commentedon Mar 26, 2020
Oh, thanks. I somehow missed that PR during my search for existing reports.
Based on the description I guess it is indeed supposed to fix this issue... But I'm running current SwiftLint version (0.39.1), which includes that fix, and I'm still getting the issue. So perhaps there is something else needs to be done. Maybe something around swift version check? Not sure...
freak4pc commentedon Mar 26, 2020
It doesn’t include that fix IMO
freak4pc commentedon Mar 26, 2020
0.39.1 is almost two months old,
I imagine they’ll accumulate some content and release 0.40 soon
yas375 commentedon Mar 26, 2020
From what I see, 0.39.1 already includes that code (4e84992):
https://github.com/realm/SwiftLint/blob/0.39.1/Source/SwiftLintFramework/Rules/Style/ImplicitGetterRule.swift#L29-L51
p4checo commentedon Mar 26, 2020
It's also triggering a false positive if we have both a
getand anonmutating set:mkj-is commentedon Mar 26, 2020
I found another false-positive. When the
setis before thegetyou get warning. If it is the other way round then everything is all right. I believe another rule could be created to formalize the order of get-set.Command:
Output:
Fix false positives on implicit_getter with Swift 5.2+
Fix false positives on implicit_getter with Swift 5.2+ (#3151)
yas375 commentedon Mar 27, 2020
@marcelofabri thanks a lot!
marcelofabri commentedon Mar 27, 2020
thanks for everyone reporting different minimal examples! this has been very helpful to fix the issue quickly
Fix false positives on implicit_getter with Swift 5.2+ (realm#3151)
freak4pc commentedon Mar 27, 2020
Not sure if this fits in the same fix:
tahirmt commentedon Mar 28, 2020
Which release is this going to and when?
jpsim commentedon Mar 28, 2020
The fix will go in the next release, either 0.39.2 or 0.40.0, depending on how we choose to version it. That’ll be in the next few days probably. Depends on if we think we can get more Swift 5.2 fixes in time.
jpsim commentedon Mar 28, 2020
@freak4pc can you see if the latest commit from master fixes that for you?
nicolas-miari commentedon Mar 29, 2020
Looking forward to the fixing release. My code below still triggers this false positive on 0.39.1:
Update: it resolves if I move the getter above the setter:
ahmedsafadii commentedon Mar 29, 2020
no fix ?
freak4pc commentedon Mar 30, 2020
@jpsim my issues are fixed on the last
masterkb100824 commentedon Jun 24, 2020
u need find file : .swiftlint.yml , then just do it