You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto-detect sub-repo path from CWD relative to git root and append it to the repo name sent to the API
Progressively strip path segments on 404 to find the matching sub-project
Show a friendly error when a monorepo is detected without --repo
Include analyzer name/shortcode in PR issues GraphQL response
Context
Plain ticket #6884175 — CLI commands fail with "Repository does not exist" when run inside a monorepo sub-directory. Now the CLI detects the relative path, converts / to :, and appends it as a sub-repo suffix.
Companion PR: DeepSourceCorp/asgard (same branch)
Test plan
Run deepsource issues from a monorepo sub-directory and verify auto-detection works
Run from root of a monorepo without --repo and verify friendly error
- Detect CWD relative to git root and append colon-delimited sub-repo
suffix to the repo name sent to the API
- Progressively strip path segments on 404 to find the right sub-project
- Show friendly error when monorepo is detected without --repo
- Include analyzer name/shortcode in PR issues GraphQL response
We reviewed changes in fccfbea...b42dfdd on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.
The reason will be displayed to describe this comment to others. Learn more.
Use of `pwd` command and `/` path separator is not portable and insecure
The use of the pwd command makes this function non-portable to Windows and introduces a security risk via PATH manipulation. Additionally, the hardcoded / path separator will cause incorrect behavior on Windows.
Replace runCmd("pwd", nil) with the platform-agnostic and secure os.Getwd(). Use filepath.Rel(toplevel, cwd) to calculate the relative path, and replace os.PathSeparator to handle different operating systems correctly.
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
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.
Summary
--repoContext
Plain ticket #6884175 — CLI commands fail with "Repository does not exist" when run inside a monorepo sub-directory. Now the CLI detects the relative path, converts
/to:, and appends it as a sub-repo suffix.Companion PR: DeepSourceCorp/asgard (same branch)
Test plan
deepsource issuesfrom a monorepo sub-directory and verify auto-detection works--repoand verify friendly error