Let's say you want to scan for C++ forward declarations in a codebase. Specifically the Chromium codebase.
This Gist captures some details about how to do that with ast-grep. You may also want jq for a few of the commands.
- Make sure you have
ast-grepandjqinstalled - Copy
sgconfig.ymlto the root of the Chromium repo - Create a folder at the root of the Chromium repo called
ast-grep-rules - Copy
forward-declaration.yamlinto that folder