New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue where linter would disallow "@unchecked Sendable" string in comments #241
Conversation
@@ -55,5 +55,8 @@ custom_rules: | |||
no_unchecked_sendable: | |||
name: "`@unchecked Sendable` is discouraged." | |||
regex: "@unchecked Sendable" | |||
match_kinds: | |||
- attribute.builtin | |||
- typeidentifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Determined this by using the command recommended in the SwiftLint documentation:
$ sourcekitten syntax --text "extension Foo: @unchecked Sendable { }"
[
{
"length" : 9,
"offset" : 0,
"type" : "source.lang.swift.syntaxtype.keyword"
},
{
"length" : 3,
"offset" : 10,
"type" : "source.lang.swift.syntaxtype.typeidentifier"
},
{
"length" : 10,
"offset" : 15,
"type" : "source.lang.swift.syntaxtype.attribute.builtin"
},
{
"length" : 8,
"offset" : 26,
"type" : "source.lang.swift.syntaxtype.typeidentifier"
}
]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @calda ! LGTM.
@@ -55,5 +55,8 @@ custom_rules: | |||
no_unchecked_sendable: | |||
name: "`@unchecked Sendable` is discouraged." | |||
regex: "@unchecked Sendable" | |||
match_kinds: | |||
- attribute.builtin | |||
- typeidentifier |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR fixes an issue where the linter would not allow you to use the string
@unchecked Sendable
in a comment.This was previously disallowed by the linter, because the regex matched the
"@unchecked Sendable"
text in the comment:but is now allowed as expected