Skip to content

Commit

Permalink
Vale (#103)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alexeagle authored Feb 9, 2024
1 parent ebe8678 commit 0de7861
Show file tree
Hide file tree
Showing 21 changed files with 637 additions and 20,014 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ https://github.com/google/shipshape is an old, abandoned attempt to open-source
It is also inspired by <https://github.com/github/super-linter>.

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

## Supported tools
Expand All @@ -37,7 +37,7 @@ It is also inspired by <https://github.com/github/super-linter>.
| JavaScript | [Prettier] | [ESLint] |
| Jsonnet | [jsonnetfmt] | |
| Kotlin | [ktfmt] | |
| Markdown | [Prettier] | |
| Markdown | [Prettier] | [Vale] |
| Protocol Buffer | [buf] | [buf lint] |
| Python | [ruff] | [flake8], [ruff] |
| SQL | [prettier-plugin-sql] | |
Expand Down Expand Up @@ -70,6 +70,7 @@ It is also inspired by <https://github.com/github/super-linter>.
[golangci-lint]: https://github.com/golangci/golangci-lint
[clang-format]: https://clang.llvm.org/docs/ClangFormat.html
[#112]: https://github.com/aspect-build/rules_lint/issues/112
[vale]: https://vale.sh/

1. Non-hermetic: requires that a swift toolchain is installed on the machine.
See https://github.com/bazelbuild/rules_swift#1-install-swift
Expand Down
5 changes: 5 additions & 0 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,9 @@ stardoc_with_diff_test(
bzl_library_target = "//lint:shellcheck",
)

stardoc_with_diff_test(
name = "vale",
bzl_library_target = "//lint:vale",
)

update_docs(name = "update")
141 changes: 141 additions & 0 deletions docs/vale.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions example/.aspect/cli/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ lint:
- //tools:lint.bzl%flake8
- //tools:lint.bzl%pmd
- //tools:lint.bzl%ruff
- //tools:lint.bzl%vale
11 changes: 11 additions & 0 deletions example/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# NB: this path doesn't exist in the source tree, it's created by the copy_to_directory rule
# in tools/BUILD.bazel.
# If you want vale to run outside Bazel, such as with an editor extension,
# you could also use `write_source_files` to have the tools/vale_styles folder written into the source tree as well.
StylesPath = tools/vale_styles

MinAlertLevel = warning
Packages = Google,write-good

[*]
BasedOnStyles = Vale,Google,write-good
7 changes: 7 additions & 0 deletions example/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@aspect_rules_js//js:defs.bzl", "js_library")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
Expand Down Expand Up @@ -47,3 +48,9 @@ alias(
name = "format",
actual = "//tools:format",
)

copy_to_bin(
name = ".vale_ini",
srcs = [".vale.ini"],
visibility = ["//src:__subpackages__"],
)
Loading

0 comments on commit 0de7861

Please sign in to comment.