-
Notifications
You must be signed in to change notification settings - Fork 4
Create a collection of checksums #5
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
Conversation
I feel conflicted for this because:
So, I'm not sure which concern should dominate. |
Perhaps there's an argument for two methods:
|
I recall our choice of returning an int from |
I don't believe we have the opportunity to return anything if we throw an exception, and we would currently throw an exception if the mismatches count more than zero. |
Sorry, I meant to dispense with throwing exceptions for hash mismatches to fix the control-flow style issue, and consult the resulting array length instead. I'm also fine with two methods, one of which throws and one of which returns reportable data. |
We definitely have a report only mode and a need to fail if validation fails. In the case of failing though, we don't want to WSOD. If we throw an exception, wouldn't we still be using the exception as a signal to stop processing. |
In the two-method model, we would call |
I'm a little reluctant to have 2 names for every method. It seems rather long for our public interface. Is there another way to do this? Maybe return a list of failures if the verification doesn't pass?
|
9c28af0
to
484dcf3
Compare
This results in the following test failure. Note it isn't a list of failed files but rather the first failed validation throws an exception.
|
I think we should decline this - it's adding extra complexit beyond the scope of this library |
Here's some additional refactoring to create a collection/iterable of hashes. |
Agreed, but some of the listed methods don't share the property of the multi-file check where you can have multiple instances of the same type of failure. For example, it would be unnecessary to have both Also, I'm not sure I understand the distinction between a checksum list versus a checksum file. |
8a6f0b3
to
d0625d7
Compare
Fixes #4 by externalizing the collection into a class that can be generally useful outside of this project. It reads the special formatted hashed files and provides it as an iterator.