-
Notifications
You must be signed in to change notification settings - Fork 671
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
Fix: Call format
s asynchronously
#880
Conversation
if (hasError(reports)) { | ||
endSpinner('fail'); | ||
} else { | ||
endSpinner('succeed'); | ||
} | ||
|
||
sonarwhal.formatters.forEach((formatter) => { | ||
formatter.format(reports, target); | ||
await each(sonarwhal.formatters, async (formatter) => { |
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.
why do you use the package async
instead of use a for … of..
?
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.
We should start using async
in all places instead of for … of
for legibility purposes and this was a good moment to start.
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.
for … of
is legible :P
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.
Let's replace all the map
, reduce
, forEach
, etc. for regular for
loops then 😛
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.
It is not the same example, you don't need to add any extra package to do that.
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.
We are using lodash
in parts of the code 🙄
Pull request checklist
Make sure you:
For non-trivial changes, please make sure you also:
Short description of the change(s)
There were some reports that Excel formatter was generating just an empty file. It turns out it's the first
formatter
that actually requires to be called asynchronously.This PR makes the call to
formatter.format
usingawait
.