-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
refactor: extract computeLogNormalScore method #2710
Conversation
Niice. Good call. |
yeah I had a branch that copied/pasted this 2 more times and just thought enough is enough haha |
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.
yeah, definitely should be wrapped up like this
lighthouse-core/audits/audit.js
Outdated
* @param {number} medianValue | ||
* @return {number} | ||
*/ | ||
static computeScore(measuredValue, diminishingReturnsValue, medianValue) { |
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.
since not all audits compute their score this way, would it make more sense for this to live in statistics.js
still? and/or a more specific method name
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.
since not all audits compute their score this way
ah, but they should :) any more specific name ideas, computeLogNormalScore
?
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.
that's probably good if it stays in audit.js. It would be good to note in the jsdoc description something about that it returns the percentage of sites with values higher than measuredValue
from the distribution with the given attributes. But englished good.
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.
done
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.
LGTM 📐📈📉
The test in statistics-test.js
is arguably for this function instead, but that may be fine.
No description provided.