Recipes - cruisinme30/spelunk GitHub Wiki

Ready-made queries for everyday jobs. Copy one, change the names, and press ↵. Each links to the reference for the operator doing the work.

Jump to: Find code · Dig through history · Look back at a release · Refactor safely · Review and ownership · Keep watch

Find code

Question Query
Where is RetryPolicy defined? symbol: symbol:RetryPolicy
Every interface whose name has "Retry" kind: kind:interface symbol:Retry
Every Go function whose name has "parse" kind: kind:function parse lang:go
Where RetryPolicy is used, not defined ref: ref:RetryPolicy
Every call of backoff, however its arguments are laid out struct: struct:"backoff(:[call], tries=:[n])"
The async functions decorated with @retry Regex across lines /@retry\(.*\)\n\s*async def/
A file whose name you half remember Fuzzy names: match:fuzzy usrsvc finds UserService.ts
Python files with "retry" in the name type: type:file language:python retry
Lines that mention retry, without the files named after it content: content:retry
What the comments and docstrings say about retrying in: retry in:comments
The error message users see, not the code around it in: "budget spent" in:strings
The functions where retrying actually happens, not in comments or quoted text, outside tests and generated files in: kind:function content:retry in:code -is:test -is:generated
Retries outside the tests is: retry -is:test
Timeouts outside vendored code, either spelling Logic (timeout OR time_out) -file:vendor/

Dig through history

Question Query
Who introduced retry_policy? type: type:added retry_policy
When did retry_after go away? type: type:removed retry_after
What did Jane change in the tests? author: author:jane is:test
Tests Jane changed this month that mention a timeout since: author:jane since:30d file:_test\.py$ timeout
Flaky-test fixes in the checkout repo message: message:"fix flaky" repo:web
Jane's Python test changes in six months, about timeouts or retries, outside vendor author:jane file:.*test\.py$ (timeout OR retry) -file:vendor/ since:6m

Look back at a release

Question Query
Where retry_after was used in the v1.0.0 release, deleted files included at: at:v1.0.0 retry_after
How RetryPolicy looked six months ago at: at:6m RetryPolicy

Open a result to see the file as it was, read-only, and Compare with now for what changed since.

Refactor safely

Question Query
Rename RetryPolicy without touching generated or copied-in code is: RetryPolicy -is:generated -is:vendored, then Replace
TODOs in what you haven't committed yet is: is:changed TODO
Retries in the files open in your editor is: is:open retry

To rename, open the Replace row (⌥⌘F), type the new name and check every match in the preview; Replace all makes one undoable edit. With a /regex/ term, $1 in the replacement inserts what the first group matched. See Replace.

Review and ownership

Question Query
Retries in the files the payments team owns owner: retry owner:payments-core
Files nobody owns yet owner: type:file owner:none
Results in one repo only repo: repo:payments retry

Keep watch

  • Pin a query you run often: the ☆ on a recent query keeps it at the top of the empty box. See pinned queries.
  • Hear about new commits: pin a query that searches commits, such as message:"fix flaky", and click its bell. New matching commits by others get a count on the pin and a notification. See query watches.

Next: Query Language: every operator on one screen.