Skip to content

Commit

Permalink
Verify and document fixed opening_brace correction (#5620)
Browse files Browse the repository at this point in the history
Co-authored-by: Danny Mösch <danny.moesch@icloud.com>
  • Loading branch information
swiftty and SimplyDanny authored Jul 20, 2024
1 parent 9f8a3f5 commit cb0f5ab
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@
[Martin Redington](https://github.com/mildm8nnered)
[#5660](https://github.com/realm/SwiftLint/issues/5660)

* Fix `opening_brace` correction and make sure that disable commands
are taken into account before applying a fix.
[swiftty](https://github.com/swiftty)
[SimplyDanny](https://github.com/SimplyDanny)
[#5598](https://github.com/realm/SwiftLint/issues/5598)

## 0.55.1: Universal Washing Powder

#### Breaking
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,5 +546,25 @@ struct OpeningBraceRuleExamples {
return
}
"""),
// https://github.com/realm/SwiftLint/issues/5598
Example("""
func foo() {
if q1, q2
{
do1()
} else if q3, q4
{
do2()
}
}
"""): Example("""
func foo() {
if q1, q2 {
do1()
} else if q3, q4 {
do2()
}
}
"""),
]
}
10 changes: 7 additions & 3 deletions Tests/SwiftLintTestHelpers/TestHelpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,13 @@ private extension Configuration {
let linter = collector.collect(into: storage)
let corrections = linter.correct(using: storage).sorted { $0.location < $1.location }
if expectedLocations.isEmpty {
XCTAssertEqual(
corrections.count, before.code != expected.code ? 1 : 0, #function + ".expectedLocationsEmpty",
file: before.file, line: before.line)
XCTAssertGreaterThanOrEqual(
corrections.count,
before.code != expected.code ? 1 : 0,
#function + ".expectedLocationsEmpty",
file: before.file,
line: before.line
)
} else {
XCTAssertEqual(
corrections.count,
Expand Down

0 comments on commit cb0f5ab

Please sign in to comment.