-
- Notifications
You must be signed in to change notification settings - Fork 243
Refactor Gitimporter using fetchcode #817
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
ec88205 to 7ca35b3 Compare | @ziadhany , please add logs for gitlab importer. |
|
vulnerabilities/importers/gitlab.py Outdated
| | ||
| | ||
| class GitLabAPIImporter(Importer): | ||
| class GitLabGitImporter(GitImporter): |
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.
@ziadhany this will change the qualified name for importer and the databases will still have the old qualified name stored in them, which will now not be recogonised by improver, either write a migration to support this change or do not change the name of importer.
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.
LGTM! Thanks
| Please rebase with the latest main |
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.
Thanks!
I posted a few comments inline to ensure we do drop tests. Beside these, this looks good.
| TEST_DATA = os.path.join(BASE_DIR, "test_data/") | ||
| | ||
| | ||
| def load_oval_data(): |
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.
IMHO this would be best moved to a new test_oval.py
| assert os.path.join(self.repodir, "crates/hyper/RUSTSEC-2020-0008.toml") in updated_files | ||
| | ||
| | ||
| class TestOvalImporter(TestCase): |
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.
IMHO this would be best moved to a new test_oval.py and not just deleted
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 cannot approve this if we just delete all these tests above.
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 secured oval importer tests in the file itself https://github.com/nexB/vulnerablecode/pull/817/files#diff-eb1cffdadef3eacc470900468af6cce0bdd6ae476bc9ae94ce512863c060f850R40, and just deleted the GitImporter tests that are not related with the latest importers.
| def test_clone_valid(self): | ||
| with patch.object(GitImporter, "__init__", return_value=None): | ||
| c = GitImporter(None) | ||
| c.repo_url = "git+https://github.com/nexB/fetchcode" |
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.
Does this do a live clone over the network?
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.
yes, it clones the repository
( I just mock a constructor and then make the Git importer run, so I can test the result )
e4ad48a to b8c4b6f Compare Co-authored-by: Tushar Goel <tushar.goel.dav@gmail.com> Signed-off-by: ziadhany <ziadhany2016@gmail.com>
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.
LGTM. Thanks!
Reference: #806
Signed-off-by: ziad ziadhany2016@gmail.com