-
-
Notifications
You must be signed in to change notification settings - Fork 540
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 lint command #1043
Add lint command #1043
Conversation
@pepibumur your pull request is missing a changelog! |
Codecov Report
@@ Coverage Diff @@
## master #1043 +/- ##
==========================================
- Coverage 79.00% 78.84% -0.16%
==========================================
Files 237 238 +1
Lines 11259 11346 +87
==========================================
+ Hits 8895 8946 +51
- Misses 2364 2400 +36
Continue to review full report at Codecov.
|
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 aligns well with #1007 to allow leveraging different pieces of the generator without generation. Will rebase onto this branch when it lands.
Happy path:
$ tuist lint
Loading the dependency graph
Loading project at /path/to/tuist/fixtures/ios_app_with_static_frameworks
Running linters
Linting the environment
Linting the loaded dependency graph
Success: No linting issues found
Introduced an issue (duplicate static linking) and it flagged it as before:
$ tuist lint
Loading the dependency graph
Loading project at /path/to/tuist/fixtures/ios_app_with_static_frameworks
Running linters
Linting the environment
Linting the loaded dependency graph
Warning: - Target "B" has been linked against ["App", "D"], it is a static product so may introduce unwanted side effects.
public required convenience init(parser: ArgumentParser) { | ||
let manifestLoader = ManifestLoader() | ||
let generatorModelLoader = GeneratorModelLoader(manifestLoader: manifestLoader, | ||
manifestLinter: AnyManifestLinter()) |
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.
isn't it worth also linting manifests here?
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.
In fact, the first implementation used the manifest linter. However, if that validation fails it'd exit immediately and not run the other linters. Since the manifest linter just runs one validation, and I doubt we'll add more there. I think it's safe to leave it out. If we see we end up adding more validations there, we might consider changing the logic here.
Short description 📝
This PR adds a new command,
tuist lint
, that teams can run to validate on CI whether the project has a valid configuration.Solution 📦
I took part of the logic from the generator (graph loading + listing), and extracted it into an independent command. That way teams can lint the project without having to generate it.
Tasks ✅
LintCommand
.TuistGeneratorTesting
and extract some mocks into it.LintCommandTests
(unit tests)