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: change 'not-applicable' to 'notApplicable' #6783

Merged
merged 9 commits into from
Jan 5, 2019
Merged

Conversation

exterkamp
Copy link
Member

Summary
Change not-applicable to notApplicable. This will allow the LHR and protoLHR to use to same value instead of converting it in preprocessing.

Unfortunately since we can't ignore old LHRs that use 'not-applicable' or 'not_applicable' the processors, proto, and renderer need to accommodate those values.

Related Issues/PRs
fixes: #6201

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

seems fine to me, but with these it's always what we missed not what we see haha 🤷‍♂️

the back compat of the renderer most important to nail IMO, so 👍

lighthouse-core/report/html/renderer/category-renderer.js Outdated Show resolved Hide resolved
@@ -124,7 +124,7 @@ declare global {
warnings?: string[];
score?: number;
extendedInfo?: {[p: string]: any};
/** Overrides scoreDisplayMode with not-applicable if set to true */
/** Overrides scoreDisplayMode with notApplicable if set to true */
notApplicable?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

a head of its time 😆

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.

looking good (good thing we didn't push 4.0 yet!), but need to do a global search for some more instances of not-applicable. I highlighted a couple here, but there are a few more in e.g. html and etc

lighthouse-core/lib/proto-preprocessor.js Show resolved Hide resolved
lighthouse-core/lib/proto-preprocessor.js Outdated Show resolved Hide resolved
lighthouse-core/report/html/renderer/util.js Outdated Show resolved Hide resolved
lighthouse-core/report/html/renderer/util.js Show resolved Hide resolved
lighthouse-core/lib/proto-preprocessor.js Outdated Show resolved Hide resolved
@@ -56,7 +56,7 @@ class CategoryRenderer {
title: Util.UIStrings.passedAuditsGroupTitle,
className: 'lh-clump--passed',
},
'not-applicable': {
'notApplicable': {
title: Util.UIStrings.notApplicableAuditsGroupTitle,
className: 'lh-clump--not-applicable',
Copy link
Member

Choose a reason for hiding this comment

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

need to update

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh we should get a puppeteer screenshot test in for the report to catch these css mismatches

Copy link
Member

Choose a reason for hiding this comment

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

oh we should get a puppeteer screenshot test in for the report to catch these css mismatches

good idea. Don't we also have a jsdom test or two looking for the not applicable results? Concerning they weren't found...

Copy link
Member

Choose a reason for hiding this comment

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

Concerning they weren't found...

oh, because the test selectors weren't updated either :)

But now I'm questioning if it should be updated :) We don't currently create the clump names dynamically, so it can be whatever we want. Commonly notApplicable in js goes to not-applicable in css, but do we care? Or is notapplicable fine? Keeping camelCase seems gross, though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would go for not-applicable makes it easier to read in my opinion

@paulirish paulirish dismissed their stale review December 13, 2018 20:18

defering to brendan + patrick

@exterkamp exterkamp mentioned this pull request Dec 13, 2018
4 tasks
@paulirish paulirish added the 4.0 label Dec 18, 2018
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.

also update not-applicable in comments in pwa-category-renderer.js and category-renderer.js and in docs in understanding-results.md

@@ -124,7 +124,7 @@ declare global {
warnings?: string[];
score?: number;
extendedInfo?: {[p: string]: any};
/** Overrides scoreDisplayMode with not-applicable if set to true */
Copy link
Member

Choose a reason for hiding this comment

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

also should be notApplicable in the comment ~20 lines below here

lighthouse-core/report/html/renderer/util.js Show resolved Hide resolved
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.

lol ctrl-shift-f "not-applicable". I think there are four more at least.

@@ -153,7 +153,10 @@ class CategoryRenderer {
*/
_setRatingClass(element, score, scoreDisplayMode) {
const rating = Util.calculateRating(score, scoreDisplayMode);
element.classList.add(`lh-audit--${rating}`, `lh-audit--${scoreDisplayMode}`);
element.classList.add(`lh-audit--${rating}`);
if (typeof scoreDisplayMode === 'string') {
Copy link
Member

Choose a reason for hiding this comment

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

wait...how would it be possible for it not to be? That seems bad if it happens. Just in tests maybe (hopefully)?

Copy link
Member

Choose a reason for hiding this comment

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

from https://travis-ci.org/GoogleChrome/lighthouse/builds/470305380#L816, it looks like just the unit tests. We should fix those (is that what fdf9755 did?) and then not change the code here, I think. Better to trust our type system and fail fast if we defined/enforced things poorly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah fdf9755 fixed the unit tests and added guard rails for if the scoreDisplayMode was undefined. Good point tho, I removed the guardrails and made all the tests actually represent reality!

@@ -78,7 +78,7 @@ describe('processing for proto', () => {
const input = {
'audits': {
'critical-request-chains': {
'scoreDisplayMode': 'not-applicable',
'scoreDisplayMode': 'notApplicable',
Copy link
Member

Choose a reason for hiding this comment

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

ha, sorry, this one we want

Copy link
Member Author

Choose a reason for hiding this comment

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

delete not-applicable
don't delete not-applicable

I just can't impress you brendan 😭

@brendankenny
Copy link
Member

💥

@brendankenny brendankenny merged commit c164e75 into master Jan 5, 2019
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.

scoreDisplayMode incompatable with proto enum: not-applicable
5 participants