-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
base: main
Are you sure you want to change the base?
Teststate enhancement #5920
Conversation
Generated by 🚫 Danger |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution!
There are a few issues with your implementations you need to address before this can land.
CHANGELOG.md
Outdated
|
||
* Teststate enhancement. | ||
[@aydinomer00](https://github.com/aydinomer00) | ||
[#5920](https://github.com/realm/SwiftLint/issues/5920) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a link to the issue describing the enhancement, not the PR implementing it:
[#5920](https://github.com/realm/SwiftLint/issues/5920) | |
[#5803](https://github.com/realm/SwiftLint/issues/5803) |
CHANGELOG.md
Outdated
@@ -7958,3 +7958,9 @@ This release has seen a phenomenal uptake in community contributions! | |||
## 0.1.0: Fresh Out Of The Dryer | |||
|
|||
First Version! | |||
|
|||
* Teststate enhancement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This entry needs to go right to the top of this file.
@@ -58,7 +59,7 @@ struct QuickDiscouragedCallRule: OptInRule { | |||
reason: "Discouraged call inside a '\(name)' block") | |||
} | |||
} | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove.
@@ -47,6 +47,7 @@ struct QuickDiscouragedCallRule: OptInRule { | |||
guard | |||
kind == .call, | |||
let name = dictionary.name, | |||
name != "@TestState", // İstisna: @TestState için uyarı tetiklenmesin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use English for comments.
I don't think this fix is correct. name
will never be @TestState
. These are the names of Quick methods, not variables or attributes.
|
||
// Example of incorrect usage (should trigger a warning) | ||
let triggeringExamples = [ | ||
"describe(\"foo\") { @TestState var foo = Foo() }" // This should trigger a warning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the correct expectation. With the @TestState
we don't expect a warning. This is what #5803 is all about.
import XCTest | ||
@testable import SwiftLintFramework | ||
|
||
class QuickDiscouragedCallRuleTests: XCTestCase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new test class is not required. Please use QuickDiscouragedCallRuleExamples
instead to add your test cases.
Description
This PR adds an exception for
@TestState
usage in theQuickDiscouragedCallRule
. The rule now excludes@TestState
declarations insidedescribe
andcontext
blocks.Changes Made
QuickDiscouragedCallRule
to add an exception for@TestState
.QuickDiscouragedCallRuleTests
.CHANGELOG.md
to include details about this enhancement.Current Issues
While the implementation and tests were added successfully, the CI/CD pipeline is failing due to issues in:
IntegrationTests
SwiftLintFrameworkTests
I am currently unable to resolve these failing tests and would appreciate any guidance or suggestions to address them.
Thank you for your support and patience as I work through this contribution!