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

Add to node parsing capabilities #54

Merged
merged 7 commits into from
Nov 25, 2020
Merged

Add to node parsing capabilities #54

merged 7 commits into from
Nov 25, 2020

Conversation

shageman
Copy link
Contributor

What are you trying to accomplish?

In the codebase I am working on I see several errors related to edge cases where the code parsing fails. I am working to make packwerk run.

What approach did you choose and why?

I added a bunch of defensive statements that makes packwerk continue to run even when individual nodes fail to parse.

What should reviewers focus on?

This doesn't seem like a cohesive PR at the moment. Although the tests do pass, how should I break these changes up so merging would be considered?

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code refactor (non-breaking change that doesn't add functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist

  • It is safe to simply rollback this change.

@shageman shageman requested a review from a team as a code owner October 29, 2020 00:56
@ghost ghost added the cla-needed label Oct 29, 2020
@shageman
Copy link
Contributor Author

How do I complete the CLA step?

@wildmaples
Copy link
Contributor

How do I complete the CLA step?

@shageman https://cla.shopify.com/

Copy link
Contributor

@doodzik doodzik left a comment

Choose a reason for hiding this comment

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

Your changes look like a great addition 👍 I left two small comments but other than that it looks good.

@ghost ghost removed the cla-needed label Oct 29, 2020
@shageman
Copy link
Contributor Author

@doodzik I believe I addressed your comments with the new changes and hope to have also appeased the linter.

@shageman
Copy link
Contributor Author

Scratch that, my changes were too aggressive that broke that I need to go back and run tests locally. I hope to have another version tomorrow

end
rescue Node::TypeError
nil
Copy link
Contributor

@doodzik doodzik Oct 29, 2020

Choose a reason for hiding this comment

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

I would like to get the approval of @tomstuart because he raised an issue about defensive node parsing on one of my open PRs. From my understanding, this gem's design focuses on doing a good enough job uncovering dependency/privacy violations. In my opinion, defensive node parsing would fall under that because we don't fail if packwerk cannot handle the code. The downside is that we don't learn about parsing issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I totally agree. I would love to rather propose a fix for the parsing errors we are running into, but am not deep enough into packwerk and parser to understand much of what's going on.

I would be happy to pair on this or run non-defensive versions against the codebase I am looking at to give more input into what might be going on...

@shageman
Copy link
Contributor Author

If I fix the linting error as proposed by the check, all tests fail: https://github.com/Shopify/packwerk/pull/54/checks?check_run_id=1328856280

@doodzik doodzik mentioned this pull request Oct 30, 2020
6 tasks
@exterm
Copy link
Contributor

exterm commented Oct 30, 2020

all tests fail

Could you link to the build with the failing tests? the one you link to only has the failing linter.

@shageman
Copy link
Contributor Author

shageman commented Oct 30, 2020

all tests fail

Could you link to the build with the failing tests? the one you link to only has the failing linter.

Yes - no longer sure what I saw 🤔 must have been a snafu. I will update the PR

@shageman
Copy link
Contributor Author

@exterm @doodzik I took another stab at the changes needed to make it work for our codebase... this time a bit more focussed and with tests.

@shageman shageman changed the title More defensive node parsing to prevent parsing problem crashes Add to node parsing capabilities Nov 9, 2020
@shageman shageman requested a review from exterm November 9, 2020 15:45
@exterm
Copy link
Contributor

exterm commented Nov 9, 2020

Thank you for the adjustments! This PR is starting to look like a very valuable bugfix.

Copy link
Contributor

@doodzik doodzik left a comment

Choose a reason for hiding this comment

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

The PR is looking good! Once Philips comment is addressed and fix the merge conflict we can ship this PR 🚢

@shageman shageman force-pushed the main branch 2 times, most recently from 11d8945 to aa94892 Compare November 12, 2020 15:39
@shageman
Copy link
Contributor Author

Thanks, @doodzik - I have addressed all open comments

@exterm
Copy link
Contributor

exterm commented Nov 13, 2020

looking good! I'm going to test this on our core monolith.

@exterm
Copy link
Contributor

exterm commented Nov 13, 2020

It's complicated by the fact that packwerk main is currently broken on our monolith. We may want to fix that first before merging this. Sorry for the delay Stephan.

@exterm
Copy link
Contributor

exterm commented Nov 23, 2020

We fixed the main branch. @shageman , can you rebase? I'll manually test your branch on our monolith afterwards (I would have rebased myself, but there are merge conflicts and I sadly don't have the time to look into them right now)

@shageman
Copy link
Contributor Author

@exterm done. Thanks!

@exterm
Copy link
Contributor

exterm commented Nov 25, 2020

Ran it on the core monolith without problems.

Copy link
Contributor

@exterm exterm left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution Stephan!

@exterm exterm merged commit dd7c4db into Shopify:main Nov 25, 2020
@exterm exterm mentioned this pull request Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants