Skip to content

Commit

Permalink
feat: add ruff formatter and improve ruff root finding (#66)
Browse files Browse the repository at this point in the history
* Add ruff formatter and improve ruff root finding

* Add docs
  • Loading branch information
leiserfg authored Sep 21, 2023
1 parent 807cf2d commit 44e9e82
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions doc/conform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions lua/conform/formatters/ruff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ return {
stdin = true,
cwd = require("conform.util").root_file({
"pyproject.toml",
"ruff.conf",
}),
}
18 changes: 18 additions & 0 deletions lua/conform/formatters/ruff_format.lua
Original file line number Diff line number Diff line change
@@ -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",
}),
}

0 comments on commit 44e9e82

Please sign in to comment.