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

core(lhr): drop informative/manual, moving them to scoreDisplayMode #5105

Merged
merged 6 commits into from
May 4, 2018

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented May 3, 2018

removes informative/manual/notApplicable booleans from LH.Audit.Result, uses scoreDisplayMode for all of these now

keeps notApplicable on the LH.Audit.Product though which createAuditResult uses to set the scoreDisplayMode to not-applicable, it felt a little more natural to me as the runtime split, but curious what other folks think

@paulirish FYI this probably has a few implications for your design changes i.e. an audit can no longer be both binary informative (made some blue 0s show up)

ref #5008 #4333

throw new Error(`${auditRef.id} accessibility audit does not have a group`);
}

if (auditRef.weight > 0 && isManual) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I went ahead and did it here @brendankenny since I was rebasing anyway

@paulirish
Copy link
Member

keeps notApplicable on the LH.Audit.Product though which createAuditResult uses to set the scoreDisplayMode to not-applicable, it felt a little more natural to me as the runtime split, but curious what other folks think

yah sgtm

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

had thought null scores were part of this, too, but realize it's not. all good.

auditEl.classList.add('lh-audit--informative');
}
if (audit.result.manual) {
if (audit.result.scoreDisplayMode === 'manual') {
Copy link
Member

Choose a reason for hiding this comment

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

else if

Copy link
Member

Choose a reason for hiding this comment

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

or do this in a little loop

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

lh-audit--${audit.result.scoreDisplayMode} cool with you?

Copy link
Member

Choose a reason for hiding this comment

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

lol yeah excellent.

@paulirish paulirish changed the title core(scoreDisplayMode): use scoreDisplayMode, no more informative/manual core(lhr): drop informative/manual, moving them to scoreDisplayMode May 3, 2018
@paulirish
Copy link
Member

travis sez run yarn update:sample-json

@brendankenny
Copy link
Member

keeps notApplicable on the LH.Audit.Product though which createAuditResult uses to set the scoreDisplayMode to not-applicable, it felt a little more natural to me as the runtime split, but curious what other folks think

I think it makes sense, too. I could see a future where an audit doesn't have enough information and wants to mark itself informative, too. It makes sense for generateAuditResult to take care of bringing all that together

@@ -114,12 +115,9 @@ declare global {
scoreDisplayMode: ScoringModeValue;
description: string;
extendedInfo?: {[p: string]: any};
notApplicable?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

not sure where the best place to put docstrings for audit authors to see, but maybe add a jsdoc string to notApplicable in Product to mention it would override scoreDisplayMode if provided?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah done

}

export type ScoringModeValue = Audit.ScoringModes[keyof Audit.ScoringModes];
export type ScoringModeValue = Audit.ScoreDisplayModes[keyof Audit.ScoreDisplayModes];
Copy link
Member

Choose a reason for hiding this comment

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

should this type be ScoreDisplayMode now? Seems like it makes sense

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah sg

let {score, scoreDisplayMode} = Audit._normalizeAuditScore(audit, result);

// If the audit was determined to not apply to the page, we'll reset it as informative only
let informative = audit.meta.informative;
if (result.notApplicable) {
score = 1;
Copy link
Member

Choose a reason for hiding this comment

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

should we be enforcing the other things we say we do? Like no score if not binary or numeric display mode?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah we're gonna do that in followup

@patrickhulce
Copy link
Collaborator Author

@brendankenny LGTY?

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.

whoops, yes, LGTM!

@patrickhulce patrickhulce merged commit 7a6c645 into master May 4, 2018
@patrickhulce patrickhulce deleted the score_display_mode branch May 4, 2018 22:53
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