aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:16:14 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:16:14 +0000
commitd735569ec113aba4d34712daef263e4178e50653 (patch)
tree788e2904bb2e5768d07e72840ba679049e01ef16
parent47d8b8ffb915fc29e03c29e89b888015632ac446 (diff)
parent85b0f239303220d902ad919ff27d2da475fc12e2 (diff)
downloadstardoc-android14-mainline-sdkext-release.tar.gz
Snap for 10453563 from 85b0f239303220d902ad919ff27d2da475fc12e2 to mainline-sdkext-releaseaml_sdk_341510000aml_sdk_341410000aml_sdk_341110080aml_sdk_341110000aml_sdk_341010000aml_sdk_340912010android14-mainline-sdkext-release
Change-Id: Ibf4455f71cdb1ca46ad60f75ee2cf1f9bd0020ca
-rw-r--r--.bazelci/presubmit.yml20
-rw-r--r--.bazelrc2
-rw-r--r--BUILD29
-rw-r--r--CHANGELOG.md67
-rw-r--r--CODEOWNERS2
-rw-r--r--METADATA13
-rw-r--r--README.md13
-rw-r--r--WORKSPACE63
-rw-r--r--distro/BUILD54
-rw-r--r--docs/advanced_stardoc_usage.md49
-rw-r--r--docs/contributing.md20
-rw-r--r--docs/future_plans.md70
-rw-r--r--docs/generating_stardoc.md12
-rw-r--r--docs/getting_started_stardoc.md21
-rw-r--r--docs/maintainers_guide.md92
-rw-r--r--docs/stardoc_rule.md34
-rw-r--r--setup.bzl14
-rw-r--r--stardoc/BUILD37
-rw-r--r--stardoc/proto/BUILD14
-rw-r--r--stardoc/proto/stardoc_output.proto200
-rwxr-xr-xstardoc/renderer_binary.jarbin8979229 -> 9778587 bytes
-rw-r--r--stardoc/stardoc.bzl14
-rwxr-xr-xstardoc/stardoc_binary.jarbin9426133 -> 14449595 bytes
-rw-r--r--stardoc/templates/html_tables/aspect.vm62
-rw-r--r--stardoc/templates/html_tables/func.vm51
-rw-r--r--stardoc/templates/html_tables/header.vm2
-rw-r--r--stardoc/templates/html_tables/provider.vm30
-rw-r--r--stardoc/templates/html_tables/rule.vm44
-rw-r--r--stardoc/templates/markdown_tables/aspect.vm10
-rw-r--r--stardoc/templates/markdown_tables/func.vm22
-rw-r--r--stardoc/templates/markdown_tables/header.vm2
-rw-r--r--stardoc/templates/markdown_tables/provider.vm8
-rw-r--r--stardoc/templates/markdown_tables/rule.vm8
-rw-r--r--test/BUILD2
-rw-r--r--test/stardoc_test.bzl32
-rwxr-xr-xtest/testdata/android_basic_test/golden.md16
-rw-r--r--test/testdata/android_basic_test/input.bzl3
-rwxr-xr-xtest/testdata/angle_bracket_test/golden.md74
-rw-r--r--test/testdata/angle_bracket_test/input.bzl31
-rwxr-xr-xtest/testdata/apple_basic_test/golden.md16
-rw-r--r--test/testdata/apple_basic_test/input.bzl6
-rwxr-xr-xtest/testdata/aspect_test/golden.md30
-rw-r--r--test/testdata/aspect_test/input.bzl2
-rwxr-xr-xtest/testdata/attribute_defaults_test/golden.md70
-rw-r--r--test/testdata/attribute_defaults_test/input.bzl6
-rwxr-xr-xtest/testdata/attribute_types_test/golden.md32
-rw-r--r--test/testdata/attribute_types_test/input.bzl1
-rwxr-xr-xtest/testdata/cc_api_test/golden.md26
-rw-r--r--test/testdata/cc_api_test/input.bzl6
-rwxr-xr-xtest/testdata/config_apis_test/golden.md28
-rw-r--r--test/testdata/config_apis_test/input.bzl5
-rwxr-xr-xtest/testdata/cpp_basic_test/golden.md16
-rw-r--r--test/testdata/cpp_basic_test/input.bzl4
-rw-r--r--test/testdata/fakedeps/dep.bzl5
-rw-r--r--test/testdata/filter_rules_test/dep.bzl3
-rwxr-xr-xtest/testdata/filter_rules_test/golden.md22
-rw-r--r--test/testdata/filter_rules_test/input.bzl2
-rwxr-xr-xtest/testdata/function_basic_test/golden.md70
-rw-r--r--test/testdata/function_basic_test/input.bzl25
-rwxr-xr-xtest/testdata/generated_bzl_test/golden.md12
-rwxr-xr-xtest/testdata/html_tables_template_test/golden.md301
-rw-r--r--test/testdata/html_tables_template_test/input.bzl4
-rw-r--r--test/testdata/input_template_test/aspect.vm4
-rw-r--r--test/testdata/input_template_test/func.vm2
-rwxr-xr-xtest/testdata/input_template_test/golden.md16
-rw-r--r--test/testdata/input_template_test/input.bzl4
-rw-r--r--test/testdata/input_template_test/provider.vm2
-rw-r--r--test/testdata/input_template_test/rule.vm2
-rwxr-xr-xtest/testdata/java_basic_test/golden.md16
-rw-r--r--test/testdata/java_basic_test/input.bzl8
-rw-r--r--test/testdata/local_repository_test/BUILD12
-rwxr-xr-xtest/testdata/local_repository_test/golden.md12
-rw-r--r--test/testdata/local_repository_test/input.bzl8
-rwxr-xr-xtest/testdata/macro_kwargs_test/golden.md46
-rw-r--r--test/testdata/macro_kwargs_test/input.bzl6
-rwxr-xr-xtest/testdata/misc_apis_test/golden.md36
-rw-r--r--test/testdata/misc_apis_test/input.bzl14
-rwxr-xr-xtest/testdata/multi_level_namespace_test/golden.md40
-rw-r--r--test/testdata/multi_level_namespace_test/input.bzl2
-rw-r--r--test/testdata/multi_level_namespace_test_with_whitelist/golden.md20
-rw-r--r--test/testdata/multi_level_namespace_test_with_whitelist/input.bzl2
-rw-r--r--test/testdata/multiple_files_test/dep.bzl2
-rwxr-xr-xtest/testdata/multiple_files_test/golden.md40
-rw-r--r--test/testdata/multiple_files_test/inner_dep.bzl2
-rw-r--r--test/testdata/multiple_files_test/input.bzl1
-rwxr-xr-xtest/testdata/multiple_rules_test/golden.md36
-rw-r--r--test/testdata/multiple_rules_test/input.bzl3
-rwxr-xr-xtest/testdata/namespace_test/golden.md32
-rw-r--r--test/testdata/namespace_test/input.bzl6
-rw-r--r--test/testdata/proto_format_test/golden.rawbin527 -> 531 bytes
-rw-r--r--test/testdata/proto_format_test/input.bzl3
-rwxr-xr-xtest/testdata/provider_basic_test/golden.md20
-rw-r--r--test/testdata/provider_basic_test/input.bzl2
-rw-r--r--test/testdata/providers_for_attributes_test/dep.bzl1
-rwxr-xr-xtest/testdata/providers_for_attributes_test/golden.md36
-rw-r--r--test/testdata/providers_for_attributes_test/input.bzl5
-rwxr-xr-xtest/testdata/py_rule_test/golden.md20
-rw-r--r--test/testdata/py_rule_test/input.bzl6
-rwxr-xr-xtest/testdata/repo_rules_test/golden.md13
-rw-r--r--test/testdata/same_level_file_test/dep.bzl2
-rwxr-xr-xtest/testdata/same_level_file_test/golden.md12
-rwxr-xr-xtest/testdata/simple_test/golden.md16
-rw-r--r--test/testdata/simple_test/input.bzl2
-rwxr-xr-xtest/testdata/struct_default_value_test/golden.md16
-rw-r--r--test/testdata/struct_default_value_test/input.bzl1
-rwxr-xr-xtest/testdata/unknown_name_test/golden.md8
-rw-r--r--test/testdata/unknown_name_test/input.bzl2
-rwxr-xr-xupdate-release-binary.sh8
-rw-r--r--version.bzl16
109 files changed, 1771 insertions, 721 deletions
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index a4dd49c..8ad959e 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -1,24 +1,24 @@
---
platforms:
- ubuntu1604:
+ ubuntu1804:
build_targets:
- - "..."
+ - "//..."
test_targets:
- - "..."
- ubuntu1804:
+ - "//..."
+ ubuntu2004:
build_targets:
- - "..."
+ - "//..."
test_targets:
- - "..."
+ - "//..."
macos:
build_targets:
- - "..."
+ - "//..."
test_targets:
- - "..."
+ - "//..."
windows:
build_targets:
- - "..."
+ - "//..."
test_targets:
- - "..."
+ - "//..."
buildifier: latest
diff --git a/.bazelrc b/.bazelrc
new file mode 100644
index 0000000..d4d79d2
--- /dev/null
+++ b/.bazelrc
@@ -0,0 +1,2 @@
+build --java_language_version=11
+build --tool_java_language_version=11
diff --git a/BUILD b/BUILD
index c8dedb1..00af466 100644
--- a/BUILD
+++ b/BUILD
@@ -1,6 +1,9 @@
licenses(["notice"])
-exports_files(["LICENSE"])
+exports_files([
+ "LICENSE",
+ "WORKSPACE",
+])
filegroup(
name = "stardoc_rule_doc",
@@ -8,3 +11,27 @@ filegroup(
srcs = ["docs/stardoc_rule.md"],
visibility = ["//test:__pkg__"],
)
+
+# Sources needed for release tarball.
+filegroup(
+ name = "distro_srcs",
+ srcs = [
+ "AUTHORS",
+ "BUILD",
+ "CHANGELOG.md",
+ "CONTRIBUTORS",
+ "LICENSE",
+ "//stardoc:distro_srcs",
+ "//stardoc/proto:distro_srcs",
+ ] + glob(["*.bzl"]),
+ visibility = ["//:__subpackages__"],
+)
+
+# Binaries needed for release tarball.
+filegroup(
+ name = "distro_bins",
+ srcs = [
+ "//stardoc:distro_bins",
+ ],
+ visibility = ["//:__subpackages__"],
+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..2118959
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,67 @@
+## Release 0.5.3
+
+Bugfix release: fixes angle bracket escaping and a crash on labels with `@@`
+
+**Contributors**
+
+Alexandre Rostovtsev, Jon Shea
+
+## Release 0.5.2
+
+Bugfix release: fixes crash with `config_common.toolchain_type`.
+
+**Contributors**
+
+Alexandre Rostovtsev, Keith Smiley
+
+## Release 0.5.1
+
+Bugfix release: minor fixes, including a fix for build failure due to missing zlib version.
+
+**Contributors**
+
+aiuto, Alexandre Rostovtsev, Brian Silverman, Casey, Xùdōng Yáng
+
+## Release 0.5.0
+
+This release includes many fixes for Stardoc's markdown output, plus:
+
+**New Features**
+
+- Raw protobuf output via `format = "proto"` (#20)
+- Stardoc now outputs documentation for macro returns and deprecations (#75)
+ as well as module (file) docstrings (#100)
+
+**Contributors**
+
+Alexandre Rostovtsev, Alex Eagle, Andrew Z Allen, Chris Rebert, c-parsons, Ivo
+List, Jon Brandvein, Laurent Le Brun, Max Vorobev, pbatg, Philipp Wollermann,
+Samuel Giddins, Thomas Van Lenten, Tiago Quelhas, Xùdōng Yáng, Yiting Wang
+
+## Release 0.4.0
+
+First release of **Stardoc** under the new repository location
+[bazelbuild/stardoc](https://github.com/bazelbuild/stardoc). Please use this
+repository for future Stardoc releases instead of its old location. See
+[Getting Started](https://github.com/bazelbuild/stardoc/blob/4378e9b6bb2831de7143580594782f538f461180/docs/getting_started_stardoc.md)
+for updated setup information.
+
+There are **many** new features since the last release. A summary of major
+features:
+
+- Changed the default Stardoc output format to use pure-markdown tables
+ instead of HTML tables. This output format is fully compatible with markdown
+ formatting constructs. For example, use `**bold**` instead of `<b>bold</b>`.
+ The `<`. and `>` characters are escaped in this output format.
+- Stardoc now supports custom formatting. See
+ [Custom Output documentation](https://github.com/bazelbuild/stardoc/blob/4378e9b6bb2831de7143580594782f538f461180/docs/advanced_stardoc_usage.md#custom-output)
+ for details.
+- `aspect()` definitions are now documented by Stardoc.
+- Module definitions (structs which combine series of functions in a
+ 'namespace') are now documetned by Stardoc.
+- Attribute default-value information is now included in output.
+
+**Huge Thanks to [kendalllaneee](https://github.com/kendalllaneee) and
+[blossommojekwu](https://github.com/blossommojekwu) for their work on many of
+the features in this release.**
+
diff --git a/CODEOWNERS b/CODEOWNERS
index d7feba7..9858bec 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -1 +1 @@
-* @c-parsons @laurentlb @jin
+* @brandjon @tetromino
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..1b57d0d
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,13 @@
+name: "Stardoc"
+description:
+ "Stardoc: Starlark Documentation Generator"
+
+third_party {
+ url {
+ type: GIT
+ value: "https://github.com/bazelbuild/stardoc"
+ }
+ version: "0.5.3"
+ last_upgrade_date { year: 2022 month: 11 day: 8 }
+ license_type: NOTICE
+}
diff --git a/README.md b/README.md
index 5cff3d9..5b6401b 100644
--- a/README.md
+++ b/README.md
@@ -21,10 +21,21 @@ page per `.bzl`file.
* Stardoc [rule reference](docs/stardoc_rule.md).
* How to [contribute to Stardoc](docs/contributing.md)
-## Skydoc deprecation
+## Project Status
+
+### Skydoc deprecation
Stardoc is a replacement for the **deprecated** "Skydoc" documentation generator.
See [Skydoc Deprecation](docs/skydoc_deprecation.md) for
details on the deprecation and migration details.
+### Future plans
+
+See our [future plans](docs/future_plans.md) for refactoring Stardoc to be more consistent with how Bazel evaluates .bzl files, and what it means for maintenance of this project.
+
+### Maintainer's guide
+
+See the [maintaner's guide](docs/maintainers_guide.md) for instructions for
+cutting a new release.
+
diff --git a/WORKSPACE b/WORKSPACE
index 3de48c9..048949d 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -1,20 +1,38 @@
-workspace(name = "io_bazel_skydoc")
+workspace(name = "io_bazel_stardoc")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(":setup.bzl", "stardoc_repositories")
stardoc_repositories()
-#######################################################################
-##### MOST USERS SHOULD NOT NEED TO COPY ANYTHING BELOW THIS LINE #####
-#######################################################################
+### INTERNAL ONLY - lines after this are not included in the release packaging.
+#
+# Include dependencies which are only needed for development of Stardoc here.
+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
# Needed for generating the Stardoc release binary.
git_repository(
name = "io_bazel",
- commit = "5eeccd8a647df10d154d3b86e9732e7f263c96db", # Oct 7, 2019
+ commit = "901c75e459d737220cb8e29649c1b6ba24e2221d", # Sep 27, 2022
remote = "https://github.com/bazelbuild/bazel.git",
+ shallow_since = "1664304093 -0700",
+)
+
+# The following binds are needed for building protobuf java libraries.
+bind(
+ name = "guava",
+ actual = "@io_bazel//third_party:guava",
+)
+
+bind(
+ name = "gson",
+ actual = "@io_bazel//third_party:gson",
+)
+
+bind(
+ name = "error_prone_annotations",
+ actual = "@io_bazel//third_party:error_prone_annotations",
)
# Needed only because of java_tools.
@@ -30,36 +48,33 @@ http_archive(
# Needed as a transitive dependency of @io_bazel
git_repository(
- name = "com_google_protobuf",
- commit = "7b28271a61a3da0a37f6fda399b0c4c86464e5b3", # 2018-11-16
- remote = "https://github.com/protocolbuffers/protobuf.git",
-)
-
-# Needed as a transitive dependency of @io_bazel
-git_repository(
name = "rules_python",
- remote = "https://github.com/bazelbuild/rules_python.git",
commit = "4b84ad270387a7c439ebdccfd530e2339601ef27",
+ remote = "https://github.com/bazelbuild/rules_python.git",
+ shallow_since = "1564776078 -0400",
)
-# Needed as a transitive dependency of @io_bazel
+# Needed for //distro:__pkg__ and as a transitive dependency of @io_bazel
http_archive(
name = "rules_pkg",
- sha256 = "5bdc04987af79bd27bc5b00fe30f59a858f77ffa0bd2d8143d5b31ad8b1bd71c",
+ sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/rules_pkg-0.2.0.tar.gz",
- "https://github.com/bazelbuild/rules_pkg/releases/download/0.2.0/rules_pkg-0.2.0.tar.gz",
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
+ "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
],
)
+load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
+
+rules_pkg_dependencies()
+
# Needed as a transitive dependency of @io_bazel
http_archive(
name = "rules_proto",
- sha256 = "88b0a90433866b44bb4450d4c30bc5738b8c4f9c9ba14e9661deb123f56a833d",
- strip_prefix = "rules_proto-b0cc14be5da05168b01db282fe93bdf17aa2b9f4",
+ sha256 = "9850fcf6ad40fa348e6f13b2cfef4bb4639762f804794f2bf61d988f4ba0dae9",
+ strip_prefix = "rules_proto-4.0.0-3.19.2-2",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/b0cc14be5da05168b01db282fe93bdf17aa2b9f4.tar.gz",
- "https://github.com/bazelbuild/rules_proto/archive/b0cc14be5da05168b01db282fe93bdf17aa2b9f4.tar.gz",
+ "https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0-3.19.2-2.tar.gz",
],
)
@@ -68,3 +83,9 @@ local_repository(
name = "local_repository_test",
path = "test/testdata/local_repository_test",
)
+
+load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
+
+rules_proto_dependencies()
+
+rules_proto_toolchains()
diff --git a/distro/BUILD b/distro/BUILD
new file mode 100644
index 0000000..a947465
--- /dev/null
+++ b/distro/BUILD
@@ -0,0 +1,54 @@
+load("@io_bazel_stardoc//:version.bzl", "version")
+load("@rules_pkg//:pkg.bzl", "pkg_tar")
+
+package(
+ default_visibility = ["//visibility:private"],
+)
+
+alias(
+ name = "distro",
+ actual = "stardoc-%s" % version,
+)
+
+genrule(
+ name = "distro_workspace",
+ srcs = ["//:WORKSPACE"],
+ outs = ["WORKSPACE"],
+ cmd = "sed -e '/### INTERNAL ONLY/,$$d' $(location //:WORKSPACE) >$@",
+)
+
+pkg_tar(
+ name = "distro_srcs",
+ srcs = [
+ "distro_workspace",
+ "//:distro_srcs",
+ ],
+ mode = "0644",
+ # Make it owned by root so it does not have the uid of the CI robot.
+ owner = "0.0",
+ package_dir = "",
+ strip_prefix = ".",
+)
+
+pkg_tar(
+ name = "distro_bins",
+ srcs = ["//:distro_bins"],
+ mode = "0755",
+ # Make it owned by root so it does not have the uid of the CI robot.
+ owner = "0.0",
+ package_dir = "",
+ strip_prefix = ".",
+)
+
+# Build the artifact to put on the github release page.
+pkg_tar(
+ name = "stardoc-%s" % version,
+ extension = "tar.gz",
+ # Make it owned by root so it does not have the uid of the CI robot.
+ owner = "0.0",
+ strip_prefix = ".",
+ deps = [
+ ":distro_bins.tar",
+ ":distro_srcs.tar",
+ ],
+)
diff --git a/docs/advanced_stardoc_usage.md b/docs/advanced_stardoc_usage.md
index ce3c069..24317db 100644
--- a/docs/advanced_stardoc_usage.md
+++ b/docs/advanced_stardoc_usage.md
@@ -3,6 +3,7 @@
<ul>
<li><a href="#docstring-formatting">Docstring Formatting</a></li>
<li><a href="#custom-output">Custom Output</a></li>
+ <li><a href="#proto-output">Proto Output</a></li>
</ul>
</nav>
@@ -85,3 +86,51 @@ one of the existing canonical [templates](../stardoc/templates/markdown_tables)
springboard to get started.
+<a name="proto-output"></a>
+## Proto Output
+
+Stardoc provides the option to output documentation information in raw proto
+format. You may find this useful if you need output customization beyond
+Stardoc's current custom-output-template capabilities: you might prefer to build
+your own custom output renderer binary using the data that Stardoc acquires by
+fully evaluating a Starlark file. If your changes could be incorporated into
+Stardoc, please first consider [contributing](contributing.md) instead.
+
+The proto schema may be found under
+[stardoc/proto/stardoc_output.proto](../stardoc/proto/stardoc_output.proto).
+Only the `.proto` file itself is provided (this prevents a transitive dependency on
+proto rules to support only a very-advanced usecase). We recommend using rules
+defined under
+[bazelbuild/rules_proto](https://github.com/bazelbuild/rules_proto), creating
+your own proto target using this source file, and adding it as a dependency of
+your renderer binary.
+
+To configure stardoc to output raw proto instead of markdown, use the `format`
+attribute of the [stardoc rule](stardoc_rule.md#stardoc-format). Specify `"proto"`.
+An example:
+
+```python
+stardoc(
+ name = "docs_proto_output",
+ out = "doc_output.raw",
+ input = ":my_rule.bzl",
+ deps = [":my_lib"],
+ format = "proto",
+)
+
+# Define a proto_library target to incorporate the stardoc_output_proto
+proto_library(
+ name = "stardoc_output_proto",
+ srcs = ["@io_bazel_stardoc//stardoc/proto:stardoc_output.proto"],
+)
+
+# You'll need to define your own rendering target. This might be a
+# `genrule` or your own custom rule.
+genrule(
+ name = "docs_markdown_output",
+ tools = ["my_renderer.sh"],
+ srcs = ["doc_output.raw"],
+ outs = ["doc_output.md"],
+ cmd = "$(location :my_renderer.sh) $@ $(SRCS)",
+)
+```
diff --git a/docs/contributing.md b/docs/contributing.md
index e28b11d..b2b438d 100644
--- a/docs/contributing.md
+++ b/docs/contributing.md
@@ -1,11 +1,18 @@
-We welcome your contributions! To contribute to Stardoc, fork the
+Before contributing, please see the note on our [current
+priorities](future_plans.md). In short, we're able to take bugfixes to critical
+features, but cannot guarantee that we'll be able to review new features in a
+timely manner.
+
+To contribute to Stardoc, first see the official [contributing
+notice](../CONTRIBUTING.md), then feel free to fork the
[Stardoc](https://github.com/bazelbuild/stardoc) GitHub repository and start
submitting pull requests.
In general, we prefer contributions that fix bugs or add features (as opposed to
purely stylistic, refactoring, or "cleanup" changes). Please check with us by
-opening a [GitHub Issue](https://github.com/bazelbuild/stardoc/issues) or emailing the
-[bazel-dev](https://groups.google.com/forum/#!forum/bazel-dev) mailing list.
+opening a [GitHub Issue](https://github.com/bazelbuild/stardoc/issues) or
+emailing the [bazel-dev](https://groups.google.com/forum/#!forum/bazel-dev)
+mailing list.
## Stardoc code structure
@@ -44,9 +51,4 @@ opening a [GitHub Issue](https://github.com/bazelbuild/stardoc/issues) or emaili
The current group of Stardoc core contributors are:
* [brandjon](https://github.com/brandjon)
-* [cparsons](https://github.com/c-parsons)
-* [jin](https://github.com/jin)
-* [laurentlb](https://github.com/laurentlb)
-
-
-
+* [tetromino](https://github.com/tetromino)
diff --git a/docs/future_plans.md b/docs/future_plans.md
new file mode 100644
index 0000000..cbca65d
--- /dev/null
+++ b/docs/future_plans.md
@@ -0,0 +1,70 @@
+**Last updated:** January 2021.
+
+**Summary:** We'll be redesigning how Stardoc works, and deprioritizing feature
+requests and minor bugs until that work is complete (targeting 2021 Q2).
+
+## Technical motivation
+
+Stardoc is currently the recommended tool for generating documentation of
+Starlark rules. It [replaces](skydoc_deprecation.md) *Sky*doc, the previous
+tool, which worked by evaluating .bzl files in a Python interpreter, using
+fake versions of functions from Bazel's Build Language.
+
+Mocking is an inherently problematic approach for two reasons:
+
+1. It creates a maintenance burden for the tool maintainer (us). We have to
+ensure that the mocked definitions stay up-to-date as Bazel changes. These
+include not just `rule()` and `provider()`, but also a number of other symbols
+that don't directly affect documentation but still require stubs.
+
+2. It puts a constraint on the user: All of their documented .bzl files, as
+well as all of the .bzl dependencies they transitively load, must be
+compatible with the mock evaluation. This means users must be vigilant about
+writing Starlark code that lies in the intersection of what is understood as
+valid by Bazel and by Stardoc.
+
+The Python-based Skydoc experienced an extreme version of this problem because
+it didn't even treat .bzl files as being written in the Starlark language.
+However, the Java-based Stardoc still uses mocking -- not of the Starlark
+language, but of Bazel's Build Language functions.
+
+In addition, Stardoc's mocking approach tightly integrates it with Bazel.
+Indeed much of its source code lives inside the bazelbuild/bazel repository.
+This makes refactoring and evolving the Bazel source code more difficult.
+
+While the Starlark language has a specification and several implementations,
+the Build Language is more complicated and has only one accurate
+implementation: Bazel. Any tooling that operates on BUILD and .bzl files must
+carefully consider whether it is feasible to ask Bazel for the authoritative
+information. The alternative, falling back on simulation, not only produces
+less accurate results, but ties our hands as we try to improve Bazel.
+
+## Our plans
+
+We will rewrite the part of Stardoc that extracts documentation information from
+.bzl files, so that instead of using mocking to pseudo-evaluate individual .bzl
+files, it performs a real Bazel evaluation of the workspace. Think of how `bazel
+query` is used to dump out information from Bazel's loading phase about the
+target dependency graph. Now imagine that it's extended to also dump out the
+rules and providers declared in the .bzl files used by a build, and that this
+dump also includes their docstrings.
+
+This approach intersects other work we are doing to simplify and better specify
+Bazel's loading phase, so that users have access to all sorts of information
+that was previously not readily available.
+
+Note that this new internal approach does not necessarily have to mean the
+user's workflow changes. You could still write a target in your BUILD file to
+say exactly what content you want documented and how you'd like it formatted.
+The rendering logic may very well continue to live outside of Bazel, in the
+bazelbuild/stardoc repository.
+
+## Prioritization
+
+We're aiming to explore this design in more concrete detail in 2021 Q1, and
+implement it in Q2.
+
+In the meantime, *we will not be focusing on improvements to the current
+implementation of Stardoc*, even the formatting parts which might remain the
+same. We still commit to keeping Stardoc working for its existing essential use
+cases.
diff --git a/docs/generating_stardoc.md b/docs/generating_stardoc.md
index 88a37bd..33e4c5a 100644
--- a/docs/generating_stardoc.md
+++ b/docs/generating_stardoc.md
@@ -133,14 +133,18 @@ like documentation to be generated.
For example, you may want to generate documentation for `foo_rule`, `bar_rule`, and
`baz_rule`, all in different `.bzl` files. First, you would create a single `.bzl` file
-which loads these files:
+which loads these files and binds the rules to be documented as globals:
`doc_hub.bzl`:
```python
-load("//foo:foo.bzl", "foo_rule")
-load("//bar:bar.bzl", "bar_rule")
-load("//baz:baz.bzl", "baz_rule")
+load("//foo:foo.bzl", _foo_rule = "foo_rule")
+load("//bar:bar.bzl", _bar_rule = "bar_rule")
+load("//baz:baz.bzl", _baz_rule = "baz_rule")
+
+foo_rule = _foo_rule
+bar_rule = _bar_rule
+baz_rule = _baz_rule
# No need for any implementation here. The rules need only be loaded.
```
diff --git a/docs/getting_started_stardoc.md b/docs/getting_started_stardoc.md
index f40669e..7644210 100644
--- a/docs/getting_started_stardoc.md
+++ b/docs/getting_started_stardoc.md
@@ -8,27 +8,20 @@ Starlark generates one documentation page per `stardoc` target.
If you are new to writing build rules for Bazel, please read the Bazel
documentation on [writing
-extensions](https://www.bazel.build/docs/skylark/concepts.html)
+extensions](https://bazel.build/extending/concepts)
## Setup
-To use Stardoc, add the following to your `WORKSPACE` file:
+Edit your `WORKSPACE` file as shown in the `WORKSPACE` setup section for
+[the current Stardoc release](https://github.com/bazelbuild/stardoc/releases).
-```python
-load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
-
-git_repository(
- name = "io_bazel_stardoc",
- remote = "https://github.com/bazelbuild/stardoc.git",
- tag = "0.4.0",
-)
+Then add
-load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")
-stardoc_repositories()
+```python
+load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
```
-The load statement and function call after the `io_bazel_stardoc` repository
-definition ensure that this repository's dependencies are loaded.
+to your `BUILD` or .bzl file to start using the `stardoc` rule.
## Next Steps
diff --git a/docs/maintainers_guide.md b/docs/maintainers_guide.md
new file mode 100644
index 0000000..c4358cc
--- /dev/null
+++ b/docs/maintainers_guide.md
@@ -0,0 +1,92 @@
+# Stardoc Maintainer's Guide
+
+## Updating Jars
+
+Stardoc's source code currently lives in the Bazel source tree at
+https://github.com/bazelbuild/bazel/tree/master/src/main/java/com/google/devtools/build/skydoc
+
+For simplicity of use and building, Stardoc bundles two pre-built jars built
+from Bazel source: `stardoc_binary.jar` (emits protobuf documentation format)
+and `renderer_binary.jar` (turns the protobuf into markdown).
+
+To update the jars:
+
+1. Update `io_bazel` repo commit in `WORKSPACE`. Update transitive deps in
+ `WORKSPACE` as needed.
+2. run `update-release-binary.sh`
+
+## Making a New Release
+
+1. Update CHANGELOG.md at the top. You may want to use the following template:
+
+--------------------------------------------------------------------------------
+
+## Release $VERSION
+
+**New Features**
+
+- Feature
+- Feature
+
+**Incompatible Changes**
+
+- Change
+- Change
+
+**Contributors**
+
+Name 1, Name 2, Name 3 (alphabetically)
+
+--------------------------------------------------------------------------------
+
+2. Bump `version` in version.bzl to the new version.
+3. Ensure that the commits for steps 1 and 2 have been merged. All further
+ steps must be performed on a single, known-good git commit.
+4. `bazel build //distro`
+5. Copy the `stardoc-$VERSION.tar.gz` tarball to the mirror (you'll need Bazel
+ developer gcloud credentials; assuming you are a Bazel developer, you can
+ obtain them via `gcloud init`):
+
+```
+gsutil cp bazel-bin/distro/stardoc-$VERSION.tar.gz gs://bazel-mirror/github.com/bazelbuild/stardoc/releases/download/$VERSION/stardoc-$VERSION.tar.gz
+gsutil setmeta -h "Cache-Control: public, max-age=31536000" "gs://bazel-mirror/github.com/bazelbuild/stardoc/releases/download/$VERSION/stardoc-$VERSION.tar.gz"
+```
+
+6. Run `sha256sum bazel-bin/distro/stardoc-$VERSION.tar.gz`; you'll need the
+ checksum for the release notes.
+7. Draft a new release with a new tag named $VERSION in github. Attach
+ `stardoc-$VERSION.tar.gz` to the release. For the release notes, use the
+ CHANGELOG.md entry plus the following template:
+
+--------------------------------------------------------------------------------
+
+**WORKSPACE setup**
+
+To use Stardoc, add the following to your `WORKSPACE` file:
+
+```
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "io_bazel_stardoc",
+ sha256 = "$SHA256SUM",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/$VERSION/stardoc-$VERSION.tar.gz",
+ "https://github.com/bazelbuild/stardoc/releases/download/$VERSION/stardoc-$VERSION.tar.gz",
+ ],
+)
+
+load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")
+
+stardoc_repositories()
+```
+
+The load statement and function call after the `io_bazel_stardoc` repository
+definition ensure that this repository's dependencies are loaded.
+
+**Using the rules**
+
+See [the source](https://github.com/bazelbuild/stardoc/tree/$VERSION).
+
+--------------------------------------------------------------------------------
+
diff --git a/docs/stardoc_rule.md b/docs/stardoc_rule.md
index 71200a0..532855a 100644
--- a/docs/stardoc_rule.md
+++ b/docs/stardoc_rule.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#stardoc"></a>
+Starlark rule for stardoc: a documentation generator tool written in Java.
+
+<a id="stardoc"></a>
## stardoc
@@ -19,20 +21,20 @@ This rule is an experimental replacement for the existing skylark_doc rule.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| aspect_template | The input file template for generating documentation of aspects. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //stardoc:templates/markdown_tables/aspect.vm |
-| deps | A list of skylark_library dependencies which the input depends on. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
-| format | The format of the output file. Valid values: 'markdown' or 'proto'. | String | optional | "markdown" |
-| func_template | The input file template for generating documentation of functions. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //stardoc:templates/markdown_tables/func.vm |
-| header_template | The input file template for the header of the output documentation. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //stardoc:templates/markdown_tables/header.vm |
-| input | The starlark file to generate documentation for. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| out | The (markdown) file to which documentation will be output. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| provider_template | The input file template for generating documentation of providers. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //stardoc:templates/markdown_tables/provider.vm |
-| renderer | The location of the renderer tool. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //stardoc:renderer |
-| rule_template | The input file template for generating documentation of rules. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //stardoc:templates/markdown_tables/rule.vm |
-| semantic_flags | A list of canonical flags to affect Starlark semantics for the Starlark interpretter during documentation generation. This should only be used to maintain compatibility with non-default semantic flags required to use the given Starlark symbols.<br><br>For example, if <code>//foo:bar.bzl</code> does not build except when a user would specify <code>--incompatible_foo_semantic=false</code>, then this attribute should contain "--incompatible_foo_semantic=false". | List of strings | optional | [] |
-| stardoc | The location of the stardoc tool. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //stardoc:stardoc |
-| symbol_names | A list of symbol names to generate documentation for. These should correspond to the names of rule definitions in the input file. If this list is empty, then documentation for all exported rule definitions will be generated. | List of strings | optional | [] |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="stardoc-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="stardoc-aspect_template"></a>aspect_template | The input file template for generating documentation of aspects. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//stardoc:templates/markdown_tables/aspect.vm</code> |
+| <a id="stardoc-deps"></a>deps | A list of bzl_library dependencies which the input depends on. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
+| <a id="stardoc-format"></a>format | The format of the output file. Valid values: 'markdown' or 'proto'. | String | optional | <code>"markdown"</code> |
+| <a id="stardoc-func_template"></a>func_template | The input file template for generating documentation of functions. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//stardoc:templates/markdown_tables/func.vm</code> |
+| <a id="stardoc-header_template"></a>header_template | The input file template for the header of the output documentation. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//stardoc:templates/markdown_tables/header.vm</code> |
+| <a id="stardoc-input"></a>input | The starlark file to generate documentation for. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>None</code> |
+| <a id="stardoc-out"></a>out | The (markdown) file to which documentation will be output. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="stardoc-provider_template"></a>provider_template | The input file template for generating documentation of providers. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//stardoc:templates/markdown_tables/provider.vm</code> |
+| <a id="stardoc-renderer"></a>renderer | The location of the renderer tool. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//stardoc:renderer</code> |
+| <a id="stardoc-rule_template"></a>rule_template | The input file template for generating documentation of rules. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//stardoc:templates/markdown_tables/rule.vm</code> |
+| <a id="stardoc-semantic_flags"></a>semantic_flags | A list of canonical flags to affect Starlark semantics for the Starlark interpretter during documentation generation. This should only be used to maintain compatibility with non-default semantic flags required to use the given Starlark symbols.<br><br>For example, if <code>//foo:bar.bzl</code> does not build except when a user would specify <code>--incompatible_foo_semantic=false</code>, then this attribute should contain "--incompatible_foo_semantic=false". | List of strings | optional | <code>[]</code> |
+| <a id="stardoc-stardoc"></a>stardoc | The location of the stardoc tool. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//stardoc:stardoc</code> |
+| <a id="stardoc-symbol_names"></a>symbol_names | A list of symbol names to generate documentation for. These should correspond to the names of rule definitions in the input file. If this list is empty, then documentation for all exported rule definitions will be generated. | List of strings | optional | <code>[]</code> |
diff --git a/setup.bzl b/setup.bzl
index 5c8c119..dd39565 100644
--- a/setup.bzl
+++ b/setup.bzl
@@ -25,16 +25,18 @@ def stardoc_repositories():
_include_if_not_defined(
http_archive,
name = "bazel_skylib",
- urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz"],
- sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
+ "https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
+ ],
+ sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728",
)
_include_if_not_defined(
http_archive,
name = "rules_java",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
- "https://github.com/bazelbuild/rules_java/archive/7cf3cefd652008d0a64a419c34c13bdca6c8f178.zip",
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_java/releases/download/4.0.0/rules_java-4.0.0.tar.gz",
+ "https://github.com/bazelbuild/rules_java/releases/download/4.0.0/rules_java-4.0.0.tar.gz",
],
- sha256 = "bc81f1ba47ef5cc68ad32225c3d0e70b8c6f6077663835438da8d5733f917598",
- strip_prefix = "rules_java-7cf3cefd652008d0a64a419c34c13bdca6c8f178",
+ sha256 = "34b41ec683e67253043ab1a3d1e8b7c61e4e8edefbcad485381328c934d072fe",
)
diff --git a/stardoc/BUILD b/stardoc/BUILD
index a67873e..3e82ca9 100644
--- a/stardoc/BUILD
+++ b/stardoc/BUILD
@@ -1,13 +1,13 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load("//stardoc:stardoc.bzl", "stardoc")
+load("@rules_java//java:defs.bzl", "java_binary", "java_import")
+
licenses(["notice"]) # Apache 2.0
package(default_visibility = ["//visibility:public"])
exports_files(glob(["templates/**"]))
-load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
-load("//stardoc:stardoc.bzl", "stardoc")
-load("@rules_java//java:defs.bzl", "java_binary", "java_import")
-
filegroup(
name = "test_deps",
testonly = True,
@@ -20,10 +20,19 @@ filegroup(
bzl_library(
name = "stardoc_lib",
srcs = ["stardoc.bzl"],
+ visibility = ["//visibility:public"],
deps = [
"@bazel_skylib//:bzl_library",
],
+)
+
+bzl_library(
+ name = "html_tables_stardoc",
+ srcs = ["html_tables_stardoc.bzl"],
visibility = ["//visibility:public"],
+ deps = [
+ ":stardoc_lib",
+ ],
)
stardoc(
@@ -79,3 +88,23 @@ java_import(
jars = ["renderer_binary.jar"],
visibility = ["//visibility:private"],
)
+
+# Sources needed for release tarball.
+filegroup(
+ name = "distro_srcs",
+ srcs = [
+ "BUILD",
+ ] + glob([
+ "*.bzl",
+ "*.jar",
+ "templates/**",
+ ]),
+ visibility = ["//:__pkg__"],
+)
+
+# Binaries needed for release tarball.
+filegroup(
+ name = "distro_bins",
+ srcs = glob(["*.jar"]),
+ visibility = ["//:__pkg__"],
+)
diff --git a/stardoc/proto/BUILD b/stardoc/proto/BUILD
new file mode 100644
index 0000000..ff06c3b
--- /dev/null
+++ b/stardoc/proto/BUILD
@@ -0,0 +1,14 @@
+licenses(["notice"])
+
+package(default_visibility = ["//visibility:public"])
+
+exports_files(["stardoc_output.proto"])
+
+# Sources needed for release tarball.
+filegroup(
+ name = "distro_srcs",
+ srcs = [
+ "BUILD",
+ ] + glob(["*.proto"]),
+ visibility = ["//:__pkg__"],
+)
diff --git a/stardoc/proto/stardoc_output.proto b/stardoc/proto/stardoc_output.proto
new file mode 100644
index 0000000..e35e714
--- /dev/null
+++ b/stardoc/proto/stardoc_output.proto
@@ -0,0 +1,200 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// Protos for Stardoc data.
+//
+// Stardoc collects information about Starlark functions, providers, and rules.
+syntax = "proto3";
+
+package stardoc_output;
+
+// option java_api_version = 2;
+option java_package = "com.google.devtools.build.skydoc.rendering.proto";
+option java_outer_classname = "StardocOutputProtos";
+
+// The root output proto of Stardoc. A single invocation of Stardoc will output
+// exactly one instance of this proto, representing all documentation for
+// the input Starlark file.
+message ModuleInfo {
+ repeated RuleInfo rule_info = 1;
+
+ repeated ProviderInfo provider_info = 2;
+
+ repeated StarlarkFunctionInfo func_info = 3;
+
+ repeated AspectInfo aspect_info = 4;
+
+ // The docstring present at the top of the input Starlark file.
+ string module_docstring = 5;
+}
+
+// Representation of a Starlark rule attribute type. These generally
+// have a one-to-one correspondence with functions defined at
+// https://bazel.build/rules/lib/attr.
+enum AttributeType {
+ UNKNOWN = 0;
+ // A special case of STRING; all rules have exactly one implicit
+ // attribute "name" of type NAME.
+ NAME = 1;
+ INT = 2;
+ LABEL = 3;
+ STRING = 4;
+ STRING_LIST = 5;
+ INT_LIST = 6;
+ LABEL_LIST = 7;
+ BOOLEAN = 8;
+ LABEL_STRING_DICT = 9;
+ STRING_DICT = 10;
+ STRING_LIST_DICT = 11;
+ OUTPUT = 12;
+ OUTPUT_LIST = 13;
+}
+
+// Representation of a Starlark rule definition.
+message RuleInfo {
+ // The name of the rule.
+ string rule_name = 1;
+
+ // The documentation string of the rule.
+ string doc_string = 2;
+
+ // The attributes of the rule.
+ repeated AttributeInfo attribute = 3;
+}
+
+// Representation of a Starlark rule attribute definition, comprised of an
+// attribute name, and a schema defined by a call to one of the 'attr' module
+// methods enumerated at
+// https://bazel.build/rules/lib/attr
+message AttributeInfo {
+ // The name of the attribute.
+ string name = 1;
+
+ // The documentation string of the attribute, supplied via the 'doc'
+ // parameter to the schema-creation call.
+ string doc_string = 2;
+
+ // The type of the attribute, defined generally by which function is invoked
+ // in the attr module.
+ AttributeType type = 3;
+
+ // If true, all targets of the rule must specify a value for this attribute.
+ bool mandatory = 4;
+
+ // The target(s) in this attribute must define all the providers of at least
+ // one of the ProviderNameGroups in this list. If the Attribute Type is not a
+ // label, a label list, or a label-keyed string dictionary, the field will be
+ // left empty.
+ repeated ProviderNameGroup provider_name_group = 5;
+
+ // The string representation of the default value of this attribute.
+ string default_value = 6;
+}
+
+// Representation of a set of providers that a rule attribute may be required to
+// have.
+message ProviderNameGroup {
+ // The names of the providers that must be given by any dependency appearing
+ // in this attribute. The name will be "Unknown Provider" if the name is
+ // unidentifiable, for example, if the provider is part of a namespace.
+ // TODO(kendalllane): Fix documentation of providers from namespaces.
+ repeated string provider_name = 1;
+}
+
+// Representation of Starlark function definition.
+message StarlarkFunctionInfo {
+ // The name of the function.
+ string function_name = 1;
+
+ // The parameters for the function.
+ repeated FunctionParamInfo parameter = 2;
+
+ // The documented description of the function (if specified in the function's
+ // docstring).
+ string doc_string = 3;
+
+ // The return value for the function.
+ FunctionReturnInfo return = 4;
+
+ // The deprecation for the function.
+ FunctionDeprecationInfo deprecated = 5;
+}
+
+// Representation of a Starlark function parameter definition.
+message FunctionParamInfo {
+ // The name of the parameter.
+ string name = 1;
+
+ // The documented description of the parameter (if specified in the function's
+ // docstring).
+ string doc_string = 2;
+
+ // If not an empty string, the default value of the parameter displayed
+ // as a string.
+ string default_value = 3;
+
+ // If true, the default value is unset and a value is needed for this
+ // parameter. This might be false even if defaultValue is empty in the case of
+ // special parameter such as *args and **kwargs"
+ bool mandatory = 4;
+}
+
+message FunctionReturnInfo {
+ // The documented return value of the function (if specified in the function's
+ // docstring).
+ string doc_string = 1;
+}
+
+message FunctionDeprecationInfo {
+ // The documented deprecation of the function (if specified in the function's
+ // docstring).
+ string doc_string = 1;
+}
+
+// Representation of a Starlark provider field definition, comprised of
+// the field name and provider description.
+message ProviderFieldInfo {
+ // The name of the field.
+ string name = 1;
+
+ // The description of the provider.
+ string doc_string = 2;
+}
+
+// Representation of a Starlark provider definition.
+message ProviderInfo {
+ // The name of the provider.
+ string provider_name = 1;
+
+ // The description of the provider.
+ string doc_string = 2;
+
+ // The fields of the provider.
+ repeated ProviderFieldInfo field_info = 3;
+}
+
+// Representation of a Starlark aspect definition.
+message AspectInfo {
+ // The name of the aspect.
+ string aspect_name = 1;
+
+ // The documentation string of the aspect.
+ string doc_string = 2;
+
+ // The rule attributes along which the aspect propagates.
+ repeated string aspect_attribute = 3;
+
+ // The attributes of the aspect.
+ repeated AttributeInfo attribute = 4;
+}
diff --git a/stardoc/renderer_binary.jar b/stardoc/renderer_binary.jar
index de03de3..d822ecc 100755
--- a/stardoc/renderer_binary.jar
+++ b/stardoc/renderer_binary.jar
Binary files differ
diff --git a/stardoc/stardoc.bzl b/stardoc/stardoc.bzl
index 456aca7..f5693fc 100644
--- a/stardoc/stardoc.bzl
+++ b/stardoc/stardoc.bzl
@@ -32,7 +32,7 @@ def _stardoc_impl(ctx):
])
stardoc_args = ctx.actions.args()
stardoc_args.add("--input=" + str(ctx.file.input.owner))
- stardoc_args.add("--workspace_name=" + ctx.label.workspace_name)
+ stardoc_args.add("--workspace_name=" + ctx.workspace_name)
stardoc_args.add_all(
ctx.attr.symbol_names,
format_each = "--symbols=%s",
@@ -53,6 +53,7 @@ def _stardoc_impl(ctx):
omit_if_empty = True,
uniquify = True,
)
+
# Needed in case some files are referenced across local repository
# namespace. For example, consider a file under a nested local repository @bar
# rooted under ./foo/bar/WORKSPACE. Consider a stardoc target 'lib_doc' under
@@ -61,7 +62,8 @@ def _stardoc_impl(ctx):
# actual build is taking place in the root repository, thus the source file
# is present under external/bar/lib.bzl.
stardoc_args.add(
- "--dep_roots=external/" + ctx.label.workspace_name)
+ "--dep_roots=external/" + ctx.workspace_name,
+ )
stardoc_args.add_all(ctx.attr.semantic_flags)
stardoc = ctx.executable.stardoc
@@ -120,7 +122,7 @@ This rule is an experimental replacement for the existing skylark_doc rule.
allow_single_file = [".bzl"],
),
"deps": attr.label_list(
- doc = "A list of skylark_library dependencies which the input depends on.",
+ doc = "A list of bzl_library dependencies which the input depends on.",
providers = [StarlarkLibraryInfo],
),
"format": attr.string(
@@ -156,14 +158,14 @@ For example, if `//foo:bar.bzl` does not build except when a user would specify
doc = "The location of the stardoc tool.",
allow_files = True,
default = Label("//stardoc:stardoc"),
- cfg = "host",
+ cfg = "exec",
executable = True,
),
"renderer": attr.label(
doc = "The location of the renderer tool.",
allow_files = True,
default = Label("//stardoc:renderer"),
- cfg = "host",
+ cfg = "exec",
executable = True,
),
"aspect_template": attr.label(
@@ -189,7 +191,7 @@ For example, if `//foo:bar.bzl` does not build except when a user would specify
"rule_template": attr.label(
doc = "The input file template for generating documentation of rules.",
allow_single_file = [".vm"],
- default =Label("//stardoc:templates/markdown_tables/rule.vm"),
+ default = Label("//stardoc:templates/markdown_tables/rule.vm"),
),
},
)
diff --git a/stardoc/stardoc_binary.jar b/stardoc/stardoc_binary.jar
index 38d04af..47b6874 100755
--- a/stardoc/stardoc_binary.jar
+++ b/stardoc/stardoc_binary.jar
Binary files differ
diff --git a/stardoc/templates/html_tables/aspect.vm b/stardoc/templates/html_tables/aspect.vm
index 35e5441..e66b2b2 100644
--- a/stardoc/templates/html_tables/aspect.vm
+++ b/stardoc/templates/html_tables/aspect.vm
@@ -1,4 +1,4 @@
-<a name="#${aspectName}"></a>
+<a id="${aspectName}"></a>
#[[##]]# ${aspectName}
@@ -12,45 +12,49 @@ $aspectInfo.getDocString()
#if (!$aspectInfo.getAspectAttributeList().isEmpty())
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
#foreach ($aspectAttribute in $aspectInfo.getAspectAttributeList())
- <tr id="${aspectName}-${aspectAttribute}">
- <td><code>${aspectAttribute}</code></td>
- <td>
- String; required.
+<tr id="${aspectName}-${aspectAttribute}">
+<td><code>${aspectAttribute}</code></td>
+<td>
+String; required.
+</td>
+</tr>
#end
- </td>
- </tr>
-#end
- </tbody>
+</tbody>
</table>
+#end
#[[###]]# Attributes
#if (!$aspectInfo.getAttributeList().isEmpty())
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
#foreach ($attribute in $aspectInfo.getAttributeList())
- <tr id="${aspectName}-${attribute.name}">
- <td><code>${attribute.name}</code></td>
- <td>
- ${util.attributeTypeString($attribute)}; ${util.mandatoryString($attribute)}
+<tr id="${aspectName}-${attribute.name}">
+<td><code>${attribute.name}</code></td>
+<td>
+
+${util.attributeTypeString($attribute)}; ${util.mandatoryString($attribute)}
+
#if (!$attribute.docString.isEmpty())
- <p>
- ${attribute.docString.trim()}
- </p>
+<p>
+
+${attribute.docString.trim()}
+
+</p>
#end
- </td>
- </tr>
+</td>
+</tr>
#end
- </tbody>
+</tbody>
</table>
#end
diff --git a/stardoc/templates/html_tables/func.vm b/stardoc/templates/html_tables/func.vm
index 0f70f7a..b52e5bc 100644
--- a/stardoc/templates/html_tables/func.vm
+++ b/stardoc/templates/html_tables/func.vm
@@ -1,4 +1,4 @@
-<a name="#${funcInfo.functionName}"></a>
+<a id="${funcInfo.functionName}"></a>
#[[##]]# ${funcInfo.functionName}
@@ -12,25 +12,44 @@ ${util.htmlEscape($funcInfo.docString)}
#[[###]]# Parameters
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
#foreach ($param in $funcInfo.getParameterList())
- <tr id="${funcInfo.functionName}-${param.name}">
- <td><code>${param.name}</code></td>
- <td>
- ${util.mandatoryString($param)}.#if(!$param.getDefaultValue().isEmpty()) default is <code>$param.getDefaultValue()</code>#end
+<tr id="${funcInfo.functionName}-${param.name}">
+<td><code>${param.name}</code></td>
+<td>
+
+${util.mandatoryString($param)}.
+#if(!$param.getDefaultValue().isEmpty())
+default is <code>$param.getDefaultValue()</code>
+#end
#if (!$param.docString.isEmpty())
- <p>
- ${param.docString.trim()}
- </p>
+<p>
+
+${param.docString.trim()}
+
+</p>
#end
- </td>
- </tr>
+</td>
+</tr>
#end
- </tbody>
+</tbody>
</table>
#end
+#if (!$funcInfo.getReturn().docString.isEmpty())
+
+#[[###]]# Returns
+
+${util.htmlEscape($funcInfo.getReturn().docString)}
+
+#end
+#if (!$funcInfo.getDeprecated().docString.isEmpty())
+
+#[[###]]# Deprecated
+
+${util.htmlEscape($funcInfo.getDeprecated().docString)}
+#end
diff --git a/stardoc/templates/html_tables/header.vm b/stardoc/templates/html_tables/header.vm
index 187680d..5556ad6 100644
--- a/stardoc/templates/html_tables/header.vm
+++ b/stardoc/templates/html_tables/header.vm
@@ -1 +1,3 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
+
+${moduleDocstring}
diff --git a/stardoc/templates/html_tables/provider.vm b/stardoc/templates/html_tables/provider.vm
index 1d2f032..b1820d5 100644
--- a/stardoc/templates/html_tables/provider.vm
+++ b/stardoc/templates/html_tables/provider.vm
@@ -1,4 +1,4 @@
-<a name="#${providerName}"></a>
+<a id="${providerName}"></a>
#[[##]]# ${providerName}
@@ -12,19 +12,23 @@ ${util.htmlEscape($providerInfo.docString)}
#[[###]]# Fields
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
#foreach ($field in $providerInfo.fieldInfoList)
- <tr id="${providerName}-${field.name}">
- <td><code>${field.name}</code></td>
- <td>
- <p>${field.docString}</p>
- </td>
- </tr>
+<tr id="${providerName}-${field.name}">
+<td><code>${field.name}</code></td>
+<td>
+<p>
+
+${field.docString}
+
+</p>
+</td>
+</tr>
#end
- </tbody>
+</tbody>
</table>
#end
diff --git a/stardoc/templates/html_tables/rule.vm b/stardoc/templates/html_tables/rule.vm
index 71e0999..0d5b638 100644
--- a/stardoc/templates/html_tables/rule.vm
+++ b/stardoc/templates/html_tables/rule.vm
@@ -1,4 +1,4 @@
-<a name="#${ruleName}"></a>
+<a id="${ruleName}"></a>
#[[##]]# ${ruleName}
@@ -12,29 +12,35 @@ ${util.htmlEscape($ruleInfo.docString)}
#if (!$ruleInfo.getAttributeList().isEmpty())
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
#foreach ($attribute in $ruleInfo.getAttributeList())
- <tr id="${ruleName}-${attribute.name}">
- <td><code>${attribute.name}</code></td>
- <td>
- ${util.attributeTypeString($attribute)}; ${util.mandatoryString($attribute)}
+<tr id="${ruleName}-${attribute.name}">
+<td><code>${attribute.name}</code></td>
+<td>
+
+${util.attributeTypeString($attribute)}; ${util.mandatoryString($attribute)}
+
#if (!$attribute.docString.isEmpty())
- <p>
- ${attribute.docString.trim()}
- </p>
+<p>
+
+${attribute.docString.trim()}
+
+</p>
#end
#if (!$attribute.getProviderNameGroupList().isEmpty())
- <p>
- The dependencies of this attribute must provide: ${util.attributeProviders($attribute)}
- </p>
+<p>
+
+The dependencies of this attribute must provide: ${util.attributeProviders($attribute)}
+
+</p>
#end
- </td>
- </tr>
+</td>
+</tr>
#end
- </tbody>
+</tbody>
</table>
#end
diff --git a/stardoc/templates/markdown_tables/aspect.vm b/stardoc/templates/markdown_tables/aspect.vm
index 8bc3391..aa9f13b 100644
--- a/stardoc/templates/markdown_tables/aspect.vm
+++ b/stardoc/templates/markdown_tables/aspect.vm
@@ -1,4 +1,4 @@
-<a name="#${aspectName}"></a>
+<a id="${aspectName}"></a>
#[[##]]# ${aspectName}
@@ -6,14 +6,14 @@
${util.aspectSummary($aspectName, $aspectInfo)}
</pre>
-$aspectInfo.getDocString()
+${util.htmlEscape($aspectInfo.getDocString())}
**ASPECT ATTRIBUTES**
#if (!$aspectInfo.getAspectAttributeList().isEmpty())
| Name | Type |
-| :-------------: | :-------------: |
+| :------------- | :------------- |
#foreach ($aspectAttribute in $aspectInfo.getAspectAttributeList())
| $aspectAttribute| String |
#end
@@ -25,8 +25,8 @@ $aspectInfo.getDocString()
#if (!$aspectInfo.getAttributeList().isEmpty())
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
#foreach ($attribute in $aspectInfo.getAttributeList())
-| $attribute.name | #if(!$attribute.docString.isEmpty()) ${util.markdownCellFormat($attribute.docString)} #else - #end | ${util.attributeTypeString($attribute)} | ${util.mandatoryString($attribute)} | $attribute.defaultValue |
+| <a id="${aspectName}-${attribute.name}"></a>$attribute.name | #if(!$attribute.docString.isEmpty()) ${util.markdownCellFormat($attribute.docString)} #else - #end | ${util.attributeTypeString($attribute)} | ${util.mandatoryString($attribute)} | #if(!$attribute.defaultValue.isEmpty()) <code>${util.htmlEscape($attribute.defaultValue)}</code> #end |
#end
#end
diff --git a/stardoc/templates/markdown_tables/func.vm b/stardoc/templates/markdown_tables/func.vm
index 221bb62..5275d08 100644
--- a/stardoc/templates/markdown_tables/func.vm
+++ b/stardoc/templates/markdown_tables/func.vm
@@ -1,4 +1,4 @@
-<a name="#${funcInfo.functionName}"></a>
+<a id="${funcInfo.functionName}"></a>
#[[##]]# ${funcInfo.functionName}
@@ -6,15 +6,27 @@
${util.funcSummary($funcInfo)}
</pre>
-${funcInfo.docString}
+${util.htmlEscape($funcInfo.docString)}
+#if (!$funcInfo.getParameterList().isEmpty())
**PARAMETERS**
-#if (!$funcInfo.getParameterList().isEmpty())
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
+| :------------- | :------------- | :------------- |
#foreach ($param in $funcInfo.getParameterList())
-| $param.name | #if(!$param.docString.isEmpty()) ${util.markdownCellFormat($param.docString)} #else <p align="center"> - </p> #end | #if(!$param.getDefaultValue().isEmpty()) <code>$param.getDefaultValue()</code> #else none #end|
+| <a id="${funcInfo.functionName}-${param.name}"></a>$param.name | #if(!$param.docString.isEmpty()) ${util.markdownCellFormat($param.docString)} #else <p align="center"> - </p> #end | #if(!$param.getDefaultValue().isEmpty()) <code>${util.htmlEscape($param.getDefaultValue())}</code> #else none #end|
+#end
+#end
+#if (!$funcInfo.getReturn().docString.isEmpty())
+
+**RETURNS**
+
+${util.htmlEscape($funcInfo.getReturn().docString)}
#end
+#if (!$funcInfo.getDeprecated().docString.isEmpty())
+
+**DEPRECATED**
+
+${util.htmlEscape($funcInfo.getDeprecated().docString)}
#end
diff --git a/stardoc/templates/markdown_tables/header.vm b/stardoc/templates/markdown_tables/header.vm
index 187680d..2b47292 100644
--- a/stardoc/templates/markdown_tables/header.vm
+++ b/stardoc/templates/markdown_tables/header.vm
@@ -1 +1,3 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
+
+${util.htmlEscape($moduleDocstring)}
diff --git a/stardoc/templates/markdown_tables/provider.vm b/stardoc/templates/markdown_tables/provider.vm
index 4dad9ab..7ab4c60 100644
--- a/stardoc/templates/markdown_tables/provider.vm
+++ b/stardoc/templates/markdown_tables/provider.vm
@@ -1,4 +1,4 @@
-<a name="#${providerName}"></a>
+<a id="${providerName}"></a>
#[[##]]# ${providerName}
@@ -6,15 +6,15 @@
${util.providerSummary($providerName, $providerInfo)}
</pre>
-${providerInfo.docString}
+${util.htmlEscape($providerInfo.docString)}
**FIELDS**
#if (!$providerInfo.fieldInfoList.isEmpty())
| Name | Description |
-| :-------------: | :-------------: |
+| :------------- | :------------- |
#foreach ($field in $providerInfo.fieldInfoList)
-| $field.name | #if(!$field.docString.isEmpty()) ${util.markdownCellFormat($field.docString)} #else - #end |
+| <a id="${providerName}-${field.name}"></a>$field.name | #if(!$field.docString.isEmpty()) ${util.markdownCellFormat($field.docString)} #else - #end |
#end
#end
diff --git a/stardoc/templates/markdown_tables/rule.vm b/stardoc/templates/markdown_tables/rule.vm
index 567bc9f..06d9a1f 100644
--- a/stardoc/templates/markdown_tables/rule.vm
+++ b/stardoc/templates/markdown_tables/rule.vm
@@ -1,4 +1,4 @@
-<a name="#${ruleName}"></a>
+<a id="${ruleName}"></a>
#[[##]]# ${ruleName}
@@ -6,15 +6,15 @@
${util.ruleSummary($ruleName, $ruleInfo)}
</pre>
-${ruleInfo.docString}
+${util.htmlEscape($ruleInfo.docString)}
**ATTRIBUTES**
#if (!$ruleInfo.getAttributeList().isEmpty())
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
#foreach ($attribute in $ruleInfo.getAttributeList())
-| $attribute.name | #if(!$attribute.docString.isEmpty()) ${util.markdownCellFormat($attribute.docString)} #else - #end | ${util.attributeTypeString($attribute)} | ${util.mandatoryString($attribute)} | $attribute.defaultValue |
+| <a id="${ruleName}-${attribute.name}"></a>$attribute.name | #if(!$attribute.docString.isEmpty()) ${util.markdownCellFormat($attribute.docString)} #else - #end | ${util.attributeTypeString($attribute)} | ${util.mandatoryString($attribute)} | #if(!$attribute.defaultValue.isEmpty())<code>${util.htmlEscape($attribute.defaultValue)}</code>#end |
#end
#end
diff --git a/test/BUILD b/test/BUILD
index bc87007..c97b5a4 100644
--- a/test/BUILD
+++ b/test/BUILD
@@ -15,6 +15,8 @@ sh_test(
],
)
+exports_files(["testdata/fakedeps/dep.bzl"])
+
stardoc_test(
name = "input_template_test",
aspect_template = "testdata/input_template_test/aspect.vm",
diff --git a/test/stardoc_test.bzl b/test/stardoc_test.bzl
index 4db9c50..8a18b52 100644
--- a/test/stardoc_test.bzl
+++ b/test/stardoc_test.bzl
@@ -53,7 +53,8 @@ def stardoc_test(
srcs = [input_file],
deps = deps,
)
- _create_test_targets(test_name = "%s_e2e_test" % name,
+ _create_test_targets(
+ test_name = "%s_e2e_test" % name,
genrule_name = "regenerate_%s_golden" % name,
lib_name = "%s_lib" % name,
input_file = input_file,
@@ -61,8 +62,10 @@ def stardoc_test(
stardoc_bin = "@io_bazel//src/main/java/com/google/devtools/build/skydoc",
renderer_bin = "@io_bazel//src/main/java/com/google/devtools/build/skydoc/renderer",
test = test,
- **kwargs)
- _create_test_targets(test_name = "%s_e2e_jar_test" % name,
+ **kwargs
+ )
+ _create_test_targets(
+ test_name = "%s_e2e_jar_test" % name,
genrule_name = "regenerate_with_jar_%s_golden" % name,
lib_name = "%s_lib" % name,
input_file = input_file,
@@ -70,17 +73,19 @@ def stardoc_test(
stardoc_bin = "@io_bazel//src/main/java/com/google/devtools/build/skydoc",
renderer_bin = "@io_bazel//src/main/java/com/google/devtools/build/skydoc/renderer",
test = test,
- **kwargs)
+ **kwargs
+ )
-def _create_test_targets(test_name,
- genrule_name,
- lib_name,
- input_file,
- golden_file,
- stardoc_bin,
- renderer_bin,
- test,
- **kwargs):
+def _create_test_targets(
+ test_name,
+ genrule_name,
+ lib_name,
+ input_file,
+ golden_file,
+ stardoc_bin,
+ renderer_bin,
+ test,
+ **kwargs):
actual_generated_doc = "%s.out" % genrule_name
native.sh_test(
@@ -118,4 +123,3 @@ def _create_test_targets(test_name,
)
else:
fail("parameter 'test' must either be 'default' or 'html_tables', but was " + test)
-
diff --git a/test/testdata/android_basic_test/golden.md b/test/testdata/android_basic_test/golden.md
index 5c61869..0962201 100755
--- a/test/testdata/android_basic_test/golden.md
+++ b/test/testdata/android_basic_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#android_related_rule"></a>
+
+
+<a id="android_related_rule"></a>
## android_related_rule
@@ -14,11 +16,11 @@ This rule does android-related things.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| fourth | - | Boolean | optional | False |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="android_related_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="android_related_rule-first"></a>first | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="android_related_rule-fourth"></a>fourth | - | Boolean | optional | <code>False</code> |
+| <a id="android_related_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="android_related_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
diff --git a/test/testdata/android_basic_test/input.bzl b/test/testdata/android_basic_test/input.bzl
index 11feec1..970b674 100644
--- a/test/testdata/android_basic_test/input.bzl
+++ b/test/testdata/android_basic_test/input.bzl
@@ -1,5 +1,6 @@
# buildifier: disable=module-docstring
# buildifier: disable=function-docstring
+# buildifier: disable=unused-variable
def exercise_the_api():
_var1 = android_common.create_device_broker_info("")
_var2 = ApkInfo
@@ -13,8 +14,10 @@ def exercise_the_api():
exercise_the_api()
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
+# buildifier: disable=unsorted-dict-items
android_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does android-related things.",
diff --git a/test/testdata/angle_bracket_test/golden.md b/test/testdata/angle_bracket_test/golden.md
index c86d62b..1c31dd2 100755
--- a/test/testdata/angle_bracket_test/golden.md
+++ b/test/testdata/angle_bracket_test/golden.md
@@ -1,6 +1,11 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_anglebrac"></a>
+Input file to test &lt;angle bracket bugs&gt;
+
+See https://github.com/bazelbuild/skydoc/issues/186
+and https://github.com/bazelbuild/stardoc/issues/132
+
+<a id="my_anglebrac"></a>
## my_anglebrac
@@ -8,18 +13,18 @@
my_anglebrac(<a href="#my_anglebrac-name">name</a>, <a href="#my_anglebrac-useless">useless</a>)
</pre>
-Rule with <brackets>
+Rule with &lt;brackets&gt;
**ATTRIBUTES**
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| useless | Args with some tags: &lt;tag1&gt;, &lt;tag2&gt; | String | optional | "Find <brackets>" |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_anglebrac-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_anglebrac-useless"></a>useless | Args with some tags: &lt;tag1&gt;, &lt;tag2&gt; | String | optional | <code>"Find &lt;brackets&gt;"</code> |
-<a name="#bracketuse"></a>
+<a id="bracketuse"></a>
## bracketuse
@@ -27,36 +32,71 @@ Rule with <brackets>
bracketuse(<a href="#bracketuse-foo">foo</a>, <a href="#bracketuse-bar">bar</a>, <a href="#bracketuse-baz">baz</a>)
</pre>
-Information with <brackets>
+Information with &lt;brackets&gt;
**FIELDS**
| Name | Description |
-| :-------------: | :-------------: |
-| foo | A string representing &lt;foo&gt; |
-| bar | A string representing bar |
-| baz | A string representing baz |
+| :------------- | :------------- |
+| <a id="bracketuse-foo"></a>foo | A string representing &lt;foo&gt; |
+| <a id="bracketuse-bar"></a>bar | A string representing bar |
+| <a id="bracketuse-baz"></a>baz | A string representing baz |
-<a name="#bracket_function"></a>
+<a id="bracket_function"></a>
## bracket_function
<pre>
-bracket_function(<a href="#bracket_function-name">name</a>)
+bracket_function(<a href="#bracket_function-param">param</a>)
</pre>
-Dummy docstring with <brackets>.
+Dummy docstring with &lt;brackets&gt;.
-This rule runs checks on <angle brackets>.
+This rule runs checks on &lt;angle brackets&gt;.
**PARAMETERS**
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| name | an arg with **formatted** docstring. | none |
+| :------------- | :------------- | :------------- |
+| <a id="bracket_function-param"></a>param | an arg with **formatted** docstring, &lt;default&gt; by default. | <code>"&lt;default&gt;"</code> |
+
+**RETURNS**
+
+some &lt;angled&gt; brackets
+
+**DEPRECATED**
+
+deprecated for &lt;reasons&gt;
+
+
+<a id="bracket_aspect"></a>
+
+## bracket_aspect
+
+<pre>
+bracket_aspect(<a href="#bracket_aspect-name">name</a>, <a href="#bracket_aspect-brackets">brackets</a>)
+</pre>
+
+Aspect with &lt;brackets&gt;
+
+**ASPECT ATTRIBUTES**
+
+
+| Name | Type |
+| :------------- | :------------- |
+| deps| String |
+
+
+**ATTRIBUTES**
+
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="bracket_aspect-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="bracket_aspect-brackets"></a>brackets | Attribute with &lt;brackets&gt; | String | optional | <code>"&lt;default&gt;"</code> |
diff --git a/test/testdata/angle_bracket_test/input.bzl b/test/testdata/angle_bracket_test/input.bzl
index 0f3a45c..4df0e1f 100644
--- a/test/testdata/angle_bracket_test/input.bzl
+++ b/test/testdata/angle_bracket_test/input.bzl
@@ -1,19 +1,25 @@
-"""Input file to test angle bracket bug (https://github.com/bazelbuild/skydoc/issues/186)"""
+"""Input file to test <angle bracket bugs>
-def bracket_function(name):
+See https://github.com/bazelbuild/skydoc/issues/186
+and https://github.com/bazelbuild/stardoc/issues/132"""
+
+def bracket_function(param = "<default>"):
"""Dummy docstring with <brackets>.
This rule runs checks on <angle brackets>.
Args:
- name: an arg with **formatted** docstring.
+ param: an arg with **formatted** docstring, <default> by default.
Returns:
some <angled> brackets
+ Deprecated:
+ deprecated for <reasons>
"""
- pass
+ return param
+# buildifier: disable=unsorted-dict-items
bracketuse = provider(
doc = "Information with <brackets>",
fields = {
@@ -24,6 +30,7 @@ bracketuse = provider(
)
def _rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
my_anglebrac = rule(
@@ -36,3 +43,19 @@ my_anglebrac = rule(
),
},
)
+
+def _bracket_aspect_impl(ctx):
+ _ignore = [ctx] # @unused
+ return []
+
+bracket_aspect = aspect(
+ implementation = _bracket_aspect_impl,
+ doc = "Aspect with <brackets>",
+ attr_aspects = ["deps"],
+ attrs = {
+ "brackets": attr.string(
+ doc = "Attribute with <brackets>",
+ default = "<default>",
+ ),
+ },
+)
diff --git a/test/testdata/apple_basic_test/golden.md b/test/testdata/apple_basic_test/golden.md
index a793122..5a9eb6e 100755
--- a/test/testdata/apple_basic_test/golden.md
+++ b/test/testdata/apple_basic_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#apple_related_rule"></a>
+
+
+<a id="apple_related_rule"></a>
## apple_related_rule
@@ -14,11 +16,11 @@ This rule does apple-related things.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| fourth | - | Boolean | optional | False |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="apple_related_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="apple_related_rule-first"></a>first | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="apple_related_rule-fourth"></a>fourth | - | Boolean | optional | <code>False</code> |
+| <a id="apple_related_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="apple_related_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
diff --git a/test/testdata/apple_basic_test/input.bzl b/test/testdata/apple_basic_test/input.bzl
index c5801ba..d5e89de 100644
--- a/test/testdata/apple_basic_test/input.bzl
+++ b/test/testdata/apple_basic_test/input.bzl
@@ -1,15 +1,17 @@
# buildifier: disable=module-docstring
# buildifier: disable=function-docstring
def exercise_the_api():
- var1 = apple_common.platform_type
- var2 = apple_common.AppleDynamicFramework
+ var1 = apple_common.platform_type # @unused
+ var2 = apple_common.AppleDynamicFramework # @unused
exercise_the_api()
# buildifier: disable=rule-impl-return
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return struct()
+# buildifier: disable=unsorted-dict-items
apple_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does apple-related things.",
diff --git a/test/testdata/aspect_test/golden.md b/test/testdata/aspect_test/golden.md
index 065e134..92e62cc 100755
--- a/test/testdata/aspect_test/golden.md
+++ b/test/testdata/aspect_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_aspect_impl"></a>
+The input file for the aspect test
+
+<a id="my_aspect_impl"></a>
## my_aspect_impl
@@ -14,11 +16,11 @@ my_aspect_impl(<a href="#my_aspect_impl-ctx">ctx</a>)
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| ctx | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_aspect_impl-ctx"></a>ctx | <p align="center"> - </p> | none |
-<a name="#my_aspect"></a>
+<a id="my_aspect"></a>
## my_aspect
@@ -32,7 +34,7 @@ This is my aspect. It does stuff.
| Name | Type |
-| :-------------: | :-------------: |
+| :------------- | :------------- |
| deps| String |
| attr_aspect| String |
@@ -41,13 +43,13 @@ This is my aspect. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_aspect-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_aspect-first"></a>first | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_aspect-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
-<a name="#other_aspect"></a>
+<a id="other_aspect"></a>
## other_aspect
@@ -61,7 +63,7 @@ This is another aspect.
| Name | Type |
-| :-------------: | :-------------: |
+| :------------- | :------------- |
| *| String |
@@ -69,8 +71,8 @@ This is another aspect.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| third | - | Integer | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="other_aspect-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="other_aspect-third"></a>third | - | Integer | required | |
diff --git a/test/testdata/aspect_test/input.bzl b/test/testdata/aspect_test/input.bzl
index 1ffedb4..72e35a5 100644
--- a/test/testdata/aspect_test/input.bzl
+++ b/test/testdata/aspect_test/input.bzl
@@ -1,6 +1,7 @@
"""The input file for the aspect test"""
def my_aspect_impl(ctx):
+ _ignore = [ctx] # @unused
return []
my_aspect = aspect(
@@ -13,6 +14,7 @@ my_aspect = aspect(
},
)
+# buildifier: disable=unsorted-dict-items
other_aspect = aspect(
implementation = my_aspect_impl,
doc = "This is another aspect.",
diff --git a/test/testdata/attribute_defaults_test/golden.md b/test/testdata/attribute_defaults_test/golden.md
index 2dce74d..ae62b4c 100755
--- a/test/testdata/attribute_defaults_test/golden.md
+++ b/test/testdata/attribute_defaults_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+A golden test to verify attribute default values.
+
+<a id="my_rule"></a>
## my_rule
@@ -14,34 +16,34 @@ This is my rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| a | Some bool | Boolean | optional | False |
-| b | Some int | Integer | optional | 2 |
-| c | Some int_list | List of integers | optional | [0, 1] |
-| d | Some label | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //foo:bar |
-| e | Some label_keyed_string_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: Label -> String</a> | optional | {"//foo:bar": "hello", "//bar:baz": "goodbye"} |
-| f | Some label_list | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | ["//foo:bar", "//bar:baz"] |
-| g | Some string | String | optional | "" |
-| h | Some string_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | optional | {"animal": "bunny", "color": "orange"} |
-| i | Some string_list | List of strings | optional | ["cat", "dog"] |
-| j | Some string_list_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> List of strings</a> | optional | {"animal": ["cat", "bunny"], "color": ["blue", "orange"]} |
-| k | Some bool | Boolean | required | |
-| l | Some int | Integer | required | |
-| m | Some int_list | List of integers | required | |
-| n | Some label | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| o | Some label_keyed_string_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: Label -> String</a> | required | |
-| p | Some label_list | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | required | |
-| q | Some string | String | required | |
-| r | Some string_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| s | Some string_list | List of strings | required | |
-| t | Some string_list_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> List of strings</a> | required | |
-| u | - | String | optional | "" |
-| v | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| w | - | Integer | optional | 0 |
-
-
-<a name="#my_aspect"></a>
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-a"></a>a | Some bool | Boolean | optional | <code>False</code> |
+| <a id="my_rule-b"></a>b | Some int | Integer | optional | <code>2</code> |
+| <a id="my_rule-c"></a>c | Some int_list | List of integers | optional | <code>[0, 1]</code> |
+| <a id="my_rule-d"></a>d | Some label | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//foo:bar</code> |
+| <a id="my_rule-e"></a>e | Some label_keyed_string_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: Label -> String</a> | optional | <code>{"//foo:bar": "hello", "//bar:baz": "goodbye"}</code> |
+| <a id="my_rule-f"></a>f | Some label_list | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>["//foo:bar", "//bar:baz"]</code> |
+| <a id="my_rule-g"></a>g | Some string | String | optional | <code>""</code> |
+| <a id="my_rule-h"></a>h | Some string_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | <code>{"animal": "bunny", "color": "orange"}</code> |
+| <a id="my_rule-i"></a>i | Some string_list | List of strings | optional | <code>["cat", "dog"]</code> |
+| <a id="my_rule-j"></a>j | Some string_list_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> List of strings</a> | optional | <code>{"animal": ["cat", "bunny"], "color": ["blue", "orange"]}</code> |
+| <a id="my_rule-k"></a>k | Some bool | Boolean | required | |
+| <a id="my_rule-l"></a>l | Some int | Integer | required | |
+| <a id="my_rule-m"></a>m | Some int_list | List of integers | required | |
+| <a id="my_rule-n"></a>n | Some label | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-o"></a>o | Some label_keyed_string_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: Label -> String</a> | required | |
+| <a id="my_rule-p"></a>p | Some label_list | <a href="https://bazel.build/concepts/labels">List of labels</a> | required | |
+| <a id="my_rule-q"></a>q | Some string | String | required | |
+| <a id="my_rule-r"></a>r | Some string_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="my_rule-s"></a>s | Some string_list | List of strings | required | |
+| <a id="my_rule-t"></a>t | Some string_list_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> List of strings</a> | required | |
+| <a id="my_rule-u"></a>u | - | String | optional | <code>""</code> |
+| <a id="my_rule-v"></a>v | - | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>None</code> |
+| <a id="my_rule-w"></a>w | - | Integer | optional | <code>0</code> |
+
+
+<a id="my_aspect"></a>
## my_aspect
@@ -55,7 +57,7 @@ This is my aspect. It does stuff.
| Name | Type |
-| :-------------: | :-------------: |
+| :------------- | :------------- |
| deps| String |
| attr_aspect| String |
@@ -64,9 +66,9 @@ This is my aspect. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| y | some string | String | optional | "why" |
-| z | - | String | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_aspect-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_aspect-y"></a>y | some string | String | optional | <code>"why"</code> |
+| <a id="my_aspect-z"></a>z | - | String | required | |
diff --git a/test/testdata/attribute_defaults_test/input.bzl b/test/testdata/attribute_defaults_test/input.bzl
index fe891f6..3b531b3 100644
--- a/test/testdata/attribute_defaults_test/input.bzl
+++ b/test/testdata/attribute_defaults_test/input.bzl
@@ -1,11 +1,14 @@
"""A golden test to verify attribute default values."""
def _my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
def _my_aspect_impl(target, ctx):
+ _ignore = [target, ctx] # @unused
return []
+# buildifier: disable=unsorted-dict-items
my_aspect = aspect(
implementation = _my_aspect_impl,
doc = "This is my aspect. It does stuff.",
@@ -17,6 +20,7 @@ my_aspect = aspect(
},
)
+# buildifier: disable=unsorted-dict-items
my_rule = rule(
implementation = _my_rule_impl,
doc = "This is my rule. It does stuff.",
@@ -52,6 +56,6 @@ my_rule = rule(
"t": attr.string_list_dict(mandatory = True, doc = "Some string_list_dict"),
"u": attr.string(),
"v": attr.label(),
- "w": attr.int()
+ "w": attr.int(),
},
)
diff --git a/test/testdata/attribute_types_test/golden.md b/test/testdata/attribute_types_test/golden.md
index c55d06f..9a988c1 100755
--- a/test/testdata/attribute_types_test/golden.md
+++ b/test/testdata/attribute_types_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+
+
+<a id="my_rule"></a>
## my_rule
@@ -14,19 +16,19 @@ This is my rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| a | Some bool | Boolean | required | |
-| b | Some int | Integer | required | |
-| c | Some int_list | List of integers | required | |
-| d | Some label | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| e | Some label_keyed_string_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: Label -> String</a> | required | |
-| f | Some label_list | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | required | |
-| g | Some output | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| h | Some output_list | List of labels | optional | None |
-| i | Some string | String | required | |
-| j | Some string_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| k | Some string_list | List of strings | required | |
-| l | Some string_list_dict | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> List of strings</a> | optional | {} |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-a"></a>a | Some bool | Boolean | required | |
+| <a id="my_rule-b"></a>b | Some int | Integer | required | |
+| <a id="my_rule-c"></a>c | Some int_list | List of integers | required | |
+| <a id="my_rule-d"></a>d | Some label | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-e"></a>e | Some label_keyed_string_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: Label -> String</a> | required | |
+| <a id="my_rule-f"></a>f | Some label_list | <a href="https://bazel.build/concepts/labels">List of labels</a> | required | |
+| <a id="my_rule-g"></a>g | Some output | <a href="https://bazel.build/concepts/labels">Label</a> | optional | |
+| <a id="my_rule-h"></a>h | Some output_list | List of labels | optional | |
+| <a id="my_rule-i"></a>i | Some string | String | required | |
+| <a id="my_rule-j"></a>j | Some string_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="my_rule-k"></a>k | Some string_list | List of strings | required | |
+| <a id="my_rule-l"></a>l | Some string_list_dict | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> List of strings</a> | optional | <code>{}</code> |
diff --git a/test/testdata/attribute_types_test/input.bzl b/test/testdata/attribute_types_test/input.bzl
index adbe695..92c037c 100644
--- a/test/testdata/attribute_types_test/input.bzl
+++ b/test/testdata/attribute_types_test/input.bzl
@@ -1,6 +1,7 @@
# buildifier: disable=module-docstring
# buildifier: disable=function-docstring
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
my_rule = rule(
diff --git a/test/testdata/cc_api_test/golden.md b/test/testdata/cc_api_test/golden.md
index 79ae8b5..10ca7f8 100755
--- a/test/testdata/cc_api_test/golden.md
+++ b/test/testdata/cc_api_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#cpp_related_rule"></a>
+Input file for C++ api test
+
+<a id="cpp_related_rule"></a>
## cpp_related_rule
@@ -14,15 +16,15 @@ This rule does C++-related things.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| fourth | - | Boolean | optional | False |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="cpp_related_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="cpp_related_rule-first"></a>first | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="cpp_related_rule-fourth"></a>fourth | - | Boolean | optional | <code>False</code> |
+| <a id="cpp_related_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="cpp_related_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
-<a name="#exercise_the_api"></a>
+<a id="exercise_the_api"></a>
## exercise_the_api
@@ -32,11 +34,9 @@ exercise_the_api()
-**PARAMETERS**
-
-<a name="#my_rule_impl"></a>
+<a id="my_rule_impl"></a>
## my_rule_impl
@@ -50,7 +50,7 @@ my_rule_impl(<a href="#my_rule_impl-ctx">ctx</a>)
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| ctx | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_rule_impl-ctx"></a>ctx | <p align="center"> - </p> | none |
diff --git a/test/testdata/cc_api_test/input.bzl b/test/testdata/cc_api_test/input.bzl
index 17462fd..9a4365f 100644
--- a/test/testdata/cc_api_test/input.bzl
+++ b/test/testdata/cc_api_test/input.bzl
@@ -1,13 +1,15 @@
-"""Input file for C++ api test """
+"""Input file for C++ api test"""
def exercise_the_api():
- var1 = CcInfo
+ var1 = CcInfo # @unused
exercise_the_api()
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
+# buildifier: disable=unsorted-dict-items
cpp_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does C++-related things.",
diff --git a/test/testdata/config_apis_test/golden.md b/test/testdata/config_apis_test/golden.md
index 7cdab56..e1d5fdf 100755
--- a/test/testdata/config_apis_test/golden.md
+++ b/test/testdata/config_apis_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#int_setting"></a>
+
+
+<a id="int_setting"></a>
## int_setting
@@ -8,17 +10,17 @@
int_setting(<a href="#int_setting-name">name</a>)
</pre>
-
+An integer flag.
**ATTRIBUTES**
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="int_setting-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
-<a name="#string_flag"></a>
+<a id="string_flag"></a>
## string_flag
@@ -26,17 +28,17 @@ int_setting(<a href="#int_setting-name">name</a>)
string_flag(<a href="#string_flag-name">name</a>)
</pre>
-
+A string flag.
**ATTRIBUTES**
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="string_flag-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
-<a name="#exercise_the_api"></a>
+<a id="exercise_the_api"></a>
## exercise_the_api
@@ -46,11 +48,9 @@ exercise_the_api()
-**PARAMETERS**
-
-<a name="#transition_func"></a>
+<a id="transition_func"></a>
## transition_func
@@ -64,7 +64,7 @@ A no-op transition function.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| settings | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="transition_func-settings"></a>settings | <p align="center"> - </p> | none |
diff --git a/test/testdata/config_apis_test/input.bzl b/test/testdata/config_apis_test/input.bzl
index 5519711..fb2a8ce 100644
--- a/test/testdata/config_apis_test/input.bzl
+++ b/test/testdata/config_apis_test/input.bzl
@@ -1,7 +1,7 @@
# buildifier: disable=module-docstring
# buildifier: disable=function-docstring
def exercise_the_api():
- _var6 = configuration_field("foo", "bar")
+ _var6 = configuration_field("foo", "bar") # @unused
exercise_the_api()
@@ -12,14 +12,17 @@ def transition_func(settings):
my_transition = transition(implementation = transition_func, inputs = [], outputs = [])
def _build_setting_impl(ctx):
+ _ignore = [ctx] # @unused
return []
string_flag = rule(
+ doc = "A string flag.",
implementation = _build_setting_impl,
build_setting = config.string(flag = True),
)
int_setting = rule(
+ doc = "An integer flag.",
implementation = _build_setting_impl,
build_setting = config.int(flag = False),
)
diff --git a/test/testdata/cpp_basic_test/golden.md b/test/testdata/cpp_basic_test/golden.md
index 21d4723..7061e26 100755
--- a/test/testdata/cpp_basic_test/golden.md
+++ b/test/testdata/cpp_basic_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#cpp_related_rule"></a>
+
+
+<a id="cpp_related_rule"></a>
## cpp_related_rule
@@ -14,11 +16,11 @@ This rule does cpp-related things.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| fourth | - | Boolean | optional | False |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="cpp_related_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="cpp_related_rule-first"></a>first | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="cpp_related_rule-fourth"></a>fourth | - | Boolean | optional | <code>False</code> |
+| <a id="cpp_related_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="cpp_related_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
diff --git a/test/testdata/cpp_basic_test/input.bzl b/test/testdata/cpp_basic_test/input.bzl
index b927e42..985ad0c 100644
--- a/test/testdata/cpp_basic_test/input.bzl
+++ b/test/testdata/cpp_basic_test/input.bzl
@@ -1,13 +1,15 @@
# buildifier: disable=module-docstring
# buildifier: disable=function-docstring
def exercise_the_api():
- var1 = cc_common.CcToolchainInfo
+ var1 = cc_common.CcToolchainInfo # @unused
exercise_the_api()
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
+# buildifier: disable=unsorted-dict-items
cpp_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does cpp-related things.",
diff --git a/test/testdata/fakedeps/dep.bzl b/test/testdata/fakedeps/dep.bzl
new file mode 100644
index 0000000..1f6a308
--- /dev/null
+++ b/test/testdata/fakedeps/dep.bzl
@@ -0,0 +1,5 @@
+"""A fake bzl to test cross-repository dependencies."""
+
+def give_me_five():
+ """Returns five."""
+ return 5
diff --git a/test/testdata/filter_rules_test/dep.bzl b/test/testdata/filter_rules_test/dep.bzl
index 5c5da10..4368e33 100644
--- a/test/testdata/filter_rules_test/dep.bzl
+++ b/test/testdata/filter_rules_test/dep.bzl
@@ -1,6 +1,7 @@
# buildifier: disable=module-docstring
def my_rule_impl(ctx):
- return []
+ _ignore = [ctx] # @unused
+ return []
my_rule = rule(
implementation = my_rule_impl,
diff --git a/test/testdata/filter_rules_test/golden.md b/test/testdata/filter_rules_test/golden.md
index 12e985f..7e85581 100755
--- a/test/testdata/filter_rules_test/golden.md
+++ b/test/testdata/filter_rules_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+
+
+<a id="my_rule"></a>
## my_rule
@@ -14,13 +16,13 @@ This is my rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | first my_rule doc string | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-first"></a>first | first my_rule doc string | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
-<a name="#whitelisted_dep_rule"></a>
+<a id="whitelisted_dep_rule"></a>
## whitelisted_dep_rule
@@ -34,9 +36,9 @@ This is the dep rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | dep's my_rule doc string | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="whitelisted_dep_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="whitelisted_dep_rule-first"></a>first | dep's my_rule doc string | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="whitelisted_dep_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
diff --git a/test/testdata/filter_rules_test/input.bzl b/test/testdata/filter_rules_test/input.bzl
index 5b8679c..5d05b9b 100644
--- a/test/testdata/filter_rules_test/input.bzl
+++ b/test/testdata/filter_rules_test/input.bzl
@@ -1,11 +1,11 @@
# buildifier: disable=module-docstring
load(
":testdata/filter_rules_test/dep.bzl",
- "my_rule_impl",
dep_rule = "my_rule",
)
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
my_rule = rule(
diff --git a/test/testdata/function_basic_test/golden.md b/test/testdata/function_basic_test/golden.md
index 0fca193..138f3c2 100755
--- a/test/testdata/function_basic_test/golden.md
+++ b/test/testdata/function_basic_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#check_sources"></a>
+A test that verifies basic user function documentation.
+
+<a id="check_sources"></a>
## check_sources
@@ -19,18 +21,56 @@ Use `bazel build` to run the check.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| name | A unique name for this rule. | none |
-| required_param | Use your imagination. | none |
-| bool_param | <p align="center"> - </p> | <code>True</code> |
-| srcs | Source files to run the checks against. | <code>[]</code> |
-| string_param | <p align="center"> - </p> | <code>""</code> |
-| int_param | Your favorite number. | <code>2</code> |
-| dict_param | <p align="center"> - </p> | <code>{}</code> |
-| struct_param | <p align="center"> - </p> | <code>struct(foo = "bar")</code> |
+| :------------- | :------------- | :------------- |
+| <a id="check_sources-name"></a>name | A unique name for this rule. | none |
+| <a id="check_sources-required_param"></a>required_param | Use your imagination. | none |
+| <a id="check_sources-bool_param"></a>bool_param | <p align="center"> - </p> | <code>True</code> |
+| <a id="check_sources-srcs"></a>srcs | Source files to run the checks against. | <code>[]</code> |
+| <a id="check_sources-string_param"></a>string_param | <p align="center"> - </p> | <code>""</code> |
+| <a id="check_sources-int_param"></a>int_param | Your favorite number. | <code>2</code> |
+| <a id="check_sources-dict_param"></a>dict_param | <p align="center"> - </p> | <code>{}</code> |
+| <a id="check_sources-struct_param"></a>struct_param | <p align="center"> - </p> | <code>struct(foo = "bar")</code> |
+
+
+<a id="deprecated_do_not_use"></a>
+
+## deprecated_do_not_use
+
+<pre>
+deprecated_do_not_use()
+</pre>
+
+This function is deprecated.
+
+
+**DEPRECATED**
+
+Use literally anything but this function.
+
+
+<a id="returns_a_thing"></a>
+
+## returns_a_thing
+
+<pre>
+returns_a_thing(<a href="#returns_a_thing-name">name</a>)
+</pre>
+
+Returns a suffixed name.
+
+**PARAMETERS**
+
+
+| Name | Description | Default Value |
+| :------------- | :------------- | :------------- |
+| <a id="returns_a_thing-name"></a>name | A unique name for this rule. | none |
+
+**RETURNS**
+
+A suffixed version of the name.
-<a name="#undocumented_function"></a>
+<a id="undocumented_function"></a>
## undocumented_function
@@ -44,9 +84,9 @@ undocumented_function(<a href="#undocumented_function-a">a</a>, <a href="#undocu
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| a | <p align="center"> - </p> | none |
-| b | <p align="center"> - </p> | none |
-| c | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="undocumented_function-a"></a>a | <p align="center"> - </p> | none |
+| <a id="undocumented_function-b"></a>b | <p align="center"> - </p> | none |
+| <a id="undocumented_function-c"></a>c | <p align="center"> - </p> | none |
diff --git a/test/testdata/function_basic_test/input.bzl b/test/testdata/function_basic_test/input.bzl
index 721e1d3..93bf711 100644
--- a/test/testdata/function_basic_test/input.bzl
+++ b/test/testdata/function_basic_test/input.bzl
@@ -31,8 +31,29 @@ def check_sources(
int_param,
dict_param,
struct_param,
- ]
- x = ("Hah. All that documentation but nothing really to see here")
+ ] # @unused
+ x = ("Hah. All that documentation but nothing really to see here") # @unused
+
+def returns_a_thing(name):
+ """Returns a suffixed name.
+
+ Args:
+ name: A unique name for this rule.
+
+ Returns:
+ A suffixed version of the name.
+ """
+ _ignore = name # @unused
+ pass
+
+def deprecated_do_not_use():
+ """This function is deprecated.
+
+ Deprecated:
+ Use literally anything but this function.
+ """
+ pass
def undocumented_function(a, b, c):
+ _ignore = [a, b, c] # @unused
pass
diff --git a/test/testdata/generated_bzl_test/golden.md b/test/testdata/generated_bzl_test/golden.md
index 58c5713..bd98967 100755
--- a/test/testdata/generated_bzl_test/golden.md
+++ b/test/testdata/generated_bzl_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+A direct dependency file of the input file.
+
+<a id="my_rule"></a>
## my_rule
@@ -14,9 +16,9 @@ This is my rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | first my_rule doc string | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-first"></a>first | first my_rule doc string | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
diff --git a/test/testdata/html_tables_template_test/golden.md b/test/testdata/html_tables_template_test/golden.md
index fb92e03..e933347 100755
--- a/test/testdata/html_tables_template_test/golden.md
+++ b/test/testdata/html_tables_template_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#example_rule"></a>
+Input file for markdown template test
+
+<a id="example_rule"></a>
## example_rule
@@ -13,40 +15,50 @@ Small example of rule using a markdown template.
### Attributes
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
- <tr id="example_rule-name">
- <td><code>name</code></td>
- <td>
- <a href="https://bazel.build/docs/build-ref.html#name">Name</a>; required
- <p>
- A unique name for this target.
- </p>
- </td>
- </tr>
- <tr id="example_rule-first">
- <td><code>first</code></td>
- <td>
- String; optional
- <p>
- This is the first attribute
- </p>
- </td>
- </tr>
- <tr id="example_rule-second">
- <td><code>second</code></td>
- <td>
- String; optional
- </td>
- </tr>
- </tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
+<tr id="example_rule-name">
+<td><code>name</code></td>
+<td>
+
+<a href="https://bazel.build/concepts/labels#target-names">Name</a>; required
+
+<p>
+
+A unique name for this target.
+
+</p>
+</td>
+</tr>
+<tr id="example_rule-first">
+<td><code>first</code></td>
+<td>
+
+String; optional
+
+<p>
+
+This is the first attribute
+
+</p>
+</td>
+</tr>
+<tr id="example_rule-second">
+<td><code>second</code></td>
+<td>
+
+String; optional
+
+</td>
+</tr>
+</tbody>
</table>
-<a name="#ExampleProviderInfo"></a>
+<a id="ExampleProviderInfo"></a>
## ExampleProviderInfo
@@ -59,34 +71,46 @@ Small example of provider using a markdown template.
### Fields
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
- <tr id="ExampleProviderInfo-foo">
- <td><code>foo</code></td>
- <td>
- <p>A string representing foo</p>
- </td>
- </tr>
- <tr id="ExampleProviderInfo-bar">
- <td><code>bar</code></td>
- <td>
- <p>A string representing bar</p>
- </td>
- </tr>
- <tr id="ExampleProviderInfo-baz">
- <td><code>baz</code></td>
- <td>
- <p>A string representing baz</p>
- </td>
- </tr>
- </tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
+<tr id="ExampleProviderInfo-foo">
+<td><code>foo</code></td>
+<td>
+<p>
+
+A string representing foo
+
+</p>
+</td>
+</tr>
+<tr id="ExampleProviderInfo-bar">
+<td><code>bar</code></td>
+<td>
+<p>
+
+A string representing bar
+
+</p>
+</td>
+</tr>
+<tr id="ExampleProviderInfo-baz">
+<td><code>baz</code></td>
+<td>
+<p>
+
+A string representing baz
+
+</p>
+</td>
+</tr>
+</tbody>
</table>
-<a name="#example_function"></a>
+<a id="example_function"></a>
## example_function
@@ -99,34 +123,43 @@ Small example of function using a markdown template.
### Parameters
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
- <tr id="example_function-foo">
- <td><code>foo</code></td>
- <td>
- required.
- <p>
- This parameter does foo related things.
- </p>
- </td>
- </tr>
- <tr id="example_function-bar">
- <td><code>bar</code></td>
- <td>
- optional. default is <code>"bar"</code>
- <p>
- This parameter does bar related things.
- </p>
- </td>
- </tr>
- </tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
+<tr id="example_function-foo">
+<td><code>foo</code></td>
+<td>
+
+required.
+
+<p>
+
+This parameter does foo related things.
+
+</p>
+</td>
+</tr>
+<tr id="example_function-bar">
+<td><code>bar</code></td>
+<td>
+
+optional.
+default is <code>"bar"</code>
+
+<p>
+
+This parameter does bar related things.
+
+</p>
+</td>
+</tr>
+</tbody>
</table>
-<a name="#example_aspect"></a>
+<a id="example_aspect"></a>
## example_aspect
@@ -139,57 +172,69 @@ Small example of aspect using a markdown template.
### Aspect Attributes
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
- <tr id="example_aspect-deps">
- <td><code>deps</code></td>
- <td>
- String; required.
- <tr id="example_aspect-attr_aspect">
- <td><code>attr_aspect</code></td>
- <td>
- String; required.
- </td>
- </tr>
- </tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
+<tr id="example_aspect-deps">
+<td><code>deps</code></td>
+<td>
+String; required.
+</td>
+</tr>
+<tr id="example_aspect-attr_aspect">
+<td><code>attr_aspect</code></td>
+<td>
+String; required.
+</td>
+</tr>
+</tbody>
</table>
### Attributes
<table class="params-table">
- <colgroup>
- <col class="col-param" />
- <col class="col-description" />
- </colgroup>
- <tbody>
- <tr id="example_aspect-name">
- <td><code>name</code></td>
- <td>
- <a href="https://bazel.build/docs/build-ref.html#name">Name</a>; required
- <p>
- A unique name for this target.
- </p>
- </td>
- </tr>
- <tr id="example_aspect-first">
- <td><code>first</code></td>
- <td>
- <a href="https://bazel.build/docs/build-ref.html#labels">Label</a>; required
- </td>
- </tr>
- <tr id="example_aspect-second">
- <td><code>second</code></td>
- <td>
- String; optional
- <p>
- This is the second attribute.
- </p>
- </td>
- </tr>
- </tbody>
+<colgroup>
+<col class="col-param" />
+<col class="col-description" />
+</colgroup>
+<tbody>
+<tr id="example_aspect-name">
+<td><code>name</code></td>
+<td>
+
+<a href="https://bazel.build/concepts/labels#target-names">Name</a>; required
+
+<p>
+
+A unique name for this target.
+
+</p>
+</td>
+</tr>
+<tr id="example_aspect-first">
+<td><code>first</code></td>
+<td>
+
+<a href="https://bazel.build/concepts/labels">Label</a>; required
+
+</td>
+</tr>
+<tr id="example_aspect-second">
+<td><code>second</code></td>
+<td>
+
+String; optional
+
+<p>
+
+This is the second attribute.
+
+</p>
+</td>
+</tr>
+</tbody>
</table>
diff --git a/test/testdata/html_tables_template_test/input.bzl b/test/testdata/html_tables_template_test/input.bzl
index 23f3379..42ca4ac 100644
--- a/test/testdata/html_tables_template_test/input.bzl
+++ b/test/testdata/html_tables_template_test/input.bzl
@@ -7,8 +7,10 @@ def example_function(foo, bar = "bar"):
foo: This parameter does foo related things.
bar: This parameter does bar related things.
"""
+ _ignore = [foo, bar] # @unused
pass
+# buildifier: disable=unsorted-dict-items
ExampleProviderInfo = provider(
doc = "Small example of provider using a markdown template.",
fields = {
@@ -19,6 +21,7 @@ ExampleProviderInfo = provider(
)
def _rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
example_rule = rule(
@@ -31,6 +34,7 @@ example_rule = rule(
)
def _aspect_impl(ctx):
+ _ignore = [ctx] # @unused
return []
example_aspect = aspect(
diff --git a/test/testdata/input_template_test/aspect.vm b/test/testdata/input_template_test/aspect.vm
index 41b08e5..778c60d 100644
--- a/test/testdata/input_template_test/aspect.vm
+++ b/test/testdata/input_template_test/aspect.vm
@@ -1,4 +1,4 @@
-<a name="#${aspectName}"></a>
+<a id="#${aspectName}"></a>
#[[##]]# ${aspectName}
@@ -29,4 +29,4 @@ $aspectInfo.getDocString()
${attribute.docString.trim()}
</p>
#end
-#end \ No newline at end of file
+#end
diff --git a/test/testdata/input_template_test/func.vm b/test/testdata/input_template_test/func.vm
index 80ef25c..113d919 100644
--- a/test/testdata/input_template_test/func.vm
+++ b/test/testdata/input_template_test/func.vm
@@ -1,4 +1,4 @@
-<a name="#${funcInfo.functionName}"></a>
+<a id="#${funcInfo.functionName}"></a>
#[[##]]# ${funcInfo.functionName}
diff --git a/test/testdata/input_template_test/golden.md b/test/testdata/input_template_test/golden.md
index aff43e1..90e9a5d 100755
--- a/test/testdata/input_template_test/golden.md
+++ b/test/testdata/input_template_test/golden.md
@@ -2,7 +2,7 @@
Module Docstring: "Input file for input template test"
-<a name="#my_example"></a>
+<a id="#my_example"></a>
## my_example
@@ -19,7 +19,7 @@ Small example of rule using chosen template.
<b>
<code>name</code>
- <a href="https://bazel.build/docs/build-ref.html#name">Name</a>; required
+ <a href="https://bazel.build/concepts/labels#target-names">Name</a>; required
</b>
<p>
A unique name for this target.
@@ -33,7 +33,7 @@ Small example of rule using chosen template.
</p>
-<a name="#example"></a>
+<a id="#example"></a>
## example
@@ -61,7 +61,7 @@ Stores information about an example in chosen template.
<p>A string representing baz</p>
-<a name="#my_aspect_impl"></a>
+<a id="#my_aspect_impl"></a>
## my_aspect_impl
@@ -79,7 +79,7 @@ my_aspect_impl(<a href="#my_aspect_impl-ctx">ctx</a>)
<code>ctx</code>
required.
-<a name="#template_function"></a>
+<a id="#template_function"></a>
## template_function
@@ -104,7 +104,7 @@ Use `bazel build` to run the check.
</p>
-<a name="#my_aspect"></a>
+<a id="#my_aspect"></a>
## my_aspect
@@ -125,14 +125,14 @@ This is my aspect. It does stuff.
<b>
<code>name</code>
- <a href="https://bazel.build/docs/build-ref.html#name">Name</a>; required
+ <a href="https://bazel.build/concepts/labels#target-names">Name</a>; required
</b>
<p>
A unique name for this target.
</p>
<b>
<code>first</code>
- <a href="https://bazel.build/docs/build-ref.html#labels">Label</a>; required
+ <a href="https://bazel.build/concepts/labels">Label</a>; required
</b>
diff --git a/test/testdata/input_template_test/input.bzl b/test/testdata/input_template_test/input.bzl
index 37fee12..d47d025 100644
--- a/test/testdata/input_template_test/input.bzl
+++ b/test/testdata/input_template_test/input.bzl
@@ -9,8 +9,10 @@ def template_function(foo):
Args:
foo: A unique name for this function.
"""
+ _ignore = [foo] # @unused
pass
+# buildifier: disable=unsorted-dict-items
example = provider(
doc = "Stores information about an example in chosen template.",
fields = {
@@ -21,6 +23,7 @@ example = provider(
)
def _rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
my_example = rule(
@@ -35,6 +38,7 @@ my_example = rule(
)
def my_aspect_impl(ctx):
+ _ignore = [ctx] # @unused
return []
my_aspect = aspect(
diff --git a/test/testdata/input_template_test/provider.vm b/test/testdata/input_template_test/provider.vm
index 269a894..dd84bc7 100644
--- a/test/testdata/input_template_test/provider.vm
+++ b/test/testdata/input_template_test/provider.vm
@@ -1,4 +1,4 @@
-<a name="#${providerName}"></a>
+<a id="#${providerName}"></a>
#[[##]]# ${providerName}
diff --git a/test/testdata/input_template_test/rule.vm b/test/testdata/input_template_test/rule.vm
index 2227637..52f1f26 100644
--- a/test/testdata/input_template_test/rule.vm
+++ b/test/testdata/input_template_test/rule.vm
@@ -1,4 +1,4 @@
-<a name="#${ruleName}"></a>
+<a id="#${ruleName}"></a>
#[[##]]# ${ruleName}
diff --git a/test/testdata/java_basic_test/golden.md b/test/testdata/java_basic_test/golden.md
index 73fef60..a6d0818 100755
--- a/test/testdata/java_basic_test/golden.md
+++ b/test/testdata/java_basic_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#java_related_rule"></a>
+
+
+<a id="java_related_rule"></a>
## java_related_rule
@@ -14,11 +16,11 @@ This rule does java-related things.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| fourth | - | Boolean | optional | False |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="java_related_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="java_related_rule-first"></a>first | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="java_related_rule-fourth"></a>fourth | - | Boolean | optional | <code>False</code> |
+| <a id="java_related_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="java_related_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
diff --git a/test/testdata/java_basic_test/input.bzl b/test/testdata/java_basic_test/input.bzl
index db0d064..d61141f 100644
--- a/test/testdata/java_basic_test/input.bzl
+++ b/test/testdata/java_basic_test/input.bzl
@@ -1,15 +1,17 @@
# buildifier: disable=module-docstring
# buildifier: disable=function-docstring
def exercise_the_api():
- var1 = java_common.JavaRuntimeInfo
- var2 = JavaInfo
- var3 = java_proto_common
+ var1 = java_common.JavaRuntimeInfo # @unused
+ var2 = JavaInfo # @unused
+ var3 = java_proto_common # @unused
exercise_the_api()
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
+# buildifier: disable=unsorted-dict-items
java_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does java-related things.",
diff --git a/test/testdata/local_repository_test/BUILD b/test/testdata/local_repository_test/BUILD
index 05fdc75..0e09021 100644
--- a/test/testdata/local_repository_test/BUILD
+++ b/test/testdata/local_repository_test/BUILD
@@ -1,4 +1,5 @@
-load("@io_bazel_skydoc//stardoc:stardoc.bzl", "stardoc")
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
package(
default_visibility = ["//visibility:public"],
@@ -15,4 +16,13 @@ stardoc(
name = "input_doc",
out = "output.md",
input = ":input.bzl",
+ deps = [":lib"],
+)
+
+bzl_library(
+ name = "lib",
+ srcs = [
+ "input.bzl",
+ "@io_bazel_stardoc//test:testdata/fakedeps/dep.bzl",
+ ],
)
diff --git a/test/testdata/local_repository_test/golden.md b/test/testdata/local_repository_test/golden.md
index ef3e91f..d06bf71 100755
--- a/test/testdata/local_repository_test/golden.md
+++ b/test/testdata/local_repository_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#min"></a>
+A test that verifies documenting functions in an input file under a local_repository.
+
+<a id="min"></a>
## min
@@ -14,7 +16,11 @@ Returns the minimum of given elements.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| integers | A list of integers. Must not be empty. | none |
+| :------------- | :------------- | :------------- |
+| <a id="min-integers"></a>integers | A list of integers. Must not be empty. | none |
+
+**RETURNS**
+
+The minimum integer in the given list.
diff --git a/test/testdata/local_repository_test/input.bzl b/test/testdata/local_repository_test/input.bzl
index 62f0982..fdd686b 100644
--- a/test/testdata/local_repository_test/input.bzl
+++ b/test/testdata/local_repository_test/input.bzl
@@ -1,5 +1,7 @@
"""A test that verifies documenting functions in an input file under a local_repository."""
+load("@io_bazel_stardoc//test/testdata/fakedeps:dep.bzl", "give_me_five")
+
def min(integers):
"""Returns the minimum of given elements.
@@ -9,7 +11,5 @@ def min(integers):
Returns:
The minimum integer in the given list.
"""
- _ignore = [integers]
- return 42
-
-
+ _ignore = [integers] # @unused
+ return give_me_five()
diff --git a/test/testdata/macro_kwargs_test/golden.md b/test/testdata/macro_kwargs_test/golden.md
index 74f9d7d..d2af867 100755
--- a/test/testdata/macro_kwargs_test/golden.md
+++ b/test/testdata/macro_kwargs_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#macro_with_args"></a>
+Tests for functions which use *args or **kwargs
+
+<a id="macro_with_args"></a>
## macro_with_args
@@ -14,12 +16,16 @@ My args macro is OK.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| name | The name of the test rule. | none |
-| args | Other arguments to include | none |
+| :------------- | :------------- | :------------- |
+| <a id="macro_with_args-name"></a>name | The name of the test rule. | none |
+| <a id="macro_with_args-args"></a>args | Other arguments to include | none |
+
+**RETURNS**
+An empty list.
-<a name="#macro_with_both"></a>
+
+<a id="macro_with_both"></a>
## macro_with_both
@@ -36,14 +42,18 @@ Not much else to say.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| name | The name of the test rule. | none |
-| number | Some number used for important things | <code>3</code> |
-| args | Other arguments to include | none |
-| kwargs | Other attributes to include | none |
+| :------------- | :------------- | :------------- |
+| <a id="macro_with_both-name"></a>name | The name of the test rule. | none |
+| <a id="macro_with_both-number"></a>number | Some number used for important things | <code>3</code> |
+| <a id="macro_with_both-args"></a>args | Other arguments to include | none |
+| <a id="macro_with_both-kwargs"></a>kwargs | Other attributes to include | none |
+
+**RETURNS**
+An empty list.
-<a name="#macro_with_kwargs"></a>
+
+<a id="macro_with_kwargs"></a>
## macro_with_kwargs
@@ -64,10 +74,14 @@ vel mollis eros pellentesque.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| name | The name of the test rule. | none |
-| config | Config to use for my macro | none |
-| deps | List of my macro's dependencies | <code>[]</code> |
-| kwargs | Other attributes to include | none |
+| :------------- | :------------- | :------------- |
+| <a id="macro_with_kwargs-name"></a>name | The name of the test rule. | none |
+| <a id="macro_with_kwargs-config"></a>config | Config to use for my macro | none |
+| <a id="macro_with_kwargs-deps"></a>deps | List of my macro's dependencies | <code>[]</code> |
+| <a id="macro_with_kwargs-kwargs"></a>kwargs | Other attributes to include | none |
+
+**RETURNS**
+
+An empty list.
diff --git a/test/testdata/macro_kwargs_test/input.bzl b/test/testdata/macro_kwargs_test/input.bzl
index 0f6268d..8de782e 100644
--- a/test/testdata/macro_kwargs_test/input.bzl
+++ b/test/testdata/macro_kwargs_test/input.bzl
@@ -18,7 +18,7 @@ def macro_with_kwargs(name, config, deps = [], **kwargs):
Returns:
An empty list.
"""
- _ignore = [name, config, deps, kwargs]
+ _ignore = [name, config, deps, kwargs] # @unused
return []
def macro_with_args(name, *args):
@@ -31,7 +31,7 @@ def macro_with_args(name, *args):
Returns:
An empty list.
"""
- _ignore = [name, args]
+ _ignore = [name, args] # @unused
return []
def macro_with_both(name, number = 3, *args, **kwargs):
@@ -48,5 +48,5 @@ def macro_with_both(name, number = 3, *args, **kwargs):
Returns:
An empty list.
"""
- _ignore = [name, number, args, kwargs]
+ _ignore = [name, number, args, kwargs] # @unused
return []
diff --git a/test/testdata/misc_apis_test/golden.md b/test/testdata/misc_apis_test/golden.md
index 2a93a2f..7b94d9f 100755
--- a/test/testdata/misc_apis_test/golden.md
+++ b/test/testdata/misc_apis_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+
+
+<a id="my_rule"></a>
## my_rule
@@ -14,16 +16,16 @@ This rule exercises some of the build API.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| deps | A list of dependencies. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
-| extra_arguments | - | List of strings | optional | [] |
-| out | The output file. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| src | The source file. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| tool | The location of the tool to use. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | //foo/bar/baz:target |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-deps"></a>deps | A list of dependencies. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
+| <a id="my_rule-extra_arguments"></a>extra_arguments | - | List of strings | optional | <code>[]</code> |
+| <a id="my_rule-out"></a>out | The output file. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-src"></a>src | The source file. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>None</code> |
+| <a id="my_rule-tool"></a>tool | The location of the tool to use. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>//foo/bar/baz:target</code> |
-<a name="#MyInfo"></a>
+<a id="MyInfo"></a>
## MyInfo
@@ -37,12 +39,12 @@ MyInfo(<a href="#MyInfo-foo">foo</a>, <a href="#MyInfo-bar">bar</a>)
| Name | Description |
-| :-------------: | :-------------: |
-| foo | Something foo-related. |
-| bar | Something bar-related. |
+| :------------- | :------------- |
+| <a id="MyInfo-foo"></a>foo | Something foo-related. |
+| <a id="MyInfo-bar"></a>bar | Something bar-related. |
-<a name="#exercise_the_api"></a>
+<a id="exercise_the_api"></a>
## exercise_the_api
@@ -52,11 +54,9 @@ exercise_the_api()
-**PARAMETERS**
-
-<a name="#my_rule_impl"></a>
+<a id="my_rule_impl"></a>
## my_rule_impl
@@ -70,7 +70,7 @@ my_rule_impl(<a href="#my_rule_impl-ctx">ctx</a>)
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| ctx | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_rule_impl-ctx"></a>ctx | <p align="center"> - </p> | none |
diff --git a/test/testdata/misc_apis_test/input.bzl b/test/testdata/misc_apis_test/input.bzl
index 943442f..925b698 100644
--- a/test/testdata/misc_apis_test/input.bzl
+++ b/test/testdata/misc_apis_test/input.bzl
@@ -4,19 +4,22 @@
config = "value for global config variable"
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
def exercise_the_api():
- var1 = config_common.FeatureFlagInfo
- var2 = platform_common.TemplateVariableInfo
+ var1 = config_common.FeatureFlagInfo # @unused
+ var2 = platform_common.TemplateVariableInfo # @unused
var3 = repository_rule(
implementation = my_rule_impl,
doc = "This repository rule has documentation.",
- )
- var4 = testing.ExecutionInfo({})
+ ) # @unused
+ var4 = testing.ExecutionInfo({}) # @unused
exercise_the_api()
+# buildifier: disable=provider-params
+# buildifier: disable=unsorted-dict-items
MyInfo = provider(
fields = {
"foo": "Something foo-related.",
@@ -26,6 +29,7 @@ MyInfo = provider(
my_info = MyInfo(foo = "x", bar = "y")
+# buildifier: disable=unsorted-dict-items
my_rule = rule(
implementation = my_rule_impl,
doc = "This rule exercises some of the build API.",
@@ -45,7 +49,7 @@ A list of dependencies.
doc = "The location of the tool to use.",
allow_files = True,
default = Label("//foo/bar/baz:target"),
- cfg = "host",
+ cfg = "exec",
executable = True,
),
"out": attr.output(
diff --git a/test/testdata/multi_level_namespace_test/golden.md b/test/testdata/multi_level_namespace_test/golden.md
index d036b1a..85791c9 100755
--- a/test/testdata/multi_level_namespace_test/golden.md
+++ b/test/testdata/multi_level_namespace_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_namespace.min"></a>
+A test that verifies documenting a multi-leveled namespace of functions.
+
+<a id="my_namespace.min"></a>
## my_namespace.min
@@ -14,11 +16,15 @@ Returns the minimum of given elements.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| integers | A list of integers. Must not be empty. | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_namespace.min-integers"></a>integers | A list of integers. Must not be empty. | none |
+
+**RETURNS**
+
+The minimum integer in the given list.
-<a name="#my_namespace.math.min"></a>
+<a id="my_namespace.math.min"></a>
## my_namespace.math.min
@@ -32,11 +38,15 @@ Returns the minimum of given elements.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| integers | A list of integers. Must not be empty. | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_namespace.math.min-integers"></a>integers | A list of integers. Must not be empty. | none |
+**RETURNS**
-<a name="#my_namespace.foo.bar.baz"></a>
+The minimum integer in the given list.
+
+
+<a id="my_namespace.foo.bar.baz"></a>
## my_namespace.foo.bar.baz
@@ -46,11 +56,9 @@ my_namespace.foo.bar.baz()
This function does nothing.
-**PARAMETERS**
-
-<a name="#my_namespace.one.two.min"></a>
+<a id="my_namespace.one.two.min"></a>
## my_namespace.one.two.min
@@ -64,11 +72,15 @@ Returns the minimum of given elements.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| integers | A list of integers. Must not be empty. | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_namespace.one.two.min-integers"></a>integers | A list of integers. Must not be empty. | none |
+
+**RETURNS**
+
+The minimum integer in the given list.
-<a name="#my_namespace.one.three.does_nothing"></a>
+<a id="my_namespace.one.three.does_nothing"></a>
## my_namespace.one.three.does_nothing
@@ -78,7 +90,5 @@ my_namespace.one.three.does_nothing()
This function does nothing.
-**PARAMETERS**
-
diff --git a/test/testdata/multi_level_namespace_test/input.bzl b/test/testdata/multi_level_namespace_test/input.bzl
index 8b0b436..0a5aa11 100644
--- a/test/testdata/multi_level_namespace_test/input.bzl
+++ b/test/testdata/multi_level_namespace_test/input.bzl
@@ -9,7 +9,7 @@ def _min(integers):
Returns:
The minimum integer in the given list.
"""
- _ignore = [integers]
+ _ignore = [integers] # @unused
return 42
def _does_nothing():
diff --git a/test/testdata/multi_level_namespace_test_with_whitelist/golden.md b/test/testdata/multi_level_namespace_test_with_whitelist/golden.md
index 829b96b..1ca1608 100644
--- a/test/testdata/multi_level_namespace_test_with_whitelist/golden.md
+++ b/test/testdata/multi_level_namespace_test_with_whitelist/golden.md
@@ -1,6 +1,10 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_namespace.min"></a>
+A test that verifies documenting a multi-leveled namespace of functions with whitelist symbols.
+The whitelist symbols should cause everything in my_namespace to to be documented, but only a
+specific symbol in other_namespace to be documented.
+
+<a id="my_namespace.min"></a>
## my_namespace.min
@@ -14,11 +18,11 @@ Returns the minimum of given elements.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| integers | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_namespace.min-integers"></a>integers | <p align="center"> - </p> | none |
-<a name="#my_namespace.math.min"></a>
+<a id="my_namespace.math.min"></a>
## my_namespace.math.min
@@ -32,11 +36,11 @@ Returns the minimum of given elements.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| integers | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_namespace.math.min-integers"></a>integers | <p align="center"> - </p> | none |
-<a name="#other_namespace.foo.nothing"></a>
+<a id="other_namespace.foo.nothing"></a>
## other_namespace.foo.nothing
@@ -46,7 +50,5 @@ other_namespace.foo.nothing()
This function does nothing.
-**PARAMETERS**
-
diff --git a/test/testdata/multi_level_namespace_test_with_whitelist/input.bzl b/test/testdata/multi_level_namespace_test_with_whitelist/input.bzl
index 34eb87b..f070309 100644
--- a/test/testdata/multi_level_namespace_test_with_whitelist/input.bzl
+++ b/test/testdata/multi_level_namespace_test_with_whitelist/input.bzl
@@ -4,7 +4,7 @@ specific symbol in other_namespace to be documented."""
def _min(integers):
"""Returns the minimum of given elements."""
- _ignore = [integers]
+ _ignore = [integers] # @unused
return 42
def _does_nothing():
diff --git a/test/testdata/multiple_files_test/dep.bzl b/test/testdata/multiple_files_test/dep.bzl
index b1beece..75a0b21 100644
--- a/test/testdata/multiple_files_test/dep.bzl
+++ b/test/testdata/multiple_files_test/dep.bzl
@@ -10,7 +10,7 @@ def some_cool_function(name, srcs = [], beef = ""):
srcs: What sources you want cool stuff to happen to.
beef: Your opinion on beef.
"""
- x = (name, srcs, beef)
+ x = (name, srcs, beef) # @unused
prep_work()
diff --git a/test/testdata/multiple_files_test/golden.md b/test/testdata/multiple_files_test/golden.md
index a6ca7f0..0fab337 100755
--- a/test/testdata/multiple_files_test/golden.md
+++ b/test/testdata/multiple_files_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+A direct dependency file of the input file.
+
+<a id="my_rule"></a>
## my_rule
@@ -14,13 +16,13 @@ This is my rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | first my_rule doc string | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-first"></a>first | first my_rule doc string | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
-<a name="#other_rule"></a>
+<a id="other_rule"></a>
## other_rule
@@ -34,13 +36,13 @@ This is another rule.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| fourth | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| third | third other_rule doc string | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="other_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="other_rule-fourth"></a>fourth | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="other_rule-third"></a>third | third other_rule doc string | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
-<a name="#yet_another_rule"></a>
+<a id="yet_another_rule"></a>
## yet_another_rule
@@ -54,12 +56,12 @@ This is yet another rule
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| fifth | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="yet_another_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="yet_another_rule-fifth"></a>fifth | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
-<a name="#top_fun"></a>
+<a id="top_fun"></a>
## top_fun
@@ -73,9 +75,9 @@ top_fun(<a href="#top_fun-a">a</a>, <a href="#top_fun-b">b</a>, <a href="#top_fu
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| a | <p align="center"> - </p> | none |
-| b | <p align="center"> - </p> | none |
-| c | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="top_fun-a"></a>a | <p align="center"> - </p> | none |
+| <a id="top_fun-b"></a>b | <p align="center"> - </p> | none |
+| <a id="top_fun-c"></a>c | <p align="center"> - </p> | none |
diff --git a/test/testdata/multiple_files_test/inner_dep.bzl b/test/testdata/multiple_files_test/inner_dep.bzl
index 16d4361..6d4b582 100644
--- a/test/testdata/multiple_files_test/inner_dep.bzl
+++ b/test/testdata/multiple_files_test/inner_dep.bzl
@@ -5,5 +5,5 @@ def prep_work():
return 1
def inner_rule_impl(ctx):
- _ignore = [ctx]
+ _ignore = [ctx] # @unused
return struct()
diff --git a/test/testdata/multiple_files_test/input.bzl b/test/testdata/multiple_files_test/input.bzl
index 5b46c54..0e033f1 100644
--- a/test/testdata/multiple_files_test/input.bzl
+++ b/test/testdata/multiple_files_test/input.bzl
@@ -19,6 +19,7 @@ def top_fun(a, b, c):
some_cool_function(a, b, c)
return 6
+# buildifier: disable=unsorted-dict-items
other_rule = rule(
implementation = my_rule_impl,
doc = "This is another rule.",
diff --git a/test/testdata/multiple_rules_test/golden.md b/test/testdata/multiple_rules_test/golden.md
index ca4f407..085fec8 100755
--- a/test/testdata/multiple_rules_test/golden.md
+++ b/test/testdata/multiple_rules_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+
+
+<a id="my_rule"></a>
## my_rule
@@ -14,13 +16,13 @@ This is my rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-first"></a>first | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
-<a name="#other_rule"></a>
+<a id="other_rule"></a>
## other_rule
@@ -34,13 +36,13 @@ This is another rule.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| fourth | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="other_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="other_rule-fourth"></a>fourth | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="other_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
-<a name="#yet_another_rule"></a>
+<a id="yet_another_rule"></a>
## yet_another_rule
@@ -54,12 +56,12 @@ This is yet another rule
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| fifth | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="yet_another_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="yet_another_rule-fifth"></a>fifth | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
-<a name="#my_rule_impl"></a>
+<a id="my_rule_impl"></a>
## my_rule_impl
@@ -73,7 +75,7 @@ my_rule_impl(<a href="#my_rule_impl-ctx">ctx</a>)
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| ctx | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_rule_impl-ctx"></a>ctx | <p align="center"> - </p> | none |
diff --git a/test/testdata/multiple_rules_test/input.bzl b/test/testdata/multiple_rules_test/input.bzl
index 7a2d314..bb601e5 100644
--- a/test/testdata/multiple_rules_test/input.bzl
+++ b/test/testdata/multiple_rules_test/input.bzl
@@ -1,5 +1,6 @@
# buildifier: disable=module-docstring
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
my_rule = rule(
@@ -11,6 +12,7 @@ my_rule = rule(
},
)
+# buildifier: disable=unsorted-dict-items
other_rule = rule(
implementation = my_rule_impl,
doc = "This is another rule.",
@@ -21,6 +23,7 @@ other_rule = rule(
},
)
+# buildifier: disable=unsorted-dict-items
yet_another_rule = rule(
implementation = my_rule_impl,
doc = "This is yet another rule",
diff --git a/test/testdata/namespace_test/golden.md b/test/testdata/namespace_test/golden.md
index a26526d..f840fcf 100755
--- a/test/testdata/namespace_test/golden.md
+++ b/test/testdata/namespace_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_namespace.assert_non_empty"></a>
+A test that verifies documenting a namespace of functions.
+
+<a id="my_namespace.assert_non_empty"></a>
## my_namespace.assert_non_empty
@@ -14,12 +16,12 @@ Asserts the two given lists are not empty.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| some_list | The first list | none |
-| other_list | The second list | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_namespace.assert_non_empty-some_list"></a>some_list | The first list | none |
+| <a id="my_namespace.assert_non_empty-other_list"></a>other_list | The second list | none |
-<a name="#my_namespace.min"></a>
+<a id="my_namespace.min"></a>
## my_namespace.min
@@ -33,11 +35,15 @@ Returns the minimum of given elements.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| integers | A list of integers. Must not be empty. | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_namespace.min-integers"></a>integers | A list of integers. Must not be empty. | none |
+
+**RETURNS**
+
+The minimum integer in the given list.
-<a name="#my_namespace.join_strings"></a>
+<a id="my_namespace.join_strings"></a>
## my_namespace.join_strings
@@ -51,8 +57,12 @@ Joins the given strings with a delimiter.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| strings | A list of strings to join. | none |
-| delimiter | The delimiter to use | <code>", "</code> |
+| :------------- | :------------- | :------------- |
+| <a id="my_namespace.join_strings-strings"></a>strings | A list of strings to join. | none |
+| <a id="my_namespace.join_strings-delimiter"></a>delimiter | The delimiter to use | <code>", "</code> |
+
+**RETURNS**
+
+The joined string.
diff --git a/test/testdata/namespace_test/input.bzl b/test/testdata/namespace_test/input.bzl
index 69cad64..eaf256d 100644
--- a/test/testdata/namespace_test/input.bzl
+++ b/test/testdata/namespace_test/input.bzl
@@ -9,7 +9,7 @@ def _min(integers):
Returns:
The minimum integer in the given list.
"""
- _ignore = [integers]
+ _ignore = [integers] # @unused
return 42
def _assert_non_empty(some_list, other_list):
@@ -19,7 +19,7 @@ def _assert_non_empty(some_list, other_list):
some_list: The first list
other_list: The second list
"""
- _ignore = [some_list, other_list]
+ _ignore = [some_list, other_list] # @unused
fail("Not implemented")
def _join_strings(strings, delimiter = ", "):
@@ -32,7 +32,7 @@ def _join_strings(strings, delimiter = ", "):
Returns:
The joined string.
"""
- _ignore = [strings, delimiter]
+ _ignore = [strings, delimiter] # @unused
return ""
my_namespace = struct(
diff --git a/test/testdata/proto_format_test/golden.raw b/test/testdata/proto_format_test/golden.raw
index d158834..a93d367 100644
--- a/test/testdata/proto_format_test/golden.raw
+++ b/test/testdata/proto_format_test/golden.raw
Binary files differ
diff --git a/test/testdata/proto_format_test/input.bzl b/test/testdata/proto_format_test/input.bzl
index aee171e..c076b3f 100644
--- a/test/testdata/proto_format_test/input.bzl
+++ b/test/testdata/proto_format_test/input.bzl
@@ -9,8 +9,10 @@ def check_function(foo):
Args:
foo: A unique name for this rule.
"""
+ _ignore = foo # @unused
pass
+# buildifier: disable=unsorted-dict-items
example = provider(
doc = "Stores information about an example.",
fields = {
@@ -21,6 +23,7 @@ example = provider(
)
def _rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
my_example = rule(
diff --git a/test/testdata/provider_basic_test/golden.md b/test/testdata/provider_basic_test/golden.md
index 2154f34..a9d76bf 100755
--- a/test/testdata/provider_basic_test/golden.md
+++ b/test/testdata/provider_basic_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#MyFooInfo"></a>
+
+
+<a id="MyFooInfo"></a>
## MyFooInfo
@@ -14,12 +16,12 @@ Stores information about a foo.
| Name | Description |
-| :-------------: | :-------------: |
-| bar | (Undocumented) |
-| baz | (Undocumented) |
+| :------------- | :------------- |
+| <a id="MyFooInfo-bar"></a>bar | (Undocumented) |
+| <a id="MyFooInfo-baz"></a>baz | (Undocumented) |
-<a name="#MyPoorlyDocumentedInfo"></a>
+<a id="MyPoorlyDocumentedInfo"></a>
## MyPoorlyDocumentedInfo
@@ -33,7 +35,7 @@ MyPoorlyDocumentedInfo()
-<a name="#MyVeryDocumentedInfo"></a>
+<a id="MyVeryDocumentedInfo"></a>
## MyVeryDocumentedInfo
@@ -50,8 +52,8 @@ Look on my works, ye mighty, and despair!
| Name | Description |
-| :-------------: | :-------------: |
-| favorite_food | A string representing my favorite food |
-| favorite_color | A string representing my favorite color |
+| :------------- | :------------- |
+| <a id="MyVeryDocumentedInfo-favorite_food"></a>favorite_food | A string representing my favorite food |
+| <a id="MyVeryDocumentedInfo-favorite_color"></a>favorite_color | A string representing my favorite color |
diff --git a/test/testdata/provider_basic_test/input.bzl b/test/testdata/provider_basic_test/input.bzl
index 7600f2c..bb76c0d 100644
--- a/test/testdata/provider_basic_test/input.bzl
+++ b/test/testdata/provider_basic_test/input.bzl
@@ -1,4 +1,5 @@
# buildifier: disable=module-docstring
+# buildifier: disable=provider-params
MyPoorlyDocumentedInfo = provider()
MyFooInfo = provider(
@@ -6,6 +7,7 @@ MyFooInfo = provider(
fields = ["bar", "baz"],
)
+# buildifier: disable=unsorted-dict-items
MyVeryDocumentedInfo = provider(
doc = """
A provider with some really neat documentation.
diff --git a/test/testdata/providers_for_attributes_test/dep.bzl b/test/testdata/providers_for_attributes_test/dep.bzl
index 56ab3b7..841c561 100644
--- a/test/testdata/providers_for_attributes_test/dep.bzl
+++ b/test/testdata/providers_for_attributes_test/dep.bzl
@@ -1,5 +1,6 @@
"A file to test providers not defined in the same file."
+# buildifier: disable=provider-params
DepProviderInfo = provider(
doc = "This provider does something.",
)
diff --git a/test/testdata/providers_for_attributes_test/golden.md b/test/testdata/providers_for_attributes_test/golden.md
index 9f1dd2b..24ebf27 100755
--- a/test/testdata/providers_for_attributes_test/golden.md
+++ b/test/testdata/providers_for_attributes_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+The input file for the providers for attributes test
+
+<a id="my_rule"></a>
## my_rule
@@ -14,17 +16,17 @@ This rule does things.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| fifth | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| first | this is the first attribute. | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: Label -> String</a> | optional | {} |
-| fourth | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| second | - | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |
-| sixth | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-fifth"></a>fifth | - | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>None</code> |
+| <a id="my_rule-first"></a>first | this is the first attribute. | <a href="https://bazel.build/rules/lib/dict">Dictionary: Label -> String</a> | optional | <code>{}</code> |
+| <a id="my_rule-fourth"></a>fourth | - | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>None</code> |
+| <a id="my_rule-second"></a>second | - | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | <code>[]</code> |
+| <a id="my_rule-sixth"></a>sixth | - | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>None</code> |
+| <a id="my_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | optional | <code>None</code> |
-<a name="#MyProviderInfo"></a>
+<a id="MyProviderInfo"></a>
## MyProviderInfo
@@ -38,12 +40,12 @@ MyProviderInfo(<a href="#MyProviderInfo-foo">foo</a>, <a href="#MyProviderInfo-b
| Name | Description |
-| :-------------: | :-------------: |
-| foo | Something foo-related. |
-| bar | Something bar-related. |
+| :------------- | :------------- |
+| <a id="MyProviderInfo-foo"></a>foo | Something foo-related. |
+| <a id="MyProviderInfo-bar"></a>bar | Something bar-related. |
-<a name="#OtherProviderInfo"></a>
+<a id="OtherProviderInfo"></a>
## OtherProviderInfo
@@ -57,7 +59,7 @@ OtherProviderInfo()
-<a name="#my_rule_impl"></a>
+<a id="my_rule_impl"></a>
## my_rule_impl
@@ -71,7 +73,7 @@ my_rule_impl(<a href="#my_rule_impl-ctx">ctx</a>)
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| ctx | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_rule_impl-ctx"></a>ctx | <p align="center"> - </p> | none |
diff --git a/test/testdata/providers_for_attributes_test/input.bzl b/test/testdata/providers_for_attributes_test/input.bzl
index 284852d..1fb4ea2 100644
--- a/test/testdata/providers_for_attributes_test/input.bzl
+++ b/test/testdata/providers_for_attributes_test/input.bzl
@@ -3,8 +3,11 @@
load(":testdata/providers_for_attributes_test/dep.bzl", "DepProviderInfo")
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
+# buildifier: disable=provider-params
+# buildifier: disable=unsorted-dict-items
MyProviderInfo = provider(
fields = {
"foo": "Something foo-related.",
@@ -12,9 +15,11 @@ MyProviderInfo = provider(
},
)
+# buildifier: disable=provider-params
OtherProviderInfo = provider()
other_provider_info = OtherProviderInfo(fields = ["foo"])
+# buildifier: disable=unsorted-dict-items
my_rule = rule(
implementation = my_rule_impl,
doc = "This rule does things.",
diff --git a/test/testdata/py_rule_test/golden.md b/test/testdata/py_rule_test/golden.md
index 81b44d8..0550bf9 100755
--- a/test/testdata/py_rule_test/golden.md
+++ b/test/testdata/py_rule_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#py_related_rule"></a>
+The input file for the python rule test
+
+<a id="py_related_rule"></a>
## py_related_rule
@@ -14,13 +16,13 @@ This rule does python-related things.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| fifth | Hey look, its the fifth thing! | Boolean | optional | True |
-| first | this is the first doc string! | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| fourth | the fourth doc string. | Boolean | optional | False |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| sixth | it's the sixth thing. | List of integers | optional | range(0, 10) |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="py_related_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="py_related_rule-fifth"></a>fifth | Hey look, its the fifth thing! | Boolean | optional | <code>True</code> |
+| <a id="py_related_rule-first"></a>first | this is the first doc string! | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="py_related_rule-fourth"></a>fourth | the fourth doc string. | Boolean | optional | <code>False</code> |
+| <a id="py_related_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="py_related_rule-sixth"></a>sixth | it's the sixth thing. | List of integers | optional | <code>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]</code> |
+| <a id="py_related_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
diff --git a/test/testdata/py_rule_test/input.bzl b/test/testdata/py_rule_test/input.bzl
index 0d6bc16..289738b 100644
--- a/test/testdata/py_rule_test/input.bzl
+++ b/test/testdata/py_rule_test/input.bzl
@@ -1,14 +1,16 @@
"""The input file for the python rule test"""
def exercise_the_api():
- var1 = PyRuntimeInfo
- var2 = PyInfo
+ var1 = PyRuntimeInfo # @unused
+ var2 = PyInfo # @unused
exercise_the_api()
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
+# buildifier: disable=unsorted-dict-items
py_related_rule = rule(
implementation = my_rule_impl,
doc = "This rule does python-related things.",
diff --git a/test/testdata/repo_rules_test/golden.md b/test/testdata/repo_rules_test/golden.md
index b40071f..87391e3 100755
--- a/test/testdata/repo_rules_test/golden.md
+++ b/test/testdata/repo_rules_test/golden.md
@@ -1,11 +1,13 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_repo"></a>
+
+
+<a id="my_repo"></a>
## my_repo
<pre>
-my_repo(<a href="#my_repo-name">name</a>, <a href="#my_repo-useless">useless</a>)
+my_repo(<a href="#my_repo-name">name</a>, <a href="#my_repo-repo_mapping">repo_mapping</a>, <a href="#my_repo-useless">useless</a>)
</pre>
Minimal example of a repository rule.
@@ -14,8 +16,9 @@ Minimal example of a repository rule.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this repository. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| useless | This argument will be ingored. You don't have to specify it, but you may. | String | optional | "ignoreme" |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_repo-name"></a>name | A unique name for this repository. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_repo-repo_mapping"></a>repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.&lt;p&gt;For example, an entry <code>"@foo": "@bar"</code> declares that, for any time this repository depends on <code>@foo</code> (such as a dependency on <code>@foo//some:target</code>, it should actually resolve that dependency within globally-declared <code>@bar</code> (<code>@bar//some:target</code>). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="my_repo-useless"></a>useless | This argument will be ingored. You don't have to specify it, but you may. | String | optional | <code>"ignoreme"</code> |
diff --git a/test/testdata/same_level_file_test/dep.bzl b/test/testdata/same_level_file_test/dep.bzl
index 87750b3..f6a7f64 100644
--- a/test/testdata/same_level_file_test/dep.bzl
+++ b/test/testdata/same_level_file_test/dep.bzl
@@ -1,5 +1,5 @@
# buildifier: disable=module-docstring
# buildifier: disable=function-docstring
def my_rule_impl(ctx):
- _ignore = [ctx]
+ _ignore = [ctx] # @unused
return struct()
diff --git a/test/testdata/same_level_file_test/golden.md b/test/testdata/same_level_file_test/golden.md
index 58c5713..66b9a97 100755
--- a/test/testdata/same_level_file_test/golden.md
+++ b/test/testdata/same_level_file_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+
+
+<a id="my_rule"></a>
## my_rule
@@ -14,9 +16,9 @@ This is my rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | first my_rule doc string | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-first"></a>first | first my_rule doc string | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
diff --git a/test/testdata/simple_test/golden.md b/test/testdata/simple_test/golden.md
index 0a4276f..b203bd2 100755
--- a/test/testdata/simple_test/golden.md
+++ b/test/testdata/simple_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule"></a>
+
+
+<a id="my_rule"></a>
## my_rule
@@ -14,11 +16,11 @@ This is my rule. It does stuff.
| Name | Description | Type | Mandatory | Default |
-| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: |
-| name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
-| first | first doc string | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
-| fourth | fourth doc string | Boolean | optional | False |
-| second | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
-| third | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="my_rule-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="my_rule-first"></a>first | first doc string | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+| <a id="my_rule-fourth"></a>fourth | fourth doc string | Boolean | optional | <code>False</code> |
+| <a id="my_rule-second"></a>second | - | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | required | |
+| <a id="my_rule-third"></a>third | - | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
diff --git a/test/testdata/simple_test/input.bzl b/test/testdata/simple_test/input.bzl
index fe0ffc7..0e3243d 100644
--- a/test/testdata/simple_test/input.bzl
+++ b/test/testdata/simple_test/input.bzl
@@ -1,7 +1,9 @@
# buildifier: disable=module-docstring
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
+# buildifier: disable=unsorted-dict-items
my_rule = rule(
implementation = my_rule_impl,
doc = "This is my rule. It does stuff.",
diff --git a/test/testdata/struct_default_value_test/golden.md b/test/testdata/struct_default_value_test/golden.md
index 6b15c1d..6d07214 100755
--- a/test/testdata/struct_default_value_test/golden.md
+++ b/test/testdata/struct_default_value_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#check_struct_default_values"></a>
+The input file for struct default values test
+
+<a id="check_struct_default_values"></a>
## check_struct_default_values
@@ -15,11 +17,11 @@ Checks the default values of structs.
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| struct_no_args | struct with no arguments | <code>struct()</code> |
-| struct_arg | struct with one argument | <code>struct(foo = "bar")</code> |
-| struct_args | struct with multiple arguments | <code>struct(bar = "foo", foo = "bar")</code> |
-| struct_int_args | struct with int arguments | <code>struct(one = 1, three = 3, two = 2)</code> |
-| struct_struct_args | struct with struct arguments | <code>struct(multiple = struct(one = 1, three = 3, two = 2), none = struct(), one = struct(foo = "bar"))</code> |
+| :------------- | :------------- | :------------- |
+| <a id="check_struct_default_values-struct_no_args"></a>struct_no_args | struct with no arguments | <code>struct()</code> |
+| <a id="check_struct_default_values-struct_arg"></a>struct_arg | struct with one argument | <code>struct(foo = "bar")</code> |
+| <a id="check_struct_default_values-struct_args"></a>struct_args | struct with multiple arguments | <code>struct(bar = "foo", foo = "bar")</code> |
+| <a id="check_struct_default_values-struct_int_args"></a>struct_int_args | struct with int arguments | <code>struct(one = 1, three = 3, two = 2)</code> |
+| <a id="check_struct_default_values-struct_struct_args"></a>struct_struct_args | struct with struct arguments | <code>struct(multiple = struct(one = 1, three = 3, two = 2), none = struct(), one = struct(foo = "bar"))</code> |
diff --git a/test/testdata/struct_default_value_test/input.bzl b/test/testdata/struct_default_value_test/input.bzl
index ead514b..a328b66 100644
--- a/test/testdata/struct_default_value_test/input.bzl
+++ b/test/testdata/struct_default_value_test/input.bzl
@@ -1,5 +1,6 @@
"""The input file for struct default values test"""
+# buildifier: disable=unused-variable
def check_struct_default_values(
struct_no_args = struct(),
struct_arg = struct(foo = "bar"),
diff --git a/test/testdata/unknown_name_test/golden.md b/test/testdata/unknown_name_test/golden.md
index 71aba0c..8bbe43c 100755
--- a/test/testdata/unknown_name_test/golden.md
+++ b/test/testdata/unknown_name_test/golden.md
@@ -1,6 +1,8 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
-<a name="#my_rule_impl"></a>
+
+
+<a id="my_rule_impl"></a>
## my_rule_impl
@@ -14,7 +16,7 @@ my_rule_impl(<a href="#my_rule_impl-ctx">ctx</a>)
| Name | Description | Default Value |
-| :-------------: | :-------------: | :-------------: |
-| ctx | <p align="center"> - </p> | none |
+| :------------- | :------------- | :------------- |
+| <a id="my_rule_impl-ctx"></a>ctx | <p align="center"> - </p> | none |
diff --git a/test/testdata/unknown_name_test/input.bzl b/test/testdata/unknown_name_test/input.bzl
index 062f49d..3716325 100644
--- a/test/testdata/unknown_name_test/input.bzl
+++ b/test/testdata/unknown_name_test/input.bzl
@@ -1,7 +1,9 @@
# buildifier: disable=module-docstring
def my_rule_impl(ctx):
+ _ignore = [ctx] # @unused
return []
+# buildifier: disable=unsorted-dict-items
rule(
implementation = my_rule_impl,
attrs = {
diff --git a/update-release-binary.sh b/update-release-binary.sh
index b485afd..1423fbf 100755
--- a/update-release-binary.sh
+++ b/update-release-binary.sh
@@ -20,7 +20,7 @@
set -eu
echo "** Building Stardoc from source..."
-bazel build @io_bazel//src/main/java/com/google/devtools/build/skydoc:skydoc_deploy.jar
+bazel build --java_language_version=11 @io_bazel//src/main/java/com/google/devtools/build/skydoc:skydoc_deploy.jar
echo "** Copying Stardoc binary..."
cp bazel-bin/external/io_bazel/src/main/java/com/google/devtools/build/skydoc/skydoc_deploy.jar \
@@ -29,10 +29,14 @@ cp bazel-bin/external/io_bazel/src/main/java/com/google/devtools/build/skydoc/sk
echo "** Stardoc copied."
echo "** Building Renderer from source..."
-bazel build @io_bazel//src/main/java/com/google/devtools/build/skydoc/renderer:renderer_deploy.jar
+bazel build --java_language_version=11 @io_bazel//src/main/java/com/google/devtools/build/skydoc/renderer:renderer_deploy.jar
echo "** Copying Renderer binary..."
cp bazel-bin/external/io_bazel/src/main/java/com/google/devtools/build/skydoc/renderer/renderer_deploy.jar \
stardoc/renderer_binary.jar
echo "** Renderer copied."
+
+echo "** Copying stardoc_output.proto from source..."
+cp $(bazel info output_base)/external/io_bazel/src/main/java/com/google/devtools/build/skydoc/rendering/proto/stardoc_output.proto stardoc/proto/stardoc_output.proto
+echo "** stardoc_output.proto copied."
diff --git a/version.bzl b/version.bzl
new file mode 100644
index 0000000..29e5337
--- /dev/null
+++ b/version.bzl
@@ -0,0 +1,16 @@
+# Copyright 2021 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""The version of Stardoc."""
+
+version = "0.5.3"