Skip to content

Commit

Permalink
Keep initializers with attributed parameters in `unneeded_synthesized…
Browse files Browse the repository at this point in the history
…_initializer` rule (#5594)
  • Loading branch information
SimplyDanny authored May 17, 2024
1 parent ebf7c70 commit b42f6ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
[SimplyDanny](https://github.com/SimplyDanny)
[#5592](https://github.com/realm/SwiftLint/issues/5592)

* Keep initializers with attributed parameters in
`unneeded_synthesized_initializer` rule.
[SimplyDanny](https://github.com/SimplyDanny)
[#5153](https://github.com/realm/SwiftLint/issues/5153)

## 0.55.1: Universal Washing Powder

#### Breaking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private extension StructDeclSyntax {
}

for (idx, parameter) in initializerParameters.enumerated() {
guard parameter.secondName == nil else {
guard parameter.secondName == nil, parameter.attributes.isEmpty else {
return false
}
let property = storedProperties[idx]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ enum UnneededSynthesizedInitializerRuleExamples {
}
}
"""),
Example("""
struct Foo {
var bar: Int
init(@Clamped bar: Int) {
self.bar = bar
}
}
"""),
Example("""
struct Foo {
let bar: Int
Expand Down

0 comments on commit b42f6ff

Please sign in to comment.