-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
extract the reporter out of integrity checker #3248
extract the reporter out of integrity checker #3248
Conversation
…fore if one pattern is missing and we never reach that code
a2d83ff
to
59f0aee
Compare
I think I am finished, @bestander let me know if you like the pr and if I understand correctly what you mean :P |
Thanks, Simon!
…On 25 April 2017 at 19:21, Simon Vocella ***@***.***> wrote:
I think I am finished, @bestander <https://github.com/bestander> let me
know if you like the pr and if I understand correctly what you mean :P
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3248 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACBdWOiEadg4gxH2ne7uBJtqkMfTS_F7ks5rzjmYgaJpZM4NGk95>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work, @voxsim!
Thank you very much for improving it.
Could you look into making the string an enum rather than hardcoded string?
Also returning Promise.resolve() seems a bit weird in an async/await function
src/integrity-checker.js
Outdated
checkFiles: boolean, | ||
locationFolder: string): Promise<string> { | ||
if (!expected) { | ||
return Promise.resolve('EXPECTED_IS_NOT_A_JSON'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think flow enums would be a better fit here
src/integrity-checker.js
Outdated
} | ||
if (!compareSortedArrays(actual.flags, expected.flags)) { | ||
this.reporter.warn(this.reporter.lang('integrityFlagsDontMatch')); | ||
return false; | ||
return Promise.resolve('FLAGS_DONT_MATCH'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should all these errors be a reject rather than resolve?
@bestander I am sorry I really didn't know that with babel and async/await you can return something and this is 'automagically' wrapped by Promise.resolve O.o thanks for let me work on this and learn something new. I am reading how flow works, I will push something soon ;) |
done :D |
Nice work! |
Summary
Integrity-checker should not have side effects and we should reporting warning only in the check command.
Todo list
Test plan
See above.