Dig for gold in Drupal Contrib code

Sometimes you need to break some code to fix a feature. When that happens in Drupal Core it impacts the whole ecosystem of modules and themes. We've been getting better, good even, with backward compatibility over the years. Sometimes having an idea of how much a function or a service is used in contrib can help prioritize tasks. When you wanted to search contrib code you had two solutions:

  • Use Drupal's Gitlab search: kind of slow, a lot of noise in the results, duplicated core files, D8 modules, etc.
  • A pro-russian website I won't link to, but used for many years when we didn't have anything else.

Neither are great solutions. So why not make one?

New contrib search

Instead of complaining I had the itch to fix it, that's how Drupal contrib code search showed up. What are the differences? 

 

New drupal contrib search interface

 

  1. The search index only contains modules and themes that are Drupal 10+ compatible, and for each module only the branches that are compatible with Drupal 10+, and that served to create a release. No more noise in the results matches.
  2. For each match it show additional data from the module:
    1. Which branches contain the search result
    2. For each branch, the core version requirements
    3. Associated usage/installs of the version
    4. Show a shield when the module is covered by the security team
  3. Fast. 
  4. Crawler friendly

You can use a dedicated API to point your LLMs tools to search for Drupal Contrib code, ask something like:

Use the search endpoint at https://api.tresbien.tech/v1/search, find all the @deprecated methods from the drupal repository. List the top 5 contrib modules using deprecated methods found before. Show a sample of deprecated method calls, summarize in a table the deprecations and associated modules and their release usage

And eventually it'll figure out a result (answer is apparently: bootstrap, webform, vbo, and a few dozen more). 

Have a look at the Drupal contrib code search tool.