aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHoang Nguyen <folliekazetani@protonmail.com>2024-01-06 15:29:44 +0000
committerGitHub <noreply@github.com>2024-01-06 07:29:44 -0800
commita4e84d56d5959dae685c5e22db202cd86b5b322b (patch)
tree0d39d545cfb2d5bef03374217f39ce31a2b5f34b
parent24d13dc1e2101d5450bcf20972db445363b52685 (diff)
feat: add opa_fmt formatter (#267)
-rw-r--r--README.md1
-rw-r--r--doc/conform.txt1
-rw-r--r--lua/conform/formatters/opa_fmt.lua9
3 files changed, 11 insertions, 0 deletions
diff --git a/README.md b/README.md
index 1432a9d..6e16696 100644
--- a/README.md
+++ b/README.md
@@ -242,6 +242,7 @@ You can view this list in vim with `:help conform-formatters`
- [nixfmt](https://github.com/serokell/nixfmt) - nixfmt is a formatter for Nix code, intended to apply a uniform style.
- [nixpkgs_fmt](https://github.com/nix-community/nixpkgs-fmt) - nixpkgs-fmt is a Nix code formatter for nixpkgs.
- [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) - Auto-formatter for OCaml code.
+- [opa_fmt](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt) - Format Rego files using `opa fmt` command.
- [packer_fmt](https://developer.hashicorp.com/packer/docs/commands/fmt) - The packer fmt Packer command is used to format HCL2 configuration files to a canonical format and style.
- [pangu](https://github.com/vinta/pangu.py) - Insert whitespace between CJK and half-width characters.
- [perlimports](https://github.com/perl-ide/App-perlimports) - Make implicit Perl imports explicit.
diff --git a/doc/conform.txt b/doc/conform.txt
index c9b929f..ad2c736 100644
--- a/doc/conform.txt
+++ b/doc/conform.txt
@@ -265,6 +265,7 @@ FORMATTERS *conform-formatter
style.
`nixpkgs_fmt` - nixpkgs-fmt is a Nix code formatter for nixpkgs.
`ocamlformat` - Auto-formatter for OCaml code.
+`opa_fmt` - Format Rego files using `opa fmt` command.
`packer_fmt` - The packer fmt Packer command is used to format HCL2
configuration files to a canonical format and style.
`pangu` - Insert whitespace between CJK and half-width characters.
diff --git a/lua/conform/formatters/opa_fmt.lua b/lua/conform/formatters/opa_fmt.lua
new file mode 100644
index 0000000..b4f95dd
--- /dev/null
+++ b/lua/conform/formatters/opa_fmt.lua
@@ -0,0 +1,9 @@
+---@type conform.FileFormatterConfig
+return {
+ meta = {
+ url = "https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt",
+ description = "Format Rego files using `opa fmt` command.",
+ },
+ command = "opa",
+ args = { "fmt" },
+}