Skip to content

Commit de8904d

Browse files
committed
Docs update and format
1 parent 96a3d32 commit de8904d

File tree

4 files changed

+10
-61
lines changed

4 files changed

+10
-61
lines changed

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
#
14+
#
1515
workspace(name = "rules_buf")
1616

1717
load("//buf:repositories.bzl", "rules_buf_dependencies", "rules_buf_toolchains")

buf/internal/breaking.bzl

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,9 @@ load("@rules_proto//proto:defs.bzl", "ProtoInfo")
1818
load(":plugin.bzl", "protoc_plugin_test")
1919

2020
_DOC = """
21-
This checks protocol buffers for breaking changes using `buf breaking`.
22-
For an overview of breaking change detection using buf please refer: https://docs.buf.build/breaking/overview.
21+
`buf_breaking_test` is a test rule that checks one or more `proto_library` targets for breaking changes.
2322
24-
**NOTE**:
25-
In order to truly check breaking changes this rule should be used to check all `proto_library` targets that come under a [buf module](https://docs.buf.build/bsr/overview#module).
26-
Using unique test targets for each `proto_library` target checks each `proto_library` target in isolation.
27-
Checking targets/packages in isolation has the obvious caveat of not being able to detect when an entire package/target is removed/moved.
28-
29-
**Gazelle**
30-
31-
The [gazelle extension](/gazelle/buf/README.md) can be used generate this rule. It supports generating once for buf module and also at a bazel package level.
32-
33-
**Example**
34-
35-
This rule depends on `proto_library` rule.
36-
37-
```starlark
38-
load("@rules_buf//buf:defs.bzl", "buf_breaking_test")
39-
load("@rules_proto//proto:defs.bzl", "proto_library")
40-
41-
proto_library(
42-
name = "foo_proto",
43-
srcs = ["foo.proto"],
44-
)
45-
46-
buf_breaking_test(
47-
name = "foo_proto_breaking",
48-
# Image file to check against. Please refer to https://docs.buf.build/reference/images.
49-
against = "@build_buf_foo_foo//:file",
50-
targets = [":foo_proto"],
51-
config = ":buf.yaml",
52-
)
53-
```
23+
For more info please refer to the [`buf_breaking_test` section](https://docs.buf.build/build-systems/bazel#buf-lint-test) of the docs.
5424
"""
5525

5626
_TOOLCHAIN = str(Label("//tools/protoc-gen-buf-breaking:toolchain_type"))

buf/internal/lint.bzl

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,9 @@ load("@rules_proto//proto:defs.bzl", "ProtoInfo")
1818
load(":plugin.bzl", "protoc_plugin_test")
1919

2020
_DOC = """
21-
This lints protocol buffers using `buf lint`.
22-
For an overview of linting using buf please refer: https://docs.buf.build/lint/overview.
21+
`buf_lint_test` is a test rule that lints one or more `proto_library` targets.
2322
24-
**Gazelle**
25-
26-
The [gazelle extension](/gazelle/buf/README.md) can be used generate this rule.
27-
28-
**Example**
29-
30-
This rule depends on `proto_library` rule.
31-
32-
```starlark
33-
load("@rules_buf//buf:defs.bzl", "buf_lint_test")
34-
load("@rules_proto//proto:defs.bzl", "proto_library")
35-
36-
proto_library(
37-
name = "foo_proto",
38-
srcs = ["pet.proto"],
39-
deps = ["@go_googleapis//google/type:datetime_proto"],
40-
)
41-
42-
buf_lint_test(
43-
name = "foo_proto_lint",
44-
targets = [":foo_proto"],
45-
config = "buf.yaml",
46-
)
47-
```
23+
For more info please refer to the [`buf_lint_test` section](https://docs.buf.build/build-systems/bazel#buf-lint-test) of the docs.
4824
"""
4925

5026
_TOOLCHAIN = str(Label("//tools/protoc-gen-buf-lint:toolchain_type"))
@@ -56,7 +32,7 @@ def _buf_lint_test_impl(ctx):
5632
})
5733
files_to_include = []
5834
if ctx.file.config != None:
59-
files_to_include.append(ctx.file.config)
35+
files_to_include.append(ctx.file.config)
6036
return protoc_plugin_test(ctx, proto_infos, ctx.executable._protoc, ctx.toolchains[_TOOLCHAIN].cli, config, files_to_include)
6137

6238
buf_lint_test = rule(

buf/internal/repo.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "update_attrs")
1818

1919
_DOC = """
20-
The `buf_dependencies` rule downloads and generates `proto_library` targets for buf modules hosted on the BSR.
20+
`buf_dependencies` is a [repository rule](https://bazel.build/rules/repository_rules) that downloads one or more modules from the [BSR](https://docs.buf.build/bsr/introduction) and generates build files using Gazelle.
21+
[Setup Gazelle](https://github.com/bazelbuild/bazel-gazelle#setup) to use this rule.
22+
23+
For more info please refer to the [`buf_dependencies` section](https://docs.buf.build/build-systems/bazel#buf-dependencies) of the docs.
2124
"""
2225

2326
def _executable_extension(ctx):

0 commit comments

Comments
 (0)