buf
buf copied to clipboard
WIP: Add STABLE_PACKAGE_NO_IMPORT_UNSTABLE lint rule
I'm not yet sure if we want to add this into mainline. Opening this for discussion.
This is re: https://github.com/bufbuild/buf/issues/2986.
This adds a STABLE_PACKAGE_NO_IMPORT_UNSTABLE lint rule, with no category, that will produce a lint failure if an stable package imports a file with an unstable package. For example:
- If
a.protoimportsb.proto, anda.protohas packagea.v1:
- If
b.protohas packagefoo, no failure - cannot determine package stability. - If
b.protohas packagefoo.v1, no failure - stable imports stable. - If
b.protohas packagefoo.v1beta1, failure - stable imports unstable.
- If
a.protohas packagea:
- No failure ever - cannot determine package stability.
- If
a.protohas packagea.v1beta1:
- No failure ever - package is unstable, does not matter what it imports.
If we do decide to go ahead with this, this PR:
- Needs some discussion as to the rule name.
- Needs testing.