From 1024919e31d6adad2cfc006a4daeb94bd7f5526b Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Tue, 13 Aug 2024 13:26:08 -0700 Subject: [PATCH] chore: update stardoc (#365) * chore: update stardoc * chore: remove Bazel 6 testing altogether --- .github/workflows/ci.yaml | 8 ++--- MODULE.bazel | 3 +- docs/buf.md | 11 ++++--- docs/clang-tidy.md | 23 ++++++++----- docs/eslint.md | 21 +++++++----- docs/flake8.md | 11 ++++--- docs/format.md | 68 +++++++++++++++++++++------------------ docs/ktlint.md | 19 +++++++---- docs/lint_test.md | 3 +- docs/pmd.md | 13 +++++--- docs/ruff.md | 67 +++++++++++++++++++++----------------- docs/shellcheck.md | 11 ++++--- docs/stylelint.md | 23 +++++++------ docs/vale.md | 23 +++++++------ 14 files changed, 179 insertions(+), 125 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6a373e52..760396b8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,14 +21,14 @@ jobs: uses: bazel-contrib/.github/.github/workflows/bazel.yaml@v6 with: folders: '[".", "example"]' - # Root module is bzlmod-only. # Don't try for Windows support yet. - # Example uses a bazel7-only flag. + exclude_windows: true + # Root module is bzlmod-only and uses newer stardoc that requires Bazel 7. + # Example uses incompatible_enable_proto_toolchain_resolution exclude: | [ {"bzlmodEnabled": false, "folder": "."}, - {"os": "windows-latest"}, - {"bazelversion": "6.4.0", "folder": "example"} + {"bazelversion": "6.4.0"} ] integration-test: diff --git a/MODULE.bazel b/MODULE.bazel index 44231e85..ed6f3f66 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -29,5 +29,4 @@ multitool.hub(lockfile = "//format:multitool.lock.json") multitool.hub(lockfile = "//lint:multitool.lock.json") use_repo(multitool, "multitool") -# 0.5.4 is the first version with bzlmod support -bazel_dep(name = "stardoc", version = "0.5.4", dev_dependency = True, repo_name = "io_bazel_stardoc") +bazel_dep(name = "stardoc", version = "0.7.0", dev_dependency = True, repo_name = "io_bazel_stardoc") diff --git a/docs/buf.md b/docs/buf.md index ba6f8efd..539a210d 100644 --- a/docs/buf.md +++ b/docs/buf.md @@ -12,12 +12,13 @@ buf = buf_lint_aspect( ) ``` - ## buf_lint_action
+load("@aspect_rules_lint//lint:buf.bzl", "buf_lint_action")
+
 buf_lint_action(ctx, buf, protoc, target, stderr, exit_code)
 
@@ -33,7 +34,7 @@ Runs the buf lint tool as a Bazel action. | protoc | the protoc executable | none | | target | the proto_library target to run on | none | | stderr | output file containing the stderr of protoc | none | -| exit_code | output file to write the exit code. If None, then fail the build when protoc exits non-zero. | None | +| exit_code | output file to write the exit code. If None, then fail the build when protoc exits non-zero. | `None` | @@ -41,6 +42,8 @@ Runs the buf lint tool as a Bazel action. ## lint_buf_aspect
+load("@aspect_rules_lint//lint:buf.bzl", "lint_buf_aspect")
+
 lint_buf_aspect(config, toolchain, rule_kinds)
 
@@ -52,7 +55,7 @@ A factory function to create a linter aspect. | Name | Description | Default Value | | :------------- | :------------- | :------------- | | config | label of the the buf.yaml file | none | -| toolchain | override the default toolchain of the protoc-gen-buf-lint tool | "@rules_buf//tools/protoc-gen-buf-lint:toolchain_type" | -| rule_kinds | which [kinds](https://bazel.build/query/language#kind) of rules should be visited by the aspect | ["proto_library"] | +| toolchain | override the default toolchain of the protoc-gen-buf-lint tool | `"@rules_buf//tools/protoc-gen-buf-lint:toolchain_type"` | +| rule_kinds | which [kinds](https://bazel.build/query/language#kind) of rules should be visited by the aspect | `["proto_library"]` | diff --git a/docs/clang-tidy.md b/docs/clang-tidy.md index d701c648..993b40f9 100644 --- a/docs/clang-tidy.md +++ b/docs/clang-tidy.md @@ -38,12 +38,13 @@ clang_tidy = lint_clang_tidy_aspect( ) ``` - ## clang_tidy_action
+load("@aspect_rules_lint//lint:clang_tidy.bzl", "clang_tidy_action")
+
 clang_tidy_action(ctx, compilation_context, executable, srcs, stdout, exit_code)
 
@@ -71,6 +72,8 @@ https://clang.llvm.org/extra/clang-tidy/ ## clang_tidy_fix
+load("@aspect_rules_lint//lint:clang_tidy.bzl", "clang_tidy_fix")
+
 clang_tidy_fix(ctx, compilation_context, executable, srcs, patch, stdout, exit_code)
 
@@ -95,6 +98,8 @@ Create a Bazel Action that spawns clang-tidy with --fix. ## is_parent_in_list
+load("@aspect_rules_lint//lint:clang_tidy.bzl", "is_parent_in_list")
+
 is_parent_in_list(dir, list)
 
@@ -114,6 +119,8 @@ is_parent_in_list(dir, binary, configs, global_config, header_filter, lint_target_headers, angle_includes_are_system, verbose) @@ -125,12 +132,12 @@ A factory function to create a linter aspect. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| binary | the clang-tidy binary, typically a rule like

starlark native_binary(     name = "clang_tidy",     src = "clang-tidy.exe"     out = "clang_tidy", ) 
| none | -| configs | labels of the .clang-tidy files to make available to clang-tidy's config search. These may be in subdirectories and clang-tidy will apply them if appropriate. This may also include .clang-format files which may be used for formatting fixes. | [] | -| global_config | label of a single global .clang-tidy file to pass to clang-tidy on the command line. This will cause clang-tidy to ignore any other config files in the source directories. | [] | -| header_filter | optional, set to a posix regex to supply to clang-tidy with the -header-filter option | "" | -| lint_target_headers | optional, set to True to pass a pattern that includes all headers with the target's directory prefix. This crude control may include headers from the linted target in the results. If supplied, overrides the header_filter option. | False | -| angle_includes_are_system | controls how angle includes are passed to clang-tidy. By default, Bazel passes these as -isystem. Change this to False to pass these as -I, which allows clang-tidy to regard them as regular header files. | True | -| verbose | print debug messages including clang-tidy command lines being invoked. | False | +| binary | the clang-tidy binary, typically a rule like

native_binary(
    name = "clang_tidy",
    src = "clang-tidy.exe"
    out = "clang_tidy",
)
| none | +| configs | labels of the .clang-tidy files to make available to clang-tidy's config search. These may be in subdirectories and clang-tidy will apply them if appropriate. This may also include .clang-format files which may be used for formatting fixes. | `[]` | +| global_config | label of a single global .clang-tidy file to pass to clang-tidy on the command line. This will cause clang-tidy to ignore any other config files in the source directories. | `[]` | +| header_filter | optional, set to a posix regex to supply to clang-tidy with the -header-filter option | `""` | +| lint_target_headers | optional, set to True to pass a pattern that includes all headers with the target's directory prefix. This crude control may include headers from the linted target in the results. If supplied, overrides the header_filter option. | `False` | +| angle_includes_are_system | controls how angle includes are passed to clang-tidy. By default, Bazel passes these as -isystem. Change this to False to pass these as -I, which allows clang-tidy to regard them as regular header files. | `True` | +| verbose | print debug messages including clang-tidy command lines being invoked. | `False` | diff --git a/docs/eslint.md b/docs/eslint.md index 2a9746c8..3eca5e26 100644 --- a/docs/eslint.md +++ b/docs/eslint.md @@ -54,12 +54,13 @@ eslint_test( See the [react example](https://github.com/bazelbuild/examples/blob/b498bb106b2028b531ceffbd10cc89530814a177/frontend/react/src/BUILD.bazel#L86-L92) - ## eslint_action
+load("@aspect_rules_lint//lint:eslint.bzl", "eslint_action")
+
 eslint_action(ctx, executable, srcs, stdout, exit_code, format, env)
 
@@ -78,9 +79,9 @@ https://eslint.org/docs/latest/use/command-line-interface | executable | struct with an eslint field | none | | srcs | list of file objects to lint | none | | stdout | output file containing the stdout or --output-file of eslint | none | -| exit_code | output file containing the exit code of eslint. If None, then fail the build when eslint exits non-zero. | None | -| format | value for eslint --format CLI flag | "stylish" | -| env | environment variables for eslint | {} | +| exit_code | output file containing the exit code of eslint. If None, then fail the build when eslint exits non-zero. | `None` | +| format | value for eslint `--format` CLI flag | `"stylish"` | +| env | environment variables for eslint | `{}` | @@ -88,6 +89,8 @@ https://eslint.org/docs/latest/use/command-line-interface ## eslint_fix
+load("@aspect_rules_lint//lint:eslint.bzl", "eslint_fix")
+
 eslint_fix(ctx, executable, srcs, patch, stdout, exit_code, format, env)
 
@@ -104,8 +107,8 @@ Create a Bazel Action that spawns eslint with --fix. | patch | output file containing the applied fixes that can be applied with the patch(1) command. | none | | stdout | output file containing the stdout or --output-file of eslint | none | | exit_code | output file containing the exit code of eslint | none | -| format | value for eslint --format CLI flag | "stylish" | -| env | environment variaables for eslint | {} | +| format | value for eslint `--format` CLI flag | `"stylish"` | +| env | environment variaables for eslint | `{}` | @@ -113,6 +116,8 @@ Create a Bazel Action that spawns eslint with --fix. ## lint_eslint_aspect
+load("@aspect_rules_lint//lint:eslint.bzl", "lint_eslint_aspect")
+
 lint_eslint_aspect(binary, configs, rule_kinds)
 
@@ -123,8 +128,8 @@ A factory function to create a linter aspect. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| binary | the eslint binary, typically a rule like

 load("@npm//:eslint/package_json.bzl", eslint_bin = "bin") eslint_bin.eslint_binary(name = "eslint") 
| none | +| binary | the eslint binary, typically a rule like

load("@npm//:eslint/package_json.bzl", eslint_bin = "bin")
eslint_bin.eslint_binary(name = "eslint")
| none | | configs | label(s) of the eslint config file(s) | none | -| rule_kinds | which [kinds](https://bazel.build/query/language#kind) of rules should be visited by the aspect | ["js_library", "ts_project", "ts_project_rule"] | +| rule_kinds | which [kinds](https://bazel.build/query/language#kind) of rules should be visited by the aspect | `["js_library", "ts_project", "ts_project_rule"]` | diff --git a/docs/flake8.md b/docs/flake8.md index 5bdda89f..46a7c4ac 100644 --- a/docs/flake8.md +++ b/docs/flake8.md @@ -27,12 +27,13 @@ flake8 = lint_flake8_aspect( ) ``` - ## flake8_action
+load("@aspect_rules_lint//lint:flake8.bzl", "flake8_action")
+
 flake8_action(ctx, executable, srcs, config, stdout, exit_code, options)
 
@@ -51,8 +52,8 @@ Based on https://flake8.pycqa.org/en/latest/user/invocation.html | srcs | python files to be linted | none | | config | label of the flake8 config file (setup.cfg, tox.ini, or .flake8) | none | | stdout | output file containing stdout of flake8 | none | -| exit_code | output file containing exit code of flake8 If None, then fail the build when flake8 exits non-zero. | None | -| options | additional command-line options, see https://flake8.pycqa.org/en/latest/user/options.html | [] | +| exit_code | output file containing exit code of flake8 If None, then fail the build when flake8 exits non-zero. | `None` | +| options | additional command-line options, see https://flake8.pycqa.org/en/latest/user/options.html | `[]` | @@ -60,6 +61,8 @@ Based on https://flake8.pycqa.org/en/latest/user/invocation.html ## lint_flake8_aspect
+load("@aspect_rules_lint//lint:flake8.bzl", "lint_flake8_aspect")
+
 lint_flake8_aspect(binary, config, rule_kinds)
 
@@ -84,6 +87,6 @@ Attrs: | :------------- | :------------- | :------------- | | binary |

-

| none | | config |

-

| none | -| rule_kinds |

-

| ["py_binary", "py_library"] | +| rule_kinds |

-

| `["py_binary", "py_library"]` | diff --git a/docs/format.md b/docs/format.md index 1279ea81..15ba0e02 100644 --- a/docs/format.md +++ b/docs/format.md @@ -41,12 +41,13 @@ format_multirun( [Prettier]: https://prettier.io/ [multitool]: https://registry.bazel.build/modules/rules_multitool - ## languages
+load("@aspect_rules_lint//format:defs.bzl", "languages")
+
 languages(name, c, cc, css, cuda, go, graphql, html, java, javascript, jsonnet, kotlin, markdown,
           protocol_buffer, python, rust, scala, shell, sql, starlark, swift, terraform, yaml)
 
@@ -63,35 +64,34 @@ Some languages have dialects: [GitHub Linguist]: https://github.com/github-linguist/linguist/blob/559a6426942abcae16b6d6b328147476432bf6cb/lib/linguist/languages.yml - **ATTRIBUTES** | Name | Description | Type | Mandatory | Default | | :------------- | :------------- | :------------- | :------------- | :------------- | | name | A unique name for this target. | Name | required | | -| c | a clang-format binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| cc | a clang-format binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| css | a prettier binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| cuda | a clang-format binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| go | a gofmt binary, or any other tool that has a matching command-line interface. Use @aspect_rules_lint//format:gofumpt to choose the built-in tool. | Label | optional | None | -| graphql | a prettier binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| html | a prettier binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| java | a java-format binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| javascript | a prettier binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| jsonnet | a jsonnetfmt binary, or any other tool that has a matching command-line interface. Use @aspect_rules_lint//format:jsonnetfmt to choose the built-in tool. | Label | optional | None | -| kotlin | a ktfmt binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| markdown | a prettier binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| protocol_buffer | a buf binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| python | a ruff binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| rust | a rustfmt binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| scala | a scalafmt binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| shell | a shfmt binary, or any other tool that has a matching command-line interface. Use @aspect_rules_lint//format:shfmt to choose the built-in tool. | Label | optional | None | -| sql | a prettier binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| starlark | a buildifier binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| swift | a swiftformat binary, or any other tool that has a matching command-line interface. | Label | optional | None | -| terraform | a terraform-fmt binary, or any other tool that has a matching command-line interface. Use @aspect_rules_lint//format:terraform to choose the built-in tool. | Label | optional | None | -| yaml | a yamlfmt binary, or any other tool that has a matching command-line interface. Use @aspect_rules_lint//format:yamlfmt to choose the built-in tool. | Label | optional | None | +| c | a `clang-format` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| cc | a `clang-format` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| css | a `prettier` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| cuda | a `clang-format` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| go | a `gofmt` binary, or any other tool that has a matching command-line interface. Use `@aspect_rules_lint//format:gofumpt` to choose the built-in tool. | Label | optional | `None` | +| graphql | a `prettier` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| html | a `prettier` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| java | a `java-format` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| javascript | a `prettier` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| jsonnet | a `jsonnetfmt` binary, or any other tool that has a matching command-line interface. Use `@aspect_rules_lint//format:jsonnetfmt` to choose the built-in tool. | Label | optional | `None` | +| kotlin | a `ktfmt` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| markdown | a `prettier` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| protocol_buffer | a `buf` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| python | a `ruff` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| rust | a `rustfmt` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| scala | a `scalafmt` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| shell | a `shfmt` binary, or any other tool that has a matching command-line interface. Use `@aspect_rules_lint//format:shfmt` to choose the built-in tool. | Label | optional | `None` | +| sql | a `prettier` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| starlark | a `buildifier` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| swift | a `swiftformat` binary, or any other tool that has a matching command-line interface. | Label | optional | `None` | +| terraform | a `terraform-fmt` binary, or any other tool that has a matching command-line interface. Use `@aspect_rules_lint//format:terraform` to choose the built-in tool. | Label | optional | `None` | +| yaml | a `yamlfmt` binary, or any other tool that has a matching command-line interface. Use `@aspect_rules_lint//format:yamlfmt` to choose the built-in tool. | Label | optional | `None` | @@ -99,6 +99,8 @@ Some languages have dialects: ## format_multirun
+load("@aspect_rules_lint//format:defs.bzl", "format_multirun")
+
 format_multirun(name, jobs, print_command, disable_git_attribute_checks, kwargs)
 
@@ -120,9 +122,9 @@ To check formatting with `bazel test`, use [format_test](#format_test) instead. | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | name of the resulting target, typically "format" | none | -| jobs | how many language formatters to spawn in parallel, ideally matching how many CPUs are available | 4 | -| print_command | whether to print a progress message before calling the formatter of each language. Note that a line is printed for a formatter even if no files of that language are to be formatted. | False | -| disable_git_attribute_checks | Set to True to disable honoring .gitattributes filters | False | +| jobs | how many language formatters to spawn in parallel, ideally matching how many CPUs are available | `4` | +| print_command | whether to print a progress message before calling the formatter of each language. Note that a line is printed for a formatter even if no files of that language are to be formatted. | `False` | +| disable_git_attribute_checks | Set to True to disable honoring .gitattributes filters | `False` | | kwargs | attributes named for each language; see [languages](#languages) | none | @@ -131,6 +133,8 @@ To check formatting with `bazel test`, use [format_test](#format_test) instead. ## format_test
+load("@aspect_rules_lint//format:defs.bzl", "format_test")
+
 format_test(name, srcs, workspace, no_sandbox, disable_git_attribute_checks, tags, kwargs)
 
@@ -148,11 +152,11 @@ To format with `bazel run`, see [format_multirun](#format_multirun). | Name | Description | Default Value | | :------------- | :------------- | :------------- | | name | name of the resulting target, typically "format" | none | -| srcs | list of files to verify formatting. Required when no_sandbox is False. | None | -| workspace | a file in the root directory to verify formatting. Required when no_sandbox is True. Typically //:WORKSPACE or //:MODULE.bazel may be used. | None | -| no_sandbox | Set to True to enable formatting all files in the workspace. This mode causes the test to be non-hermetic and it cannot be cached. Read the documentation in /docs/formatting.md. | False | -| disable_git_attribute_checks | Set to True to disable honoring .gitattributes filters | False | -| tags | tags to apply to generated targets. In 'no_sandbox' mode, ["no-sandbox", "no-cache", "external"] are added to the tags. | [] | +| srcs | list of files to verify formatting. Required when no_sandbox is False. | `None` | +| workspace | a file in the root directory to verify formatting. Required when no_sandbox is True. Typically `//:WORKSPACE` or `//:MODULE.bazel` may be used. | `None` | +| no_sandbox | Set to True to enable formatting all files in the workspace. This mode causes the test to be non-hermetic and it cannot be cached. Read the documentation in /docs/formatting.md. | `False` | +| disable_git_attribute_checks | Set to True to disable honoring .gitattributes filters | `False` | +| tags | tags to apply to generated targets. In 'no_sandbox' mode, `["no-sandbox", "no-cache", "external"]` are added to the tags. | `[]` | | kwargs | attributes named for each language; see [languages](#languages) | none | diff --git a/docs/ktlint.md b/docs/ktlint.md index 8e4b2ad9..aa4007a8 100644 --- a/docs/ktlint.md +++ b/docs/ktlint.md @@ -51,12 +51,13 @@ ktlint = ktlint_aspect( If your custom ruleset is a third-party dependency and not a first-party dependency, you can also fetch it using `http_file` and use it instead. - ## fetch_ktlint
+load("@aspect_rules_lint//lint:ktlint.bzl", "fetch_ktlint")
+
 fetch_ktlint()
 
@@ -69,11 +70,13 @@ fetch_ktlint() ## ktlint_action
+load("@aspect_rules_lint//lint:ktlint.bzl", "ktlint_action")
+
 ktlint_action(ctx, executable, srcs, editorconfig, stdout, baseline_file, java_runtime, ruleset_jar,
               exit_code, options)
 
- Runs ktlint as build action in Bazel. +Runs ktlint as build action in Bazel. Adapter for wrapping Bazel around https://pinterest.github.io/ktlint/latest/install/cli/ @@ -91,9 +94,9 @@ https://pinterest.github.io/ktlint/latest/install/cli/ | stdout | :output: the stdout of ktlint containing any violations found | none | | baseline_file | The file object pointing to the baseline file used by ktlint. | none | | java_runtime | The Java Runtime configured for this build, pulled from the registered toolchain. | none | -| ruleset_jar | An optional, custom ktlint ruleset jar. | None | -| exit_code | output file to write the exit code. If None, then fail the build when ktlint exits non-zero. | None | -| options | additional command-line arguments to ktlint, see https://pinterest.github.io/ktlint/latest/install/cli/#miscellaneous-flags-and-commands | [] | +| ruleset_jar | An optional, custom ktlint ruleset jar. | `None` | +| exit_code | output file to write the exit code. If None, then fail the build when ktlint exits non-zero. | `None` | +| options | additional command-line arguments to ktlint, see https://pinterest.github.io/ktlint/latest/install/cli/#miscellaneous-flags-and-commands | `[]` | @@ -101,6 +104,8 @@ https://pinterest.github.io/ktlint/latest/install/cli/ ## lint_ktlint_aspect
+load("@aspect_rules_lint//lint:ktlint.bzl", "lint_ktlint_aspect")
+
 lint_ktlint_aspect(binary, editorconfig, baseline_file, ruleset_jar, rule_kinds)
 
@@ -114,8 +119,8 @@ A factory function to create a linter aspect. | binary | a ktlint executable, provided as file typically through http_file declaration or using fetch_ktlint in your WORKSPACE. | none | | editorconfig | The label of the file pointing to the .editorconfig file used by ktlint. | none | | baseline_file | An optional attribute pointing to the label of the baseline file used by ktlint. | none | -| ruleset_jar | An optional, custom ktlint ruleset provided as a fat jar, and works on top of the standard rules. | None | -| rule_kinds | which [kinds](https://bazel.build/query/language#kind) of rules should be visited by the aspect | ["kt_jvm_library", "kt_jvm_binary", "kt_js_library"] | +| ruleset_jar | An optional, custom ktlint ruleset provided as a fat jar, and works on top of the standard rules. | `None` | +| rule_kinds | which [kinds](https://bazel.build/query/language#kind) of rules should be visited by the aspect | `["kt_jvm_library", "kt_jvm_binary", "kt_js_library"]` | **RETURNS** diff --git a/docs/lint_test.md b/docs/lint_test.md index 8849e13f..41931770 100644 --- a/docs/lint_test.md +++ b/docs/lint_test.md @@ -36,12 +36,13 @@ flake8_test( ) ``` - ## lint_test
+load("@aspect_rules_lint//lint:lint_test.bzl", "lint_test")
+
 lint_test(aspect)
 
diff --git a/docs/pmd.md b/docs/pmd.md index 2ed5b192..d37ee534 100644 --- a/docs/pmd.md +++ b/docs/pmd.md @@ -28,12 +28,13 @@ pmd = pmd_aspect( ) ``` - ## fetch_pmd
+load("@aspect_rules_lint//lint:pmd.bzl", "fetch_pmd")
+
 fetch_pmd()
 
@@ -46,6 +47,8 @@ fetch_pmd() ## lint_pmd_aspect
+load("@aspect_rules_lint//lint:pmd.bzl", "lint_pmd_aspect")
+
 lint_pmd_aspect(binary, rulesets, rule_kinds)
 
@@ -72,7 +75,7 @@ Attrs: | :------------- | :------------- | :------------- | | binary |

-

| none | | rulesets |

-

| none | -| rule_kinds |

-

| ["java_binary", "java_library"] | +| rule_kinds |

-

| `["java_binary", "java_library"]` | @@ -80,6 +83,8 @@ Attrs: ## pmd_action
+load("@aspect_rules_lint//lint:pmd.bzl", "pmd_action")
+
 pmd_action(ctx, executable, srcs, rulesets, stdout, exit_code, options)
 
@@ -98,7 +103,7 @@ Based on https://docs.pmd-code.org/latest/pmd_userdocs_installation.html#running | srcs | java files to be linted | none | | rulesets | list of labels of the PMD ruleset files | none | | stdout | output file to generate | none | -| exit_code | output file to write the exit code. If None, then fail the build when PMD exits non-zero. | None | -| options | additional command-line options, see https://pmd.github.io/pmd/pmd_userdocs_cli_reference.html | [] | +| exit_code | output file to write the exit code. If None, then fail the build when PMD exits non-zero. | `None` | +| options | additional command-line options, see https://pmd.github.io/pmd/pmd_userdocs_cli_reference.html | `[]` | diff --git a/docs/ruff.md b/docs/ruff.md index 6cb7b32b..16c28af0 100644 --- a/docs/ruff.md +++ b/docs/ruff.md @@ -48,35 +48,13 @@ ruff = lint_ruff_aspect( ) ``` - - - -## ruff_workaround_20269 - -
-ruff_workaround_20269(name, build_file_content, repo_mapping, sha256, strip_prefix, url)
-
- -Workaround for https://github.com/bazelbuild/bazel/issues/20269 - -**ATTRIBUTES** - - -| Name | Description | Type | Mandatory | Default | -| :------------- | :------------- | :------------- | :------------- | :------------- | -| name | A unique name for this repository. | Name | required | | -| build_file_content | - | String | optional | "" | -| 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 "@foo": "@bar" declares that, for any time this repository depends on @foo (such as a dependency on @foo//some:target, it should actually resolve that dependency within globally-declared @bar (@bar//some:target). | Dictionary: String -> String | required | | -| sha256 | - | String | optional | "" | -| strip_prefix | unlike http_archive, any value causes us to pass --strip-components=1 to tar | String | optional | "" | -| url | - | String | optional | "" | - - ## fetch_ruff
+load("@aspect_rules_lint//lint:ruff.bzl", "fetch_ruff")
+
 fetch_ruff(tag)
 
@@ -90,7 +68,7 @@ Allows the user to select a particular ruff version, rather than get whatever is | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| tag | a tag of ruff that we have mirrored, e.g. v0.1.0 | none | +| tag | a tag of ruff that we have mirrored, e.g. `v0.1.0` | none | @@ -98,6 +76,8 @@ Allows the user to select a particular ruff version, rather than get whatever is ## lint_ruff_aspect
+load("@aspect_rules_lint//lint:ruff.bzl", "lint_ruff_aspect")
+
 lint_ruff_aspect(binary, configs, rule_kinds)
 
@@ -115,7 +95,7 @@ Attrs: | :------------- | :------------- | :------------- | | binary |

-

| none | | configs |

-

| none | -| rule_kinds |

-

| ["py_binary", "py_library", "py_test"] | +| rule_kinds |

-

| `["py_binary", "py_library", "py_test"]` | @@ -123,6 +103,8 @@ Attrs: ## ruff_action
+load("@aspect_rules_lint//lint:ruff.bzl", "ruff_action")
+
 ruff_action(ctx, executable, srcs, config, stdout, exit_code, env)
 
@@ -152,8 +134,8 @@ However this is needed because: | srcs | python files to be linted | none | | config | labels of ruff config files (pyproject.toml, ruff.toml, or .ruff.toml) | none | | stdout | output file of linter results to generate | none | -| exit_code | output file to write the exit code. If None, then fail the build when ruff exits non-zero. See https://github.com/astral-sh/ruff/blob/dfe4291c0b7249ae892f5f1d513e6f1404436c13/docs/linter.md#exit-codes | None | -| env | environment variaables for ruff | {} | +| exit_code | output file to write the exit code. If None, then fail the build when ruff exits non-zero. See https://github.com/astral-sh/ruff/blob/dfe4291c0b7249ae892f5f1d513e6f1404436c13/docs/linter.md#exit-codes | `None` | +| env | environment variaables for ruff | `{}` | @@ -161,6 +143,8 @@ However this is needed because: ## ruff_fix
+load("@aspect_rules_lint//lint:ruff.bzl", "ruff_fix")
+
 ruff_fix(ctx, executable, srcs, config, patch, stdout, exit_code, env)
 
@@ -178,6 +162,31 @@ Create a Bazel Action that spawns ruff with --fix. | patch | output file containing the applied fixes that can be applied with the patch(1) command. | none | | stdout | output file of linter results to generate | none | | exit_code | output file to write the exit code | none | -| env | environment variaables for ruff | {} | +| env | environment variaables for ruff | `{}` | + + + + +## ruff_workaround_20269 + +
+load("@aspect_rules_lint//lint:ruff.bzl", "ruff_workaround_20269")
+
+ruff_workaround_20269(name, build_file_content, repo_mapping, sha256, strip_prefix, url)
+
+ +Workaround for https://github.com/bazelbuild/bazel/issues/20269 + +**ATTRIBUTES** + + +| Name | Description | Type | Mandatory | Default | +| :------------- | :------------- | :------------- | :------------- | :------------- | +| name | A unique name for this repository. | Name | required | | +| build_file_content | - | String | optional | `""` | +| repo_mapping | In `WORKSPACE` context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.

For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`).

This attribute is _not_ supported in `MODULE.bazel` context (when invoking a repository rule inside a module extension's implementation function). | Dictionary: String -> String | optional | | +| sha256 | - | String | optional | `""` | +| strip_prefix | unlike http_archive, any value causes us to pass --strip-components=1 to tar | String | optional | `""` | +| url | - | String | optional | `""` | diff --git a/docs/shellcheck.md b/docs/shellcheck.md index 6259f2cb..44162fd4 100644 --- a/docs/shellcheck.md +++ b/docs/shellcheck.md @@ -15,12 +15,13 @@ shellcheck = shellcheck_aspect( ) ``` - ## lint_shellcheck_aspect
+load("@aspect_rules_lint//lint:shellcheck.bzl", "lint_shellcheck_aspect")
+
 lint_shellcheck_aspect(binary, config, rule_kinds)
 
@@ -37,7 +38,7 @@ Attrs: | :------------- | :------------- | :------------- | | binary |

-

| none | | config |

-

| none | -| rule_kinds |

-

| ["sh_binary", "sh_library"] | +| rule_kinds |

-

| `["sh_binary", "sh_library"]` | @@ -45,6 +46,8 @@ Attrs: ## shellcheck_action
+load("@aspect_rules_lint//lint:shellcheck.bzl", "shellcheck_action")
+
 shellcheck_action(ctx, executable, srcs, config, stdout, exit_code, options)
 
@@ -63,7 +66,7 @@ Based on https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md | srcs | bash files to be linted | none | | config | label of the .shellcheckrc file | none | | stdout | output file containing stdout of shellcheck | none | -| exit_code | output file containing shellcheck exit code. If None, then fail the build when vale exits non-zero. See https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md#return-values | None | -| options | additional command-line options, see https://github.com/koalaman/shellcheck/blob/master/shellcheck.hs#L95 | [] | +| exit_code | output file containing shellcheck exit code. If None, then fail the build when vale exits non-zero. See https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md#return-values | `None` | +| options | additional command-line options, see https://github.com/koalaman/shellcheck/blob/master/shellcheck.hs#L95 | `[]` | diff --git a/docs/stylelint.md b/docs/stylelint.md index f7ee9af7..a5ea3c4c 100644 --- a/docs/stylelint.md +++ b/docs/stylelint.md @@ -38,12 +38,13 @@ stylelint = lint_stylelint_aspect( Finally, register the aspect with your linting workflow, such as in `.aspect/cli/config.yaml` for `aspect lint`. - ## lint_stylelint_aspect
+load("@aspect_rules_lint//lint:stylelint.bzl", "lint_stylelint_aspect")
+
 lint_stylelint_aspect(binary, config, rule_kinds, filegroup_tags)
 
@@ -54,10 +55,10 @@ A factory function to create a linter aspect. | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| binary | the stylelint binary, typically a rule like

 load("@npm//:stylelint/package_json.bzl", stylelint_bin = "bin") stylelint_bin.stylelint_binary(name = "stylelint") 
| none | +| binary | the stylelint binary, typically a rule like

load("@npm//:stylelint/package_json.bzl", stylelint_bin = "bin")
stylelint_bin.stylelint_binary(name = "stylelint")
| none | | config | label(s) of the stylelint config file(s) | none | -| rule_kinds | which [kinds](https://bazel.build/query/language#kind) of rules should be visited by the aspect | ["css_library"] | -| filegroup_tags | which tags on a filegroup indicate that it should be visited by the aspect | ["lint-with-stylelint"] | +| rule_kinds | which [kinds](https://bazel.build/query/language#kind) of rules should be visited by the aspect | `["css_library"]` | +| filegroup_tags | which tags on a `filegroup` indicate that it should be visited by the aspect | `["lint-with-stylelint"]` | @@ -65,6 +66,8 @@ A factory function to create a linter aspect. ## stylelint_action
+load("@aspect_rules_lint//lint:stylelint.bzl", "stylelint_action")
+
 stylelint_action(ctx, executable, srcs, config, stderr, exit_code, env, options)
 
@@ -80,9 +83,9 @@ Spawn stylelint as a Bazel action | srcs | list of file objects to lint | none | | config | js_library representing the config file (and its dependencies) | none | | stderr | output file containing the stderr or --output-file of stylelint | none | -| exit_code | output file containing the exit code of stylelint. If None, then fail the build when stylelint exits non-zero. Exit codes may be: 1 - fatal error 2 - lint problem 64 - invalid CLI usage 78 - invalid configuration file | None | -| env | environment variables for stylelint | {} | -| options | additional command-line arguments | [] | +| exit_code | output file containing the exit code of stylelint. If None, then fail the build when stylelint exits non-zero. Exit codes may be: 1 - fatal error 2 - lint problem 64 - invalid CLI usage 78 - invalid configuration file | `None` | +| env | environment variables for stylelint | `{}` | +| options | additional command-line arguments | `[]` | @@ -90,6 +93,8 @@ Spawn stylelint as a Bazel action ## stylelint_fix
+load("@aspect_rules_lint//lint:stylelint.bzl", "stylelint_fix")
+
 stylelint_fix(ctx, executable, srcs, config, patch, stderr, exit_code, env, options)
 
@@ -107,7 +112,7 @@ Create a Bazel Action that spawns stylelint with --fix. | patch | output file containing the applied fixes that can be applied with the patch(1) command. | none | | stderr | output file containing the stderr or --output-file of stylelint | none | | exit_code | output file containing the exit code of stylelint | none | -| env | environment variables for stylelint | {} | -| options | additional command line options | [] | +| env | environment variables for stylelint | `{}` | +| options | additional command line options | `[]` | diff --git a/docs/vale.md b/docs/vale.md index d1182f48..5b7b605f 100644 --- a/docs/vale.md +++ b/docs/vale.md @@ -13,7 +13,7 @@ filegroup( ) ``` -or use a `markdown_library` rule such as the one in <https://github.com/dwtj/dwtj_rules_markdown>. +or use a `markdown_library` rule such as the one in . Aspect plans to provide support for Markdown in [configure]() so these rules can be automatically maintained rather than requiring developers to write them by hand. @@ -63,12 +63,13 @@ vale = vale_aspect( ) ``` - ## fetch_vale
+load("@aspect_rules_lint//lint:vale.bzl", "fetch_vale")
+
 fetch_vale(tag)
 
@@ -79,7 +80,7 @@ A repository macro used from WORKSPACE to fetch vale binaries | Name | Description | Default Value | | :------------- | :------------- | :------------- | -| tag | a tag of vale that we have mirrored, e.g. v3.0.5 | "v3.7.0" | +| tag | a tag of vale that we have mirrored, e.g. `v3.0.5` | `"v3.7.0"` | @@ -87,6 +88,8 @@ A repository macro used from WORKSPACE to fetch vale binaries ## lint_vale_aspect
+load("@aspect_rules_lint//lint:vale.bzl", "lint_vale_aspect")
+
 lint_vale_aspect(binary, config, styles, rule_kinds, filegroup_tags)
 
@@ -99,9 +102,9 @@ A factory function to create a linter aspect. | :------------- | :------------- | :------------- | | binary |

-

| none | | config |

-

| none | -| styles |

-

| Label("//lint:empty_styles") | -| rule_kinds |

-

| ["markdown_library"] | -| filegroup_tags |

-

| ["markdown", "lint-with-vale"] | +| styles |

-

| `Label("@aspect_rules_lint//lint:empty_styles")` | +| rule_kinds |

-

| `["markdown_library"]` | +| filegroup_tags |

-

| `["markdown", "lint-with-vale"]` | @@ -109,6 +112,8 @@ A factory function to create a linter aspect. ## vale_action
+load("@aspect_rules_lint//lint:vale.bzl", "vale_action")
+
 vale_action(ctx, executable, srcs, styles, config, stdout, exit_code, output, env)
 
@@ -125,8 +130,8 @@ Run Vale as an action under Bazel. | styles | a directory containing vale extensions, following https://vale.sh/docs/topics/styles/ | none | | config | label of the .vale.ini file, see https://vale.sh/docs/vale-cli/structure/#valeini | none | | stdout | output file containing stdout of Vale | none | -| exit_code | output file containing Vale exit code. If None, then fail the build when Vale exits non-zero. | None | -| output | the value for the --output flag | "CLI" | -| env | environment variables for vale | {} | +| exit_code | output file containing Vale exit code. If None, then fail the build when Vale exits non-zero. | `None` | +| output | the value for the --output flag | `"CLI"` | +| env | environment variables for vale | `{}` |