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

filterPasses -> validatePasses #608

Merged
merged 5 commits into from
Aug 24, 2016
Merged

filterPasses -> validatePasses #608

merged 5 commits into from
Aug 24, 2016

Conversation

paulirish
Copy link
Member

@paulirish paulirish commented Aug 23, 2016

This PR:

  • eliminates the audit whitelist
  • logs a warning if the user has included a gatherer that's not really needed
  • makes an an explicit deep copy of the config so we just don't have to worry about mutating it on accident

The current filterPass behavior implies that the user can leave all default core gatherers in the config and we'll remove the ones that aren't needed.

This is a bit odd as audits and aggregation sections must be correct, so we shouldn't make gatherers in particular be so forgiving.

Furthermore, the custom perf config no longer requires any core gatherers. It only needs trace & network records, which, without this PR, will end up filtering out the only pass in the config.

Now instead of changing the config, config.js will issue warnings when gatherers are specified in the config that appear to be unnecessary. The resolution is adjusting the config.

.filter(p => p.gatherers.length > 0);
return filteredPasses;
});
return passes;
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't return passes anymore

@brendankenny
Copy link
Member

looks good. The only downside to not putting a requiredArtifacts on the computed artifacts (and tracing the multiple steps) is we can't give feedback on unnecessary passes as well

@@ -106,29 +106,22 @@ function cleanTrace(trace) {
return trace;
}

function filterPasses(passes, audits, rootPath) {
function validatePasses(passes, audits, rootPath) {
if (!Array.isArray(passes)) {
Copy link
Member

Choose a reason for hiding this comment

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

why wouldnt it be an array?

Copy link
Member

Choose a reason for hiding this comment

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

oh, if it's null? it seems confusing to do the check in here instead of in getGatherersNeededByAudits

Copy link
Member

Choose a reason for hiding this comment

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

I forgot this isn't returning anything, just logging now, so that's fine, actually

@brendankenny
Copy link
Member

I think this still messes up the config object if it's kept around externally to lighthouse, but there should really be a test for that sort of thing :)

@brendankenny
Copy link
Member

brendankenny commented Aug 24, 2016

should note for those following along, this PR now also does:

  • an explicit deep copy of the config so we just don't have to worry about mutating it on accident
  • eliminates the audit whitelist since gatherers won't be filtered anymore anyways, so there's no gain for the extra complexity

@brendankenny
Copy link
Member

LGTM

@brendankenny brendankenny merged commit 1fb77ae into master Aug 24, 2016
@brendankenny brendankenny deleted the validatepasses branch August 24, 2016 00:30
@paulirish
Copy link
Member Author

Thx. updated the PR description.

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.

2 participants