Goal

Ability to create custom rules inside yaml configuration with fast execution.

Variants

  1. Lua
  2. CEL
  3. WASM

Concrete use case

User creates if rules for certain errors.

  custom-rules:
  - message: "files inside dir/ can't be modified, only deletion allowed"
    if: "diff.find(`^dir/.*$`).Additions > 0"
  - message: "module `test_utils` can be imported only inside test files"
    if: "diff.contains(`test_utils`, addition)"
  

How to make useful reporting

cel-go problems

It possible to use native types by ext.NativeTypes(reflect.ValueOf(SomeStruct{})) But struct fields in TitleCamelCase.

All macros in lower case, so it is good to have lower case fields names.

Options:

  1. Create patch to cel-go with customizable field reflection
  2. Copy and edit ext.NativeTypes
  3. Use protobuf generated structure
  4. Use type provider wrapper to rename field names