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

report: add Trust & Safety group under Best Practices #10623

Merged
merged 13 commits into from
Apr 30, 2020
Merged

Conversation

Beytoven
Copy link
Contributor

As the title suggests, this PR simply moves the Trust and Safety related audits to a specified sub-category. All other Best Practices audits are moved under General.

Screen Shot 2020-04-22 at 5 18 48 PM

@Beytoven Beytoven requested a review from a team as a code owner April 23, 2020 00:24
@Beytoven Beytoven requested review from patrickhulce and removed request for a team April 23, 2020 00:24
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.

looks great @Beytoven thanks! :)

/** Title of the Trust & Safety group of the Best Practices category. Within this section are the audits related to trust and safety. */
safetyGroupTitle: 'Trust & Safety',
/** Title of the General group of the Best Practices category. Within this section are the audits that don't belong to a specific group. */
generalGroupTitle: 'General',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
generalGroupTitle: 'General',
bestPracticesGeneralGroupTitle: 'General',

I like that the others prefix with the category, especially nice for a group titled General ;)

@@ -105,6 +105,10 @@ const UIStrings = {
'not automatically checked by Lighthouse. They do not affect your score but it\'s important that you verify them manually.',
/** Title of the Best Practices category of audits. This is displayed at the top of a list of audits focused on topics related to following web development best practices and accepted guidelines. Also used as a label of a score gauge; try to limit to 20 characters. */
bestPracticesCategoryTitle: 'Best Practices',
/** Title of the Trust & Safety group of the Best Practices category. Within this section are the audits related to trust and safety. */
safetyGroupTitle: 'Trust & Safety',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
safetyGroupTitle: 'Trust & Safety',
bestPracticesSafetyGroupTitle: 'Trust & Safety',

{id: 'image-aspect-ratio', weight: 1},
{id: 'image-size-responsive', weight: 1},
// Trust & Safety
{id: 'is-on-https', weight: 1, group: 'trust-and-safety'},
Copy link
Collaborator

Choose a reason for hiding this comment

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

per #10619 I think we want to add redirects-http too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't realize we were moving one of the PWA audits as well. @connorjclark can you confirm?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's have redirects-http be in PWA and this new subgroup.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh yes definitely don't move, I just meant also have it show up here :)

lighthouse-core/config/default-config.js Show resolved Hide resolved
@brendankenny
Copy link
Member

are ungrouped audits still a thing? Is it better to have everything else under 'General' or to just have them be ungrouped?

I don't have a strong opinion, but generally using up UI space just to have a generic "other things" title doesn't add that much. OTOH maybe it doesn't look so great not grouped :)

{id: 'image-size-responsive', weight: 1},
// Trust & Safety
{id: 'is-on-https', weight: 1, group: 'trust-and-safety'},
{id: 'external-anchors-use-rel-noopener', weight: 1, group: 'trust-and-safety'},
Copy link
Collaborator

Choose a reason for hiding this comment

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

how would you feel about best-practices-trust-and-safety? right now basically every group prefixes the category or an abbreviation of it

@brendankenny
Copy link
Member

are ungrouped audits still a thing?

oh, looks like ungrouped ones come first which wouldn't be great for this. What great ascii art someone put in that comment, though!

I guess the order could be reversed, but OTOH here is @patrickhulce arguing for the exact opposite of "minimum amount of groups pls" :)

@Beytoven
Copy link
Contributor Author

are ungrouped audits still a thing?

oh, looks like ungrouped ones come first which wouldn't be great for this. What great ascii art someone put in that comment, though!

I guess the order could be reversed, but OTOH here is @patrickhulce arguing for the exact opposite of "minimum amount of groups pls" :)

The styling doesn't look too good with a mix of grouped and ungrouped audits.

For reference:
Screen Shot 2020-04-22 at 5 04 35 PM

…r gatherers w/ properties that have a .bind() function
@brendankenny brendankenny changed the title report: add T&S subcategory under Best Practices report: add Trust & Safety group under Best Practices Apr 28, 2020
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.

agreed with @patrickhulce this looks just about ready to go!

lighthouse-core/config/default-config.js Outdated Show resolved Hide resolved
lighthouse-core/config/default-config.js Outdated Show resolved Hide resolved
lighthouse-core/config/default-config.js Outdated Show resolved Hide resolved
@@ -384,6 +392,18 @@ const defaultConfig = {
title: str_(UIStrings.seoCrawlingGroupTitle),
description: str_(UIStrings.seoCrawlingGroupDescription),
},
'best-practices-safety': {
Copy link
Member

Choose a reason for hiding this comment

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

maybe best-practices-trust-safety?

If I come in looking for the Trust and Safety group, my ctrl-f would definitely start with "trust" :)

assert.equal(config.passes.length, 1, 'did not filter config');
assert.deepStrictEqual(config, extendedConfig, 'had mutations');
expect(config).toMatchObject(extendedConfig, 'had mutations');
Copy link
Member

Choose a reason for hiding this comment

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

toMatchObject here only checks that everything in extendedConfig is in config, which means config can be extendedConfig plus extra non-matching properties and this assertion would still pass.

e.g. if one of the gatherer.implementation in extendedConfig accidentally got switched to {}, it would match with almost anything in the same gatherer.implementation slot in config.

This could be checked both ways (each is a subset of the other) with

expect(config).toMatchObject(extendedConfig, 'had mutations');
expect(extendedConfig).toMatchObject(config, 'had mutations');

to check both directions but I think we really want

expect(config).toEqual(extendedConfig, 'had mutations');

to make sure we're being strict on equality.

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh good catch, while we're on the subject I don't think the message part works with that particular expect API, so we can nix had mutations or convert it to a comment and stick to the actual object diff

lighthouse-core/test/config/config-test.js Outdated Show resolved Hide resolved
Co-Authored-By: Brendan Kenny <bckenny@gmail.com>
Co-Authored-By: Patrick Hulce <patrick.hulce@gmail.com>
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.

LGTM, nicely done @Beytoven! 🎉

lighthouse-core/audits/dobetterweb/no-document-write.js Outdated Show resolved Hide resolved
lighthouse-core/test/config/config-test.js Outdated Show resolved Hide resolved
Co-Authored-By: Patrick Hulce <patrick.hulce@gmail.com>
@patrickhulce
Copy link
Collaborator

@brendankenny did you wish to have another look or are you fine with my LGTM?

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.

yes, sorry to barge in, LGTM2!

@patrickhulce
Copy link
Collaborator

cool!

FYI @Beytoven you might need to merge master to fix the required statuses

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants