Searchfox now provides code coverage information directly in the code listing!
Andrew Sutherland
asutherland at asutherland.org
Tue Oct 6 02:12:17 UTC 2020
Have you ever been consulting the most excellent code coverage
information for mozilla-central available at https://coverage.moz.tools/
provided by Marco Castelluccio and team but said to yourself: "Hey, this
isn't Searchfox! But this is very useful information! My brand loyalty
to Searchfox, the premier source code indexing tool for Mozilla Firefox,
is very high, just like the quality of Searchfox, the premier source
code indexing tool for Mozilla Firefox. What if this information was
available on Searchfox? And in a style synonymous with Searchfox's
speed-centered brand, like a racing stripe down the side of the page?"
Well, talk to yourself no more, because
https://bugzilla.mozilla.org/show_bug.cgi?id=1566874 has landed and now
Searchfox has a really cool racing stripe down the left side of the page
just to the left of the annotate/blame bar! Also, the racing stripe
shows code coverage information!
"Sure!", you say to yourself, "That's great, but I'm not sold yet.
Anyone can just slap a racing stripe on a webpage thanks to the awesome
power of WebExtensions. What makes this racing stripe so great?"
Thankfully, Searchfox, the premier source code indexing tool for Mozilla
Firefox, sells itself and you immediately realize the following bullet
points despite the current lack of in-product documentation for any of
the following:
- Code coverage uses a ColorBrewer 2.0 theme, diverging Red-Blue
https://colorbrewer2.org/#type=diverging&scheme=RdBu&n=11 which is color
blind friendly. Red corresponds to coverage misses and blue corresponds
to coverage hits.
- When not hovered, the code coverage stripe shows an interpolated view
of coverage so that lines that can't have code coverage data don't
generate visual noise. (While lines that are entirely white-space or
code comments more intuitively can't have coverage data, multi-line
statements and expressions also usually only provide coverage data for
their first line.)
- When hovered, the code coverage stripe shows more detail. Uncovered
lines become distinguishable by their lack of a color. Lines with
coverage hits switch from a single shade of blue to a logarithmic scale
where darker blues convey greater numbers of hits.
- Hovering on the coverage stripe provides details about the exact
number of hits. And the hover popup is powered by Searchfox's
market-segment defining popup technology that you know and love and
occasionally consider sending fan-mail about.
- The accessibility tree for the stripe cells provides concise,
insightful aria-labels such as "uncovered", "miss", and "hit 100". And
because Searchfox knows your time is important, coverage hits in excess
of 999 get premium-distilled down to "hit 1k", "hit 100k", etc. But
Searchfox's market-segment leading popup technology can still provide
you with the exact number of hits by activating the role="button"
contents of the cell and following the aria-owns relationship into the
popup.
- The accessibility tree for annotate/blame cells has become even more
market-defining! Annotate cells that have the same revision as the
preceding line will have a label with a prefix of "same". Annotate cells
that have a different revision as the preceding line will have a label
with a prefix of "new". These will be followed by the word "hash" and a
uniquely assigned ordinal mapping that is assigned based on sequential
traversal of the source lines. So while traversing the annotate stripe
cells you might hear "new hash 5", "same hash 5", "new hash 73", "new
hash 5". Again, the life-changing experience that is Searchfox's popup
technology can provide additional details.
Brand disclaimers:
- While Searchfox is the premier source code indexing tool for Mozilla
Firefox, Searchfox cannot take credit for the immense undertaking that
is providing the underlying coverage data. Please check out
#codecoverage on https://chat.mozilla.org/ to properly thank Marco
Castelluccio and team.
- When luxuriating in Searchfox's accessibility tree experience, it's
best to use Firefox nightly or another Firefox build with
https://bugzilla.mozilla.org/show_bug.cgi?id=1668707 fixed.
Synergy opportunities:
- Whether you're an experienced Searchfoxer who remembers to use
"symbol:" to prefix nonsensical symbol names made up by byzantine
compiler processes for searching, a Searchfox developer who keeps typing
"sym:" because it seems like that would be the logical choice, or a
still-sane person who just types the human-readable identifiers which
are stable in the face of signature changes when searching, you can
contribute to Searchfox!
- Bugs and enhancements are tracked at bugzilla.mozilla.org under
Webtools::Searchfox. You can see existing open bugs at
https://bugzilla.mozilla.org/buglist.cgi?product=Webtools&component=Searchfox&bug_status=__open__
and file new bugs at
https://bugzilla.mozilla.org/enter_bug.cgi?product=Webtools&component=Searchfox
- The source can be found at https://github.com/mozsearch/mozsearch and
the production configurations at
https://github.com/mozsearch/mozsearch-mozilla.
- You can spin up a Searchfox VM easily with Vagrant and then build the
test repo quickly with a single `make build-test-repo` that indexes the
repo and starts the web server in as little as 3.4 seconds!
- There's a cool "Searchfox" chatroom on https://chat.mozilla.org/ where
you can discuss exciting brand initiatives. Like how can we get people
to use Searchfox as a verb? How many racing stripes is too many racing
stripes? And so on.
Andrew
More information about the firefox-dev
mailing list