-
-
Notifications
You must be signed in to change notification settings - Fork 506
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
Add Linting to require conditions for multiplatform dependencies with mismatched platforms. #6251
Conversation
…upported all the required platforms of a target.
@waltflanagan Thanks a lot for taking care of this issue. So basically you introduced a linting rule whenever a depdendency without conditions is linked to a target which supported set destinations is a superset of of the linked target and the target is not linked with any conditions did I see that correct ? |
if !unaccountedPlatforms.isEmpty { | ||
let missingPlatforms = unaccountedPlatforms.map(\.rawValue).joined(separator: ", ") | ||
return [LintingIssue( | ||
reason: "Target \(fromTargetName) with depends on \(dependentTarget.target.name) and but does not support the required platforms \(missingPlatforms). This dependency requires a condition.", |
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.
What do you think of making this message a little more verbose ?
reason: "Target \(fromTargetName) with depends on \(dependentTarget.target.name) and but does not support the required platforms \(missingPlatforms). This dependency requires a condition.", | |
reason: "Target \(fromTargetName) which \(dependentTarget.target.name) is depending on, does not support the required platforms \(missingPlatforms). \(fromTargetName) requires a condition which restricts it to at most \(missingPlatforms)", |
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.
i like it!
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.
We could probably derive the condition ourselves if it's not specified, but I'd also lean to forcing developers to be explicit about it.
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.
Thx a lot for the addition 👍
Co-authored-by: Marek Fořt <marekfort@me.com>
Fixes #5978.
Short description 📝
Adding linting to call out when a platform condition is required. It's more complicated than just checking the set of platforms of each target because some target relationships (iOS app depending on WatchOS App) are valid. Here we constrain the linting logic to just linkable targets but we could include
How to test the changes locally 🧐
Tests were added to replicate the issue and are passing with the addition of the linting rules.
Contributor checklist ✅
mise run lint:fix
Reviewer checklist ✅
changelog:added
,changelog:fixed
, orchangelog:changed
, and the title is usable as a changelog entry