From fdc4a0f05c21012f2445a993ebdad700380dcfbf Mon Sep 17 00:00:00 2001 From: Isak Samsten Date: Thu, 14 Sep 2023 17:09:41 +0200 Subject: feat: ruff (#41) --- README.md | 1 + lua/conform/formatters/ruff.lua | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 lua/conform/formatters/ruff.lua diff --git a/README.md b/README.md index 4a9fdfc..41dd443 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,7 @@ To view configured and available formatters, as well as to see the path to the l - [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. - [rustfmt](https://github.com/rust-lang/rustfmt) - A tool for formatting rust code according to style guidelines. +- [ruff](https://github.com/astral-sh/ruff) - An extremely fast Python linter, written in Rust. - [scalafmt](https://github.com/scalameta/scalafmt) - Code formatter for Scala. - [shellharden](https://github.com/anordal/shellharden) - The corrective bash syntax highlighter - [shfmt](https://github.com/mvdan/sh) - A shell parser, formatter, and interpreter with `bash` support. diff --git a/lua/conform/formatters/ruff.lua b/lua/conform/formatters/ruff.lua new file mode 100644 index 0000000..854ac06 --- /dev/null +++ b/lua/conform/formatters/ruff.lua @@ -0,0 +1,19 @@ +return { + meta = { + url = "https://beta.ruff.rs/docs/", + description = "An extremely fast Python linter, written in Rust.", + }, + command = "ruff", + args = { + "--fix", + "-e", + "-n", + "--stdin-filename", + "$FILENAME", + "-", + }, + stdin = true, + cwd = require("conform.util").root_file({ + "pyproject.toml", + }), +} -- cgit v1.2.3-70-g09d2