diff options
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | doc/conform.txt | 1 | ||||
-rw-r--r-- | lua/conform/formatters/ruff.lua | 1 | ||||
-rw-r--r-- | lua/conform/formatters/ruff_format.lua | 18 |
4 files changed, 21 insertions, 0 deletions
@@ -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", + }), +} |