diff options
author | Steven Arcangeli <stevearc@stevearc.com> | 2023-09-21 07:45:54 -0700 |
---|---|---|
committer | Steven Arcangeli <stevearc@stevearc.com> | 2023-09-21 09:07:01 -0700 |
commit | 9fd54cc59786510011ff4539dee7315f864275c0 (patch) | |
tree | 1fefa88fccf032740f1b75903fb18d864707193d | |
parent | bc25ef011538f42b1afcd480848d805bc60cceca (diff) |
refactor: rename ruff -> ruff_fix
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | doc/conform.txt | 2 | ||||
-rw-r--r-- | lua/conform/formatters/latexindent.lua | 1 | ||||
-rw-r--r-- | lua/conform/formatters/ruff.lua | 24 | ||||
-rw-r--r-- | lua/conform/formatters/ruff_fix.lua | 21 | ||||
-rw-r--r-- | lua/conform/formatters/ruff_format.lua | 3 | ||||
-rw-r--r-- | lua/conform/init.lua | 1 | ||||
-rwxr-xr-x | scripts/generate.py | 3 |
8 files changed, 33 insertions, 24 deletions
@@ -202,7 +202,7 @@ To view configured and available formatters, as well as to see the log file, run - [prettier](https://github.com/prettier/prettier) - Prettier is an opinionated code formatter. It enforces a consistent style by parsing your code and re-printing it with its own rules that take the maximum line length into account, wrapping code when necessary. - [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_fix](https://beta.ruff.rs/docs/) - An extremely fast Python linter, written in Rust. Fix lint errors. - [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. diff --git a/doc/conform.txt b/doc/conform.txt index 199b0f2..d9457e2 100644 --- a/doc/conform.txt +++ b/doc/conform.txt @@ -214,7 +214,7 @@ FORMATTERS *conform-formatter `prettierd` - prettier, as a daemon, for ludicrous formatting speed. `rubocop` - Ruby static code analyzer and formatter, based on the community Ruby style guide. -`ruff` - An extremely fast Python linter, written in Rust. +`ruff_fix` - An extremely fast Python linter, written in Rust. Fix lint errors. `ruff_format` - An extremely fast Python linter, written in Rust. Formatter subcommand. `rustfmt` - A tool for formatting rust code according to style guidelines. diff --git a/lua/conform/formatters/latexindent.lua b/lua/conform/formatters/latexindent.lua index 1ac3c4e..64451e9 100644 --- a/lua/conform/formatters/latexindent.lua +++ b/lua/conform/formatters/latexindent.lua @@ -1,3 +1,4 @@ +---@type conform.FileFormatterConfig return { meta = { url = "https://github.com/cmhughes/latexindent.pl", diff --git a/lua/conform/formatters/ruff.lua b/lua/conform/formatters/ruff.lua index ea9d6c2..9a1d780 100644 --- a/lua/conform/formatters/ruff.lua +++ b/lua/conform/formatters/ruff.lua @@ -1,20 +1,4 @@ -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", - "ruff.conf", - }), -} +-- This was renamed to ruff_fix +local conf = vim.deepcopy(require("conform.formatters.ruff_fix")) +conf.meta.deprecated = true +return conf diff --git a/lua/conform/formatters/ruff_fix.lua b/lua/conform/formatters/ruff_fix.lua new file mode 100644 index 0000000..e6ccfec --- /dev/null +++ b/lua/conform/formatters/ruff_fix.lua @@ -0,0 +1,21 @@ +---@type conform.FileFormatterConfig +return { + meta = { + url = "https://beta.ruff.rs/docs/", + description = "An extremely fast Python linter, written in Rust. Fix lint errors.", + }, + command = "ruff", + args = { + "--fix", + "-e", + "-n", + "--stdin-filename", + "$FILENAME", + "-", + }, + stdin = true, + cwd = require("conform.util").root_file({ + "pyproject.toml", + "ruff.toml", + }), +} diff --git a/lua/conform/formatters/ruff_format.lua b/lua/conform/formatters/ruff_format.lua index 3f368eb..1c9246a 100644 --- a/lua/conform/formatters/ruff_format.lua +++ b/lua/conform/formatters/ruff_format.lua @@ -1,3 +1,4 @@ +---@type conform.FileFormatterConfig return { meta = { url = "https://beta.ruff.rs/docs/", @@ -13,6 +14,6 @@ return { stdin = true, cwd = require("conform.util").root_file({ "pyproject.toml", - "ruff.conf", + "ruff.toml", }), } diff --git a/lua/conform/init.lua b/lua/conform/init.lua index 864d6eb..3e2b01c 100644 --- a/lua/conform/init.lua +++ b/lua/conform/init.lua @@ -24,6 +24,7 @@ local M = {} ---@class (exact) conform.FormatterMeta ---@field url string ---@field description string +---@field deprecated? boolean ---@class (exact) conform.Context ---@field buf integer diff --git a/scripts/generate.py b/scripts/generate.py index 1c794ae..6628c61 100755 --- a/scripts/generate.py +++ b/scripts/generate.py @@ -46,7 +46,8 @@ def get_all_formatters() -> List[Formatter]: formatters = [] for name in names: meta = read_nvim_json(f'require("conform.formatters.{name}").meta') - formatters.append(Formatter(name, **meta)) + if not meta.get("deprecated"): + formatters.append(Formatter(name, **meta)) return formatters |