Skip to content
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

fix: ignore dependencies in virtualenv #9

Merged
merged 2 commits into from
Feb 9, 2021

Conversation

dtrunley-snyk
Copy link
Contributor

@dtrunley-snyk dtrunley-snyk commented Feb 7, 2021

What this does

Poetry uses the virtualenv to create an environment and this comes with these packages pre-installed, therefore they won't be listed in the lockfile as a dependency but it won't have its own metadata entry within the lockfile. This change prevents us trying to traverse the lockfile for those specific dependencies.
See: python-poetry/poetry#3075 (comment)

Also features a small refactor that better isolates the method to be able to test via unit tests rather than having to add a fixture for each scenario / writing custom manifest and lockfiles to mimic the scenario in a "unit" test, so it should make subsequent changes easier to test with less code. The refactor looks larger than it is as it involves the bulk of index being moved to a new file.

More information

pkgName: string,
pkgSpecs: PoetryLockFileDependency[],
): PoetryLockFileDependency {
const pkgLockInfo = pkgSpecs.find((lockItem) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const pkgLockInfo = pkgSpecs.find((lockItem) => 
  lockItem.name.toLowerCase() === pkgName.toLowerCase()
);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify, you mean to remove the return?

Copy link
Contributor

@admons admons left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments

@dtrunley-snyk dtrunley-snyk changed the title Bug/ignore dependencies in virtualenv Bug: ignore dependencies in virtualenv Feb 8, 2021
@dtrunley-snyk dtrunley-snyk force-pushed the bug/ignore-dependencies-in-virtualenv branch from 256ca6b to ea344c1 Compare February 8, 2021 22:44
@admons
Copy link
Contributor

admons commented Feb 9, 2021

Looking great!

@dtrunley-snyk dtrunley-snyk marked this pull request as ready for review February 9, 2021 12:40
@dtrunley-snyk dtrunley-snyk requested a review from a team as a code owner February 9, 2021 12:40
@dtrunley-snyk dtrunley-snyk merged commit 41b8a5d into master Feb 9, 2021
@dtrunley-snyk dtrunley-snyk deleted the bug/ignore-dependencies-in-virtualenv branch February 9, 2021 12:43
@dtrunley-snyk dtrunley-snyk changed the title Bug: ignore dependencies in virtualenv fix: ignore dependencies in virtualenv Feb 9, 2021
@snyksec
Copy link

snyksec commented Feb 10, 2021

🎉 This PR is included in version 1.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants