Files
qdrant/tools/ast-grep/rules/no-default-batch-methods.yml
Luis Cossío d32f738c1f [CI] Enforce no default impl for batch methods (#9939)
* [AI] Add ast-grep rule to avoid default batch trait methods

* reword

* fix `FullTextIndexRead::check_match_batch`

* move to `tools/ast-grep/`

* Add tests

* pin ast-grep version

* fix spelling
2026-07-23 14:18:19 -04:00

25 lines
741 B
YAML

id: no-default-batch-methods
language: rust
severity: error
message: Default batch method in trait
note: |-
Batch methods on traits must be mandatory so that every implementation makes
an explicit choice. If the streaming fallback is the right body for some
implementers, move it into a `default_*` free function next to the trait and
call it explicitly from each of them.
rule:
# Methods with a body are `function_item`s;
# body-less signatures are `function_signature_item`s.
kind: function_item
has:
field: name
regex: batch
inside:
kind: trait_item
stopBy: end
not:
has:
field: name
# The universal_io primitives keep their intentional default bodies.
regex: Universal