-
Notifications
You must be signed in to change notification settings - Fork 91
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 Properties VCPKG #855
Add Properties VCPKG #855
Conversation
src/Microsoft.ComponentDetection.Contracts/TypedComponent/VcpkgComponent.cs
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## main #855 +/- ##
=====================================
Coverage 77.5% 77.5%
=====================================
Files 235 235
Lines 9936 9953 +17
=====================================
+ Hits 7702 7719 +17
Misses 2234 2234
|
👋 Hi! It looks like you modified some files in the
If none of the above scenarios apply, feel free to ignore this comment 🙂 |
|
||
if (!string.IsNullOrEmpty(locationArr[3])) | ||
{ | ||
this.GitRepositoryName = locationArr[3].TakeWhile(ch => char.IsLetterOrDigit(ch)).ToString(); |
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 think this check may fail for repositories with valid names like component-detection
* "git+https://github.com/Microsoft/vcpkg#ports/nlohmann-json" | ||
*/ | ||
var locationArr = this.DownloadLocation.Split('/'); | ||
if (!string.IsNullOrEmpty(locationArr[2])) |
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.
Let's do an array length check, in which we expect at least 4 fragments, if less than that this should be noop. Otherwise we can hit index out of range exceptions here.
* "git+https://github.com/leethomason/tinyxml2@9.0.0" | ||
* "git+https://github.com/Microsoft/vcpkg#ports/nlohmann-json" | ||
*/ | ||
var locationArr = this.DownloadLocation.Split('/'); |
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.
qq, if downloadlocation is null will the split work?
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 have a null or empty check before this method gets called
|
||
using System.Linq; | ||
using PackageUrl; | ||
|
||
public class VcpkgComponent : TypedComponent |
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 expect to see some tests to validate these new changes.
Added GitRepositoryOwner and GitRepositoryName to prevent fuzzy matching