Gulp Dep Check: fail on unused entries#26981
Merged
samouri merged 6 commits intoampproject:masterfrom Feb 26, 2020
Merged
Conversation
rsimha
approved these changes
Feb 26, 2020
Contributor
rsimha
left a comment
There was a problem hiding this comment.
Really cool PR. Thanks for doing this!
Who should we bring in to verify that each of these removals from the dep config actually make sense and are not errors. I happened to be able to catch the DOMPurify mistake because I had context there, but I'm worried refactors could have caused some of these other unused exceptions (and they just need their paths updated)
With your refactor, gulp dep-check should be self-checking in this regard. If there are missing entries or unnecessary entries, the check should fail on Travis.
rsimha
reviewed
Feb 26, 2020
Comment on lines
+448
to
+455
| /** DO NOT ADD TO allowlist */ | ||
| 'ads/ix.js->ads/google/doubleclick.js', | ||
| 'ads/imonomy.js->ads/google/doubleclick.js', | ||
| 'ads/navegg.js->ads/google/doubleclick.js', | ||
| /** DO NOT ADD TO WHITELIST */ | ||
| /** DO NOT ADD TO allowlist */ | ||
| 'ads/openx.js->ads/google/doubleclick.js', | ||
| 'ads/pulsepoint.js->ads/google/doubleclick.js', | ||
| /** DO NOT ADD TO WHITELIST */ | ||
| /** DO NOT ADD TO allowlist */ |
Contributor
There was a problem hiding this comment.
These three should probably be all caps.
Member
Author
There was a problem hiding this comment.
ah darn i missed this. tiny followup incoming!
robinvanopstal
added a commit
to jungvonmatt/amphtml
that referenced
this pull request
Feb 27, 2020
* master: (54 commits) inabox-resources: Minor test improvement (ampproject#26916) DocInfo: replace metaTags with viewport in API (ampproject#26687) 🐛 SwG now uses AMP sendBeacon interface (ampproject#26970) 🏗 Allow array destructuring on preact hooks (ampproject#26901) Gulp Dep Check: fail on unused entries (ampproject#26981) Update no-import lint rule to forbid sub-paths (ampproject#26531) 🐛 amp-ad type blade - fix bladeOnLoad callback (ampproject#26627) 📖 Clarify when max-age is required (ampproject#26956) ♻️ Consolidate players as .i-amphtml-media-component (ampproject#26967) Add Preact Enzyme tests (ampproject#26529) Fixes `update_tests` flag on `gulp validator` (ampproject#26965) 📦 Update dependency google-closure-library to v20200224 (ampproject#26986) 🏗 Transform aliased configured components (ampproject#26541) ✨ InaboxResources: Observe intersections for some elements' viewportCallbacks (ampproject#26942) variable substitutions: Support allowlist lookup in AmpDocShadow (ampproject#26731) cl/297197875 Revision bump for ampproject#26877 (ampproject#26982) Json fix (ampproject#26971) 📦 Update dependency mocha to v7.1.0 (ampproject#26976) Add documentation for amp-access-scroll (ampproject#26782) make controls always shown in amp for email (ampproject#25714) ...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
summary
We have have a presubmit check called
check-depsthat ensures modules only depend on those that they should. While it does its job well, there is an issue facing it now where unused rule-exceptions are allowed to stay. This means that it is all too easy to have the file grow indefinitely.This Pull Request adds in the a new type of error for allowlisted entries that are unused. It also removes all the currently unused rule-exceptions.
Interestingly enough, this check can help prevent us from making errors during refactors. Specifically I noticed that our
DOMPurifycode was refactored/moved around but the checks were never updated to the new filepaths.question
Who should we bring in to verify that each of these removals from the dep config actually make sense and are not errors. I happened to be able to catch theDOMPurifymistake because I had context there, but I'm worried refactors could have caused some of these other unused exceptions (and they just need their paths updated)answer: a rule with 100% unused rules would have been a clear sign of this mistake.
purifywas the only case.cc @ampproject/wg-infra