snaps
snaps copied to clipboard
feat: Detect unused permissions in Snaps CLI
This adds unused permission detection for handlers to the Snaps CLI. It will detect two cases:
- The Snap uses a certain permission, but does not export a handler for it.
- The Snap exports a handler, but does not request permission for it.
Unfortunately due to how it works, it did require some refactors to the CLI:
- We no longer use the Webpack plugin for manifest validation. The logic is now reused between the
buildandmanifestcommands, which calls the manifest validation function insnaps-utilsdirectly. - Eval must run in order to detect unused permissions, so it's now run in the
manifestcommand as well.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.13%. Comparing base (
4acb5c3) to head (054ca79). Report is 2 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #3335 +/- ##
==========================================
+ Coverage 98.12% 98.13% +0.01%
==========================================
Files 399 400 +1
Lines 10961 11027 +66
Branches 1725 1738 +13
==========================================
+ Hits 10755 10821 +66
Misses 206 206
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.