-
Notifications
You must be signed in to change notification settings - Fork 474
Add gradle lockfile support #46
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
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
/gcbrun |
|
Thank you for the PR! |
|
CC @G-Rath |
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.
Awesome stuff! You need to update the list of lockfiles in the readme, and it would also be good to have a few tests covering a lockfile with a bad line (or two).
| if len(packages) != 5 { | ||
| t.Errorf("Expected %d packages got %d", 5, len(packages)) | ||
| } |
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.
Can we use expectPackages here? I think it's worth asserting the actual packages to ensure they're all being parsed correctly
d8a5231 to
5afef7e
Compare
|
@G-Rath Thanks for the suggestions. I have updated the PR. |
5afef7e to
1daf873
Compare
| func TestParseGradleLock_OnlyComments(t *testing.T) { | ||
| t.Parallel() | ||
|
|
||
| packages, err := lockfile.ParseGradleLock("fixtures/gradle/only-comment") |
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.
nit: technically this file should be only-comments, which aligns with the test name
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.
Renamed :)
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.
Looks good - just need to update the list in TestParse_FindsExpectedParsers
| "poetry.lock", | ||
| "pubspec.lock", | ||
| "requirements.txt", | ||
| "gradle.lockfile", |
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.
buildscript-gradle.lockfile should be included on this list (effectively this should have all lockfiles that are listed in the readme as being supported)
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.
Updated to include buildscript-gradle.lockfile. But had to decrement the asserted count because both gradle.lockfile and buildscript-gradle.lockfile use the same parser.
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.
sweet as - that test is more meant to help catch people forgetting to update this section of tests if a new parser is added, which is always a bit fuzzy (arguably I should have used a map against the function name and then check that each was called at least once, which I think could be possible, but not worth the effort imo)
Fix test case Add gradle lockfile support Fix test case Update pkg/lockfile/ecosystems_test.go Co-authored-by: Gareth Jones <Jones258@Gmail.com> Update test case as per PR review comment Signed-off-by: abhisek <abhisek.datta@gmail.com> Update README
1daf873 to
ccdc7a0
Compare
|
/gcbrun |
Fix test case Add gradle lockfile support Fix test case Update pkg/lockfile/ecosystems_test.go Co-authored-by: Gareth Jones <Jones258@Gmail.com> Update test case as per PR review comment Signed-off-by: abhisek <abhisek.datta@gmail.com> Update README
Fix test case Add gradle lockfile support Fix test case Update pkg/lockfile/ecosystems_test.go Co-authored-by: Gareth Jones <Jones258@Gmail.com> Update test case as per PR review comment Signed-off-by: abhisek <abhisek.datta@gmail.com> Update README
Add support for:
gradle.lockfilebuildscript-gradle.lockfileReference: https://docs.gradle.org/current/userguide/dependency_locking.html#lock_state_location_and_format