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

refactor: extract computeLogNormalScore method #2710

Merged
merged 2 commits into from
Jul 19, 2017
Merged

Conversation

patrickhulce
Copy link
Collaborator

No description provided.

@paulirish
Copy link
Member

Niice. Good call.

@patrickhulce
Copy link
Collaborator Author

yeah I had a branch that copied/pasted this 2 more times and just thought enough is enough haha

Copy link
Member

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

* @param {number} medianValue
* @return {number}
*/
static computeScore(measuredValue, diminishingReturnsValue, medianValue) {
Copy link
Member

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

Copy link
Collaborator Author

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?

Copy link
Member

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@patrickhulce patrickhulce changed the title refactor: extract computeScore method refactor: extract computeLogNormalScore method Jul 19, 2017
Copy link
Member

@brendankenny brendankenny left a 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.

@patrickhulce patrickhulce merged commit 648cce6 into master Jul 19, 2017
@patrickhulce patrickhulce deleted the compute_score branch July 19, 2017 01:03
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.

3 participants