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

Show multiple errors when popping imports #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leamingrad
Copy link
Contributor

Prior to this change, if we tried to pop multiple imports from the graph
that did not exist, we would only raise an error for the first one. This
meant that if we have multiple incorrect ignores for a contract, we will
only see one of them each time we lint imports (which is a bad
experience if you are trying to add a big list of potential ignores and
whittle them down).

This change raises a single error containing all of the missing imports.

Prior to this change, if we tried to pop multiple imports from the graph
that did not exist, we would only raise an error for the first one. This
meant that if we have multiple incorrect ignores for a contract, we will
only see one of them each time we lint imports (which is a bad
experience if you are trying to add a big list of potential ignores and
whittle them down).

This change raises a single error containing all of the missing imports.
We sort the imports alphabetically to make things easier.
Copy link
Owner

@seddonym seddonym left a comment

Choose a reason for hiding this comment

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

Thanks for this!

Would you mind adding a test?

Under this one would be a good place.


graph.remove_import(
importer=import_to_remove.importer.name, imported=import_to_remove.imported.name
)

removed_imports.extend(import_details)

if missing_imports:
# Sort the output to make it more helpful
missing_import_strings = sorted([str(i) for i in missing_imports])
Copy link
Owner

Choose a reason for hiding this comment

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

Not a blocker but we could make this just use a generator, i.e. sorted(str(i) for i in missing_imports)

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.

None yet

2 participants