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

feat: improve-remediation #95

Merged
merged 1 commit into from
Dec 17, 2019
Merged

feat: improve-remediation #95

merged 1 commit into from
Dec 17, 2019

Conversation

robcresswell
Copy link
Contributor

This patch is a rewrite of the remediation implementation. It makes several changes:

  • Remove the reliance on inspect, and instead get top level deps by parsing the manifest file. This should be significantly quicker than a pip install, making the fix process much faster for larger projects
  • Change the parser to attempt to better preserve package casing, version comparators, and extras (comments, markers, etc)
  • Update tests and add new tests. In a couple of cases, this actually involves fixing the test fixture, as the fixture itself was making changes such as package name casing, adding extra new lines to the manifest etc.

@robcresswell robcresswell requested a review from a team as a code owner December 16, 2019 15:11
@robcresswell robcresswell self-assigned this Dec 16, 2019
@ghost ghost requested review from dkontorovskyy and lili2311 December 16, 2019 15:11
@robcresswell robcresswell force-pushed the feat/improve-remediation branch 2 times, most recently from 733d9be to ef2b1ca Compare December 16, 2019 17:35
beforeEach(() => {
activateVirtualenv('remediation');
// const manifests = { 'requirements.txt': 'Jinja==2.7.2' };
// const upgrades = { 'jinja@2.7.2': { upgradeTo: 'jinja@2.8.1' } };
Copy link
Contributor

Choose a reason for hiding this comment

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

unused?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops! Yes, will remove.

lib/index.ts Outdated
return originalText;
}

const newVersion = upgrade.upgradeTo.split('@')[1];
Copy link
Contributor

Choose a reason for hiding this comment

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

are we sure the package name will never have a '@' in the name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This patch is a rewrite of the remediation implementation. It makes
several changes:

- Remove the reliance on `inspect`, and instead get top level deps by
  parsing the manifest file. This should be significantly quicker than a
  pip install, making the fix process much faster for larger projects
- Change the parser to attempt to better preserve package casing,
  version comparators, and extras (comments, markers, etc)
- Update tests and add new tests. In a couple of cases, this actually
  involves fixing the test fixture, as the fixture itself was making
  changes such as package name casing, adding extra new lines to the
  manifest etc.
@robcresswell robcresswell force-pushed the feat/improve-remediation branch from ef2b1ca to 61cfb58 Compare December 17, 2019 14:40
@robcresswell robcresswell merged commit 6bcb07a into master Dec 17, 2019
@robcresswell robcresswell deleted the feat/improve-remediation branch December 17, 2019 14:56
@snyksec
Copy link

snyksec commented Dec 17, 2019

🎉 This PR is included in version 1.15.0 🎉

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