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

Skip traversal for targets with a dependency on macros in linter. #6210

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

simoalx
Copy link

@simoalx simoalx commented Apr 19, 2024

Resolves #6209

Short description πŸ“

Users reported getting "static side effects" warnings that seem to be false positives in their projects. They happen when the project has Swift Macros; our logic doesn't account for that. We need to adjust the logic that checks for side effects to skip the traversal when it comes across a macro executable.

How to test the changes locally 🧐

Create a project with an app that depends on 2 dynamic frameworks
Add a Swift Macros to each of those 2 dynamic frameworks
Generate the project

Contributor checklist βœ…

  • The code has been linted using run mise run lint:fix
  • The change is tested via unit testing or acceptance testing, or both
  • The title of the PR is formulated in a way that is usable as a changelog entry
  • In case the PR introduces changes that affect users, the documentation has been updated

Reviewer checklist βœ…

  • The code architecture and patterns are consistent with the rest of the codebase
  • Reviewer has checked that, if needed, the PR includes the label changelog:added, changelog:fixed, or changelog:changed, and the title is usable as a changelog entry

@fortmarek fortmarek requested a review from pepicrft April 22, 2024 07:36
Copy link
Collaborator

@kwridan kwridan left a comment

Choose a reason for hiding this comment

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

Thanks @simoalx

@@ -1289,6 +1289,60 @@ class StaticProductsGraphLinterTests: XCTestCase {
XCTAssertEqual(results, [])
}

func test_lint_whenMacrosLinkedTwice() throws {
Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks for adding this test πŸ‘

If I followed along this use case the static framework is linked twice!

example

Mind elaborating on how this can be a false positive?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive "side effects" warning when using Swift Macros
2 participants