Skip to content

Commit 0de7861

Browse files
authored
Vale (#103)
* chore: add vale binary * chore: start the vale aspect * chore: workaround how vale locates its styles * chore: add write-good * chore: don't show suggestion level * fix: vale can only work with a single config since we have to generate it * feat: properly vendor the list of vale styles * chore: vendor newer vale binary * chore: add test * chore: register missing toolchain' * fix: allow markdown_library or filegroup(tags=[markdown]) * chore: fix integration test * chore: documentation * chore: docgen * make styles optional, in case you only use built-in Also fix bug where exit code was always being used * fix: vale writes to stdout * roll dice * chore: don't fetch all styles, it's too big
1 parent ebe8678 commit 0de7861

File tree

21 files changed

+637
-20014
lines changed

21 files changed

+637
-20014
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ https://github.com/google/shipshape is an old, abandoned attempt to open-source
2020
It is also inspired by <https://github.com/github/super-linter>.
2121

2222
[aspect cli]: https://docs.aspect.build/v/cli
23-
[tricorder]: https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/43322.pdf
23+
[tricorder]: https://static.googleusercontent.com/media/research.google.com/en/pubs/archive/43322.pdf
2424
[reviewdog]: https://github.com/reviewdog/reviewdog
2525

2626
## Supported tools
@@ -37,7 +37,7 @@ It is also inspired by <https://github.com/github/super-linter>.
3737
| JavaScript | [Prettier] | [ESLint] |
3838
| Jsonnet | [jsonnetfmt] | |
3939
| Kotlin | [ktfmt] | |
40-
| Markdown | [Prettier] | |
40+
| Markdown | [Prettier] | [Vale] |
4141
| Protocol Buffer | [buf] | [buf lint] |
4242
| Python | [ruff] | [flake8], [ruff] |
4343
| SQL | [prettier-plugin-sql] | |
@@ -70,6 +70,7 @@ It is also inspired by <https://github.com/github/super-linter>.
7070
[golangci-lint]: https://github.com/golangci/golangci-lint
7171
[clang-format]: https://clang.llvm.org/docs/ClangFormat.html
7272
[#112]: https://github.com/aspect-build/rules_lint/issues/112
73+
[vale]: https://vale.sh/
7374

7475
1. Non-hermetic: requires that a swift toolchain is installed on the machine.
7576
See https://github.com/bazelbuild/rules_swift#1-install-swift

docs/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,9 @@ stardoc_with_diff_test(
4747
bzl_library_target = "//lint:shellcheck",
4848
)
4949

50+
stardoc_with_diff_test(
51+
name = "vale",
52+
bzl_library_target = "//lint:vale",
53+
)
54+
5055
update_docs(name = "update")

docs/vale.md

Lines changed: 141 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/.aspect/cli/config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ lint:
55
- //tools:lint.bzl%flake8
66
- //tools:lint.bzl%pmd
77
- //tools:lint.bzl%ruff
8+
- //tools:lint.bzl%vale

example/.vale.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# NB: this path doesn't exist in the source tree, it's created by the copy_to_directory rule
2+
# in tools/BUILD.bazel.
3+
# If you want vale to run outside Bazel, such as with an editor extension,
4+
# you could also use `write_source_files` to have the tools/vale_styles folder written into the source tree as well.
5+
StylesPath = tools/vale_styles
6+
7+
MinAlertLevel = warning
8+
Packages = Google,write-good
9+
10+
[*]
11+
BasedOnStyles = Vale,Google,write-good

example/BUILD.bazel

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
12
load("@aspect_rules_js//js:defs.bzl", "js_library")
23
load("@npm//:defs.bzl", "npm_link_all_packages")
34
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
@@ -47,3 +48,9 @@ alias(
4748
name = "format",
4849
actual = "//tools:format",
4950
)
51+
52+
copy_to_bin(
53+
name = ".vale_ini",
54+
srcs = [".vale.ini"],
55+
visibility = ["//src:__subpackages__"],
56+
)

0 commit comments

Comments
 (0)