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

extract the reporter out of integrity checker #3248

Merged

Conversation

voxsim
Copy link
Contributor

@voxsim voxsim commented Apr 24, 2017

Summary
Integrity-checker should not have side effects and we should reporting warning only in the check command.

Todo list

  • add some testing for the check command
  • Right now I report an error with the reason why integrity matches failed in the check command, this is incorrect, I should use a warning

Test plan
See above.

@voxsim voxsim force-pushed the extract-reporter-from-integrity-checker branch from a2d83ff to 59f0aee Compare April 25, 2017 18:13
@voxsim
Copy link
Contributor Author

voxsim commented Apr 25, 2017

I think I am finished, @bestander let me know if you like the pr and if I understand correctly what you mean :P

@bestander
Copy link
Member

bestander commented Apr 26, 2017 via email

Copy link
Member

@bestander bestander left a 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

checkFiles: boolean,
locationFolder: string): Promise<string> {
if (!expected) {
return Promise.resolve('EXPECTED_IS_NOT_A_JSON');
Copy link
Member

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

}
if (!compareSortedArrays(actual.flags, expected.flags)) {
this.reporter.warn(this.reporter.lang('integrityFlagsDontMatch'));
return false;
return Promise.resolve('FLAGS_DONT_MATCH');
Copy link
Member

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?

@voxsim
Copy link
Contributor Author

voxsim commented Apr 26, 2017

@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 ;)

@voxsim
Copy link
Contributor Author

voxsim commented Apr 26, 2017

done :D

@bestander bestander merged commit 2b1956c into yarnpkg:master Apr 26, 2017
@bestander
Copy link
Member

Nice work!

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