Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@

### Bug Fixes

* Recognize `isolated` as an isolation modifier in `modifier_order`, so it can
be ordered via the `isolation` entry in `preferred_modifier_order`.
[leno23](https://github.com/leno23)
[#6164](https://github.com/realm/SwiftLint/issues/6164)

* Detect and autocorrect missing whitespace before `else` in `guard`
statements for the `statement_position` rule.
[theamodhshetty](https://github.com/theamodhshetty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private extension SwiftDeclarationAttributeKind.ModifierGroup {
self = .lazy
case "dynamic":
self = .dynamic
case "nonisolated":
case "isolated", "nonisolated":
self = .isolation
case "private", "fileprivate", "internal", "public", "open":
self = .acl
Expand Down
25 changes: 25 additions & 0 deletions Tests/FrameworkTests/ModifierOrderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ final class ModifierOrderTests: SwiftLintTestCase {
}
}

// swiftlint:disable:next function_body_length
func testIsolationModifierOrder() {
let descriptionOverride = ModifierOrderRule.description
.with(nonTriggeringExamples: [
Expand All @@ -408,6 +409,12 @@ final class ModifierOrderTests: SwiftLintTestCase {
}
"""),
Example("""
@MainActor
class Foo {
isolated public func bar() {}
}
"""),
Example("""
class RegularClass {
@MainActor public func bar() {}
}
Expand All @@ -426,6 +433,12 @@ final class ModifierOrderTests: SwiftLintTestCase {
private nonisolated func heavyWork() {}
}
"""),
Example("""
@MainActor
class Foo {
public isolated func bar() {}
}
"""),
])
.with(corrections: [
Example("""
Expand All @@ -440,6 +453,18 @@ final class ModifierOrderTests: SwiftLintTestCase {
nonisolated public func bar() {}
}
"""),
Example("""
@MainActor
class Foo {
public isolated func bar() {}
}
"""):
Example("""
@MainActor
class Foo {
isolated public func bar() {}
}
"""),
])

verifyRule(descriptionOverride,
Expand Down
Loading