Skip to content

Show multiple errors when popping imports#112

Open
leamingrad wants to merge 1 commit into
seddonym:mainfrom
leamingrad:tweak-ignored-import-helper
Open

Show multiple errors when popping imports#112
leamingrad wants to merge 1 commit into
seddonym:mainfrom
leamingrad:tweak-ignored-import-helper

Conversation

@leamingrad

Copy link
Copy Markdown
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.

@leamingrad
leamingrad force-pushed the tweak-ignored-import-helper branch from f8d602a to 945eff0 Compare December 8, 2021 10:27
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.
@leamingrad
leamingrad force-pushed the tweak-ignored-import-helper branch from 945eff0 to 8ee79a9 Compare December 8, 2021 10:31

@seddonym seddonym left a comment

Copy link
Copy Markdown
Owner

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.


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

Copy link
Copy Markdown
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.

2 participants