diff options
Diffstat (limited to 'test')
74 files changed, 858 insertions, 531 deletions
@@ -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 <angle bracket bugs> + +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 <brackets> **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: <tag1>, <tag2> | 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: <tag1>, <tag2> | String | optional | <code>"Find <brackets>"</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 <brackets> **FIELDS** | Name | Description | -| :-------------: | :-------------: | -| foo | A string representing <foo> | -| bar | A string representing bar | -| baz | A string representing baz | +| :------------- | :------------- | +| <a id="bracketuse-foo"></a>foo | A string representing <foo> | +| <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 <brackets>. -This rule runs checks on <angle brackets>. +This rule runs checks on <angle brackets>. **PARAMETERS** | Name | Description | Default Value | -| :-------------: | :-------------: | :-------------: | -| name | an arg with **formatted** docstring. | none | +| :------------- | :------------- | :------------- | +| <a id="bracket_function-param"></a>param | an arg with **formatted** docstring, <default> by default. | <code>"<default>"</code> | + +**RETURNS** + +some <angled> brackets + +**DEPRECATED** + +deprecated for <reasons> + + +<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 <brackets> + +**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 <brackets> | String | optional | <code>"<default>"</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 Binary files differindex d158834..a93d367 100644 --- a/test/testdata/proto_format_test/golden.raw +++ b/test/testdata/proto_format_test/golden.raw 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.<p>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 = { |