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 for mismatching build configurations in a workspace #474
Add linting for mismatching build configurations in a workspace #474
Conversation
Resolves tuist#467 - All projects' build configurations are now validated against the top level projects - In the event any are missing or are mismatching (e.g. have a mismatching variant) the linter will now flag them Examples: ``` $ tuist generate The following issues have been found: - The project 'Framework2' has missing or mismatching configurations. It has [Debug (debug), Release (release)], other projects have [Beta (release), Debug (debug), Release (release)]. ``` Test Plan: - Run `tuist generate` within `fixtures/ios_app_with_multi_configs` - Comment out any of the build configurations defined in `App`, `Framework1` or `Framework2` - Re-run `tuist generate` - Verify a lint warning is displayed
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.
Changes look good and very easy to follow. It will certainly help reduce the number of problems from defining multiple configurations! 🥇
// LintableTarget(platform: .iOS, product: .messagesExtension), | ||
// LintableTarget(platform: .iOS, product: .stickerPack), | ||
// LintableTarget(platform: .watchOS, product: .watch2App), | ||
// LintableTarget(platform: .watchOS, product: .watchApp), |
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.
Just double check you're happy with this new alignment, I think by formatting the file it's indented them by accident.
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.
it was swiftformat - will push a revert, hopefully won't get flagged as an unformatted PR 🤐
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.
|
||
func test_lint_doesNotFlagDependenciesWithExtraConfigurations() throws { | ||
// Lower level dependencies could be shared by projects in different workspaces as such | ||
// it is ok for them to contain more configurations than the entry node projects |
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.
👍
Codecov Report
@@ Coverage Diff @@
## master #474 +/- ##
==========================================
+ Coverage 92.23% 92.29% +0.06%
==========================================
Files 326 326
Lines 16943 17076 +133
==========================================
+ Hits 15628 15761 +133
Misses 1315 1315
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #474 +/- ##
==========================================
+ Coverage 92.23% 92.29% +0.06%
==========================================
Files 326 326
Lines 16943 17076 +133
==========================================
+ Hits 15628 15761 +133
Misses 1315 1315
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #474 +/- ##
==========================================
+ Coverage 92.23% 92.29% +0.06%
==========================================
Files 326 326
Lines 16943 17076 +133
==========================================
+ Hits 15628 15761 +133
Misses 1315 1315
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #474 +/- ##
==========================================
+ Coverage 92.23% 92.29% +0.06%
==========================================
Files 326 326
Lines 16943 17076 +133
==========================================
+ Hits 15628 15761 +133
Misses 1315 1315
Continue to review full report at Codecov.
|
private func lintMismatchingConfigurations(graph: Graphing) -> [LintingIssue] { | ||
let entryNodeProjects = graph.entryNodes.compactMap { $0 as? TargetNode }.map { $0.project } | ||
|
||
let knownConfgiruations = entryNodeProjects.reduce(into: Set()) { |
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.
Typo: knownConfgiruations
Resolves #467
Short description 📝
It can be easy to miss specifying a project build configuration in large workspaces. This can lead to build errors or worse an incorrectly configured built project!
Solution 📦
Add a linter to flag any missing or mismatching build configurations.
Implementation 👩💻👨💻
Example:
Test Plan 🛠
tuist generate
withinfixtures/ios_app_with_multi_configs
App
,Framework1
orFramework2
tuist generate