Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import SwiftSyntax
eimport SwiftSyntax
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unintentional?


@SwiftSyntaxRule(explicitRewriter: true)
struct ImplicitOptionalInitializationRule: Rule {
Expand Down Expand Up @@ -28,12 +28,19 @@ private extension ImplicitOptionalInitializationRule {
override func visitPost(_ node: PatternBindingSyntax) {
guard let violationPosition = node.violationPosition(for: configuration.style) else { return }

violations.append(ReasonedRuleViolation(position: violationPosition, reason: reason))
// // violations.append(ReasonedRuleViolation(position: violationPosition, reason: reason))
override func visitPost(_ node: PatternBindingSyntax) {
if let variableDecl = node.parent?.as(VariableDeclSyntax.self),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks a bit off.

let attrs = variableDecl.attributes,
attrs.contains(where: { attr in
guard let attribute = attr.as(AttributeSyntax.self) else { return false }
return attribute.attributeName.as(SimpleTypeIdentifierSyntax.self)?.name.text == "Parameter" }) {
return
}
guard let violationPosition = node.violationPosition(for: configuration.style) else { return }
violations.append(ReasonedRuleViolation(position: violationPosition, reason: reason))
}
}

private extension ImplicitOptionalInitializationRule {
{
final class Rewriter: ViolationsSyntaxRewriter<ConfigurationType> {
override func visit(_ node: PatternBindingSyntax) -> PatternBindingSyntax {
guard node.violationPosition(for: configuration.style) != nil else {
Expand Down