buf icon indicating copy to clipboard operation
buf copied to clipboard

WIP: Add STABLE_PACKAGE_NO_IMPORT_UNSTABLE lint rule

Open bufdev opened this issue 1 year ago • 0 comments

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:

  1. If a.proto imports b.proto, and a.proto has package a.v1:
  • If b.proto has package foo, no failure - cannot determine package stability.
  • If b.proto has package foo.v1, no failure - stable imports stable.
  • If b.proto has package foo.v1beta1, failure - stable imports unstable.
  1. If a.proto has package a:
  • No failure ever - cannot determine package stability.
  1. If a.proto has package a.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.

bufdev avatar May 23 '24 15:05 bufdev