Skip to content

automation: add regex search and replace campaign

Administrator requested to merge rvt/automation-regex-search-replace into master

Created by: rvantonder

Basic regex search replace support. We rely on search/searcher to find repos and files that contain the regex. This introduces two key limitations:

(1) We don't know if search will return all matches. (1) We append scopeQuery with count:10000 so that it will try hard to find them all and not time out early. (2) We append the scopeQuery with the actual regex pattern, because otherwise search is likely to return just a truncated list of files containing the match, whereas we want all file matches. count, it appears, is not honored for finding matching files.

This implies two things that make this functionality brittle:

  • If a user enters count:XXX in the scopeQuery for some reason, they will see an error that they cannot specify this twice
  • If the user enters a search pattern in the scopeQuery it will mess up what's being searched.

I wish we had a robust definition and parser for scopeQuery to get its constituent parts to then validate. I don't want to attempt using the existing stuff and would rather use this opportunity to move away from it a la RFC 75. It'd be ideal if we can design our search queries in a JSON schema for that is customizable based on the kind of search we perform and then (a) use that to compute search results and (b) render the UI input so that it doesn't create all these complications. Exactly like @felixfbecker & co's. solution for campaign inputs, but for search query.

Merge request reports

Loading