Skip to content

Commit

Permalink
feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Mar 5, 2018
1 parent 1f9d7b2 commit f80e742
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/understanding-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ An object containing the results of the audits, keyed by their name.
| rawValue | <code>boolean&#124;number</code> | The unscored value determined by the audit. Typically this will match the score if there's no additional information to impart. For performance audits, this value is typically a number indicating the metric value. |
| displayValue | `string` | The string to display in the report alongside audit results. If empty, nothing additional is shown. This is typically used to explain additional information such as the number and nature of failing items. |
| score | <code>boolean&#124;number</code> | The scored value determined by the audit as either boolean or a number `0-100`. If the audit is a boolean, the implication is `score ? 100 : 0`. |
| scoreDisplayMode | <code>"binary"&#124;"numeric"</code> | A string identifying how granular the score is meant to be indicating, i.e. is the audit pass/fail or are there shades of gray 0-100. *NOTE: This does not necessarily mean `typeof audit.score === audit.scoreDisplayMode`, an audit can have a score of 40 with a scoreDisplayMode of `"binary"` meant to indicate display should be failure.* |
| scoreDisplayMode | <code>"binary"&#124;"numeric"</code> | A string identifying how granular the score is meant to be indicating, i.e. is the audit pass/fail (score of 1 or 0), or are there shades of gray (scores between 0-1 exclusive). |
| details | `Object` | Extra information found by the audit necessary for display. The structure of this object varies from audit to audit. The structure of this object is somewhat stable between minor version bumps as this object is used to render the HTML report.
| extendedInfo | `Object` | Extra information found by the audit. The structure of this object varies from audit to audit and is generally for programmatic consumption and debugging, though there is typically overlap with `details`. *WARNING: The structure of this object is not stable and cannot be trusted to follow semver* |
| manual | `boolean` | Indicator used for display that the audit does not have results and is a placeholder for the user to conduct manual testing. |
Expand Down
6 changes: 3 additions & 3 deletions lighthouse-core/scoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @param {number} val
* @return {number}
*/
const clamp2decimals = val => Math.round(val * 100) / 100;
const clampTo2Decimals = val => Math.round(val * 100) / 100;

class ReportScoring {
/**
Expand All @@ -32,7 +32,7 @@ class ReportScoring {
{weight: 0, sum: 0}
);

return clamp2decimals(results.sum / results.weight || 0);
return clampTo2Decimals(results.sum / results.weight || 0);
}

/**
Expand All @@ -57,7 +57,7 @@ class ReportScoring {
audit.weight = 0;
result.informative = true;
}
result.score = clamp2decimals(result.score);
result.score = clampTo2Decimals(result.score);

if (!Number.isFinite(result.score)) {
throw new Error(`Invalid score: ${result.score}`);
Expand Down

0 comments on commit f80e742

Please sign in to comment.