From 2cf5f564cd24b70ec39b2799c2274def912a71e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Sat, 11 May 2024 11:00:51 -0700 Subject: [PATCH] Add rust linter to pre-commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- .pre-commit-config.yaml | 15 +++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 1 + rust-toolchain.toml | 2 +- tox.ini | 2 +- 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7740674..d76ae29 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,21 @@ repos: - id: ruff-format - id: ruff args: [ "--fix", "--unsafe-fixes", "--exit-non-zero-on-fix" ] + - repo: local + hooks: + - id: rustfmt + name: rustfmt + entry: rustfmt + language: rust + language_version: "1.78" + types: [ rust ] + - id: clippy + name: clippy + entry: cargo clippy --all-targets --all-features --fix --allow-dirty --allow-staged --offline + language: rust + language_version: "1.78" + types: [ rust ] + pass_filenames: false - repo: meta hooks: - id: check-hooks-apply diff --git a/Cargo.lock b/Cargo.lock index 81898e8..b6e5a81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -520,7 +520,7 @@ dependencies = [ [[package]] name = "pyproject-fmt-rust" -version = "1.0.1" +version = "1.0.4" dependencies = [ "indoc", "lexical-sort", diff --git a/Cargo.toml b/Cargo.toml index 194de8a..51dc66f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "pyproject-fmt-rust" +rust-version = "1.78.0" version = "1.0.4" description = "Format pyproject.toml files" repository = "https://github.com/tox-dev/pyproject-fmt" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index fcc85b9..744175d 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.77" +channel = "1.78" diff --git a/tox.ini b/tox.ini index afef20a..07ad477 100644 --- a/tox.ini +++ b/tox.ini @@ -37,7 +37,7 @@ allowlist_externals = description = run static analysis and style check using flake8 skip_install = true deps = - pre-commit>=3.7 + pre-commit>=3.7.1 commands = pre-commit run --all-files --show-diff-on-failure