Fix `lower_acl_than_parent` rule rewriter by preserving leading whitespace (#4861)
This commit is contained in:
parent
ee849bcb10
commit
bd444fcd77
|
@ -25,7 +25,9 @@
|
|||
|
||||
#### Bug Fixes
|
||||
|
||||
* None.
|
||||
* Fix `lower_acl_than_parent` rule rewriter by preserving leading whitespace.
|
||||
[SimplyDanny](https://github.com/SimplyDanny)
|
||||
[#4860](https://github.com/realm/SwiftLint/issues/4860)
|
||||
|
||||
## 0.51.0: bzllint
|
||||
|
||||
|
|
|
@ -68,7 +68,17 @@ struct LowerACLThanParentRule: OptInRule, ConfigurationProviderRule, SwiftSyntax
|
|||
Example("class Foo { ↓public func bar() {} }"):
|
||||
Example("class Foo { func bar() {} }"),
|
||||
Example("actor Foo { ↓public func bar() {} }"):
|
||||
Example("actor Foo { func bar() {} }")
|
||||
Example("actor Foo { func bar() {} }"),
|
||||
Example("""
|
||||
struct Foo {
|
||||
↓public func bar() {}
|
||||
}
|
||||
"""):
|
||||
Example("""
|
||||
struct Foo {
|
||||
func bar() {}
|
||||
}
|
||||
""")
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -120,7 +130,10 @@ private extension LowerACLThanParentRule {
|
|||
trailingTrivia: .space
|
||||
)
|
||||
} else {
|
||||
newNode = DeclModifierSyntax(name: .keyword(.internal, presence: .missing))
|
||||
newNode = DeclModifierSyntax(
|
||||
leadingTrivia: node.leadingTrivia ?? .zero,
|
||||
name: .identifier("")
|
||||
)
|
||||
}
|
||||
|
||||
return super.visit(newNode)
|
||||
|
|
Loading…
Reference in New Issue