Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teststate enhancement #5920

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

#### Breaking

* Teststate enhancement.
[@aydinomer00](https://github.com/aydinomer00)
[#5803](https://github.com/realm/SwiftLint/issues/5803)


* The command plugin now requires write permissions so that it works with the `--fix` option without an error.
[SimplyDanny](https://github.com/SimplyDanny)

Expand Down Expand Up @@ -7958,3 +7963,6 @@ This release has seen a phenomenal uptake in community contributions!
## 0.1.0: Fresh Out Of The Dryer

First Version!



Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct QuickDiscouragedCallRule: OptInRule {
guard
kind == .call,
let name = dictionary.name,
name != "@TestState", // Exception: Do not trigger a warning for @TestState
let kindName = QuickCallKind(rawValue: name),
QuickCallKind.restrictiveKinds.contains(kindName)
else { return [] }
Expand All @@ -58,7 +59,7 @@ struct QuickDiscouragedCallRule: OptInRule {
reason: "Discouraged call inside a '\(name)' block")
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

private func violationOffsets(in substructure: [SourceKittenDictionary]) -> [ByteCount] {
substructure.flatMap { dictionary -> [ByteCount] in
let substructure = dictionary.substructure.flatMap { dict -> [SourceKittenDictionary] in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ internal struct QuickDiscouragedCallRuleExamples {
}
}
"""),
Example("""
class TotoTests: QuickSpec {
override func spec() {
@TestState var foo = Foo()
}
}
"""),
]

static let triggeringExamples: [Example] = [
Expand Down Expand Up @@ -324,5 +331,14 @@ internal struct QuickDiscouragedCallRuleExamples {
}
}
"""),
Example("""
class TotoTests: QuickSpec {
override func spec() {
describe("foo") {
@TestState var foo = Foo()
}
}
}
"""),
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ final class PrivateOverFilePrivateRuleTests: SwiftLintTestCase {
verifyRule(description, ruleConfiguration: ["validate_extensions": false])
}
}

Loading