Expand Code Review custom instruction matching pattern to accept unions
What does this MR do and why?
Expand Code Review custom instruction matching pattern to accept unions.
This change addresses the limitation observed in #517386 (comment 3386146047).
References
Resolves #601206 (closed)
How to set up and validate locally
You can execute the following commands in a Rails console before and after these changes and compare the differences:
instruction = Gitlab::Duo::CodeReview::CustomInstruction.new(
name: "Name",
include_patterns: ["**/*.{c,h}"], # <- before these changes extended globs with unions were not accepted
exclude_patterns: [],
location: "",
instructions: ""
)
instruction.apply_to?("foo.c") # before: false | now: true
instruction.apply_to?("bar.h") # before: false | now: true
instruction.apply_to?("baz.d") # before: false | now: falseMR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Kai Armstrong