Skip to content
Open
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 @@ -78,6 +78,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
24 changes: 24 additions & 0 deletions Tests/FrameworkTests/ModifierOrderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@
}
}

func testIsolationModifierOrder() {

Check failure on line 394 in Tests/FrameworkTests/ModifierOrderTests.swift

View workflow job for this annotation

GitHub Actions / Swift

Function body should span 60 lines or less excluding comments and whitespace: currently spans 75 lines (function_body_length)
let descriptionOverride = ModifierOrderRule.description
.with(nonTriggeringExamples: [
Example("""
Expand All @@ -408,6 +408,12 @@
}
"""),
Example("""
@MainActor
class Foo {
isolated public func bar() {}
}
"""),
Example("""
class RegularClass {
@MainActor public func bar() {}
}
Expand All @@ -426,6 +432,12 @@
private nonisolated func heavyWork() {}
}
"""),
Example("""
@MainActor
class Foo {
public isolated func bar() {}
}
"""),
])
.with(corrections: [
Example("""
Expand All @@ -440,6 +452,18 @@
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