-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 parsing of rule disable command comments containing a URL #2985
Fix parsing of rule disable command comments containing a URL #2985
Conversation
9ccb9de
to
0e600df
Compare
Generated by 🚫 Danger |
return match(pattern: pattern, with: [.comment], range: range).compactMap { range in | ||
return Command(string: contents, range: range) | ||
return match(pattern: pattern, range: range).filter { match in | ||
return Set(match.1).isSubset(of: [.comment, .commentURL]) |
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.
maybe we should use SyntaxKind.commentKinds
just to be safe?
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.
SyntaxKind.commentKinds
contains
.comment
,.commentUrl
,.docComment
,.docCommentField
, and.commentMark
.
Changing this as proposed would allow adding SwiftLint commands to doc comments as well as MARK:
comments, which is currently not supported. I'm not sure whether such a change should be part of this PR.
@@ -14,7 +14,8 @@ | |||
|
|||
#### Bug Fixes | |||
|
|||
* None. | |||
* Fix parsing of SwiftLint commands containing a URL in their trailing comment. |
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.
can you please rebase and fix this conflict? 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.
I merged rebased on master
and resolved this conflict.
7069f8a
to
e0205d8
Compare
Lovely, thank you for the fix! |
PR #2721 introduced support for trailing comments in
swiftlint:disable
commands. However, if such a trailing comment contains a URL, the command is currently not parsed correctly and as a result is not recognized at all.This PR fixes parsing
swiftlint:disable
commands having a URL in their trailing comment, e.g.: