feat: return error when there is no root project without --all-projects#125
Merged
thomasschafer merged 1 commit intomainfrom Mar 17, 2026
Merged
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
--all-projects
649c8e4 to
e5846b0
Compare
4472154 to
4763b5d
Compare
snyk-tim
reviewed
Mar 17, 2026
| if !options.AllProjects && !options.UvWorkspacePackages && !hasProjectRoot(parsedSbom) { | ||
| log.Info(ctx, "No root project found in SBOM", logger.Attr("lockFile", lockFilePath)) | ||
| noRootErr := ecosystems.NewUvNoProjectRootError( | ||
| "Found uv project with no root. To scan non-root projects use the --all-projects flag.", |
Contributor
There was a problem hiding this comment.
I think we should stick to the same terminology that Astral use when warning the user. As this is related to virtual workspaces it would be better if the message was easier for the end user to understand. So something like:
Found uv workspace with no root project. To scan all workspace members use the --all-projects flag.
Contributor
Author
There was a problem hiding this comment.
Good point, done!
4763b5d to
8095c1b
Compare
snyk-tim
approved these changes
Mar 17, 2026
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently we have a bug where, when testing or monitoring a uv virtual workspace (i.e. a workspace with no root package, only workspace packages), all workspace packages will be included in the results. This is wrong, as a virtual workspace has no root and hence no dependencies. This PR adds an error in this scenario, informing the user that they can instead use
--all-projectsif they would like to intentionally include workspace packages in the results.I also updated some fixtures in other tests to include the
is_project_rootproperty, and add some other missing data which ensures that they are as realistic as possible.