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(meta): refactor all meta audits to single artifact #7025

Merged
merged 4 commits into from
Jan 17, 2019

Conversation

patrickhulce
Copy link
Collaborator

Summary
Replace all our scattered meta gatherers with a single MetaElements artifact.

Related Issues/PRs
#6747

@@ -199,7 +199,7 @@ class FontSize extends Audit {
title: str_(UIStrings.title),
failureTitle: str_(UIStrings.failureTitle),
description: str_(UIStrings.description),
requiredArtifacts: ['FontSize', 'URL', 'Viewport'],
requiredArtifacts: ['FontSize', 'URL', 'MetaElements'],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no changes to functionality needed here because it just calls out to the viewport audit

@paulirish paulirish mentioned this pull request Jan 16, 2019
6 tasks
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.

maybe it's unavoidable, but are we setting ourselves up for ballooning the size of the artifacts? People put crazy things in meta tags sometimes.

We could have a list of allowed meta names and add the ones we need as we go. On the other hand, that would prevent plugins from being able to just use the meta tags they're interested in without getting changes landed in core.

MetaDescription: string|null;
/** The value of the <meta name="robots">'s content attribute, or null. */
MetaRobots: string|null;
/** The value of the <meta>elements in the head. */
Copy link
Member

Choose a reason for hiding this comment

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

values

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

@@ -12,7 +12,7 @@
<!-- FAIL(font-size): missing viewport -->
<meta name="viewport" content="invalid-content=should_have_looked_it_up">
<!-- no <meta name="description" content=""> -->
<meta name="robots" content="nofollow, NOINDEX, all">
<meta name="RoBots" content="nofollow, NOINDEX, all">
Copy link
Member

Choose a reason for hiding this comment

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

document the reason for this?

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

@@ -43,13 +43,13 @@ class ThemedOmnibox extends MultiCheckAudit {
}

/**
* @param {LH.Artifacts['ThemeColor']} themeColorMeta
* @param {LH.Artifacts['MetaElements'][0]|undefined} themeColorMeta
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 make an alias of LH.Artifacts.MetaElement since we use this so often?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is the only usage of it, but sure :)

Copy link
Member

Choose a reason for hiding this comment

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

this is the only usage of it, but sure

ha, whoops

it('fails when viewport is not set', () => {
const artifacts = {
URL,
Viewport: null,
MetaElements: makeMetaElements(null),
Copy link
Member

Choose a reason for hiding this comment

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

Is the conditional in makeMetaElements just for this case? null could just be undefined or this one could just be [] an no conditional needed :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, done

@@ -78,7 +80,7 @@ describe('SEO: Is page crawlable audit', () => {
const artifacts = {
devtoolsLogs: {[IsCrawlableAudit.DEFAULT_PASS]: devtoolsLog},
URL: {finalUrl},
MetaRobots: null,
MetaElements: makeMetaElements(null),
Copy link
Member

Choose a reason for hiding this comment

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

switch to no argument or just use [] and no function call?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure, done

@@ -94,7 +94,7 @@ describe('Config', () => {
const configJson = {
passes: [{
passName: unlikelyPassName,
gatherers: ['viewport'],
gatherers: ['meta-elements'],
Copy link
Member

Choose a reason for hiding this comment

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

I apologize for the number of times I've used viewport as a dummy gatherer name :)

@patrickhulce
Copy link
Collaborator Author

maybe it's unavoidable, but are we setting ourselves up for ballooning the size of the artifacts? People put crazy things in meta tags sometimes.

FWIW, I'm not really worried about this. Of all the artifact size concerns, we know these artifacts have to be constrained to roughly the size of the page. trace/devtoolslog/screenshots are always going to dwarf this.

We could have a list of allowed meta names and add the ones we need as we go. On the other hand, that would prevent plugins from being able to just use the meta tags they're interested in without getting changes landed in core.

This limitation would kinda defeat the purpose of having generic gatherers IMO, would it not? Seems like if we just limited to what we needed then it's no different from the position we were in before functionality-wise.

@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.

LGTM

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