Skip to content

extract the reporter out of integrity checker - #3248

Merged
bestander merged 8 commits into
yarnpkg:masterfrom
voxsim:extract-reporter-from-integrity-checker
Apr 26, 2017
Merged

bestander merged 8 commits into
yarnpkg:masterfrom
voxsim:extract-reporter-from-integrity-checker

Conversation

@voxsim

@voxsim voxsim commented Apr 24, 2017 •

Copy link
Copy Markdown
Contributor

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

voxsim commented Apr 25, 2017

Copy link
Copy Markdown
Contributor Author

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

@bestander

bestander commented Apr 26, 2017 via email

Copy link
Copy Markdown
Member

@bestander bestander left a comment

Copy link
Copy Markdown
Member

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

Comment thread src/integrity-checker.js Outdated
checkFiles: boolean,
locationFolder: string): Promise<string> {
if (!expected) {
return Promise.resolve('EXPECTED_IS_NOT_A_JSON');

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

Comment thread 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');

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

voxsim commented Apr 26, 2017

Copy link
Copy Markdown
Contributor Author

@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

voxsim commented Apr 26, 2017

Copy link
Copy Markdown
Contributor Author

done :D

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

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