aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeiser Fernández Gallo <leiserfg@gmail.com>2023-09-21 16:42:48 +0200
committerGitHub <noreply@github.com>2023-09-21 07:42:48 -0700
commit44e9e8292d552f9a35498612a93dff934cc8802f (patch)
tree380923380b9297d7b4183d28d2b26c56aaeb381c
parent807cf2d5a128faa4e19fb2818cea6967016b6a5b (diff)
feat: add ruff formatter and improve ruff root finding (#66)
* Add ruff formatter and improve ruff root finding * Add docs
-rw-r--r--README.md1
-rw-r--r--doc/conform.txt1
-rw-r--r--lua/conform/formatters/ruff.lua1
-rw-r--r--lua/conform/formatters/ruff_format.lua18
4 files changed, 21 insertions, 0 deletions
diff --git a/README.md b/README.md
index 3f2ca97..7475b62 100644
--- a/README.md
+++ b/README.md
@@ -203,6 +203,7 @@ To view configured and available formatters, as well as to see the log file, run
- [prettierd](https://github.com/fsouza/prettierd) - prettier, as a daemon, for ludicrous formatting speed.
- [rubocop](https://github.com/rubocop/rubocop) - Ruby static code analyzer and formatter, based on the community Ruby style guide.
- [ruff](https://beta.ruff.rs/docs/) - An extremely fast Python linter, written in Rust.
+- [ruff_format](https://beta.ruff.rs/docs/) - An extremely fast Python linter, written in Rust. Formatter subcommand.
- [rustfmt](https://github.com/rust-lang/rustfmt) - A tool for formatting rust code according to style guidelines.
- [rustywind](https://github.com/avencera/rustywind) - A tool for formatting Tailwind CSS classes.
- [scalafmt](https://github.com/scalameta/scalafmt) - Code formatter for Scala.
diff --git a/doc/conform.txt b/doc/conform.txt
index 54a3e1e..d00f4e1 100644
--- a/doc/conform.txt
+++ b/doc/conform.txt
@@ -215,6 +215,7 @@ FORMATTERS *conform-formatter
`rubocop` - Ruby static code analyzer and formatter, based on the community Ruby
style guide.
`ruff` - An extremely fast Python linter, written in Rust.
+`ruff_format` - An extremely fast Python linter, written in Rust. Formatter subcommand.
`rustfmt` - A tool for formatting rust code according to style guidelines.
`rustywind` - A tool for formatting Tailwind CSS classes.
`scalafmt` - Code formatter for Scala.
diff --git a/lua/conform/formatters/ruff.lua b/lua/conform/formatters/ruff.lua
index 854ac06..ea9d6c2 100644
--- a/lua/conform/formatters/ruff.lua
+++ b/lua/conform/formatters/ruff.lua
@@ -15,5 +15,6 @@ return {
stdin = true,
cwd = require("conform.util").root_file({
"pyproject.toml",
+ "ruff.conf",
}),
}
diff --git a/lua/conform/formatters/ruff_format.lua b/lua/conform/formatters/ruff_format.lua
new file mode 100644
index 0000000..3f368eb
--- /dev/null
+++ b/lua/conform/formatters/ruff_format.lua
@@ -0,0 +1,18 @@
+return {
+ meta = {
+ url = "https://beta.ruff.rs/docs/",
+ description = "An extremely fast Python linter, written in Rust. Formatter subcommand.",
+ },
+ command = "ruff",
+ args = {
+ "format",
+ "--stdin-filename",
+ "$FILENAME",
+ "-",
+ },
+ stdin = true,
+ cwd = require("conform.util").root_file({
+ "pyproject.toml",
+ "ruff.conf",
+ }),
+}