From e754edaecfca25ddd8dbf5a32ada1750dad6bf44 Mon Sep 17 00:00:00 2001 From: Justin Chu Date: Mon, 27 Mar 2023 08:12:59 -0700 Subject: [PATCH] Run rustfmt in CI (#15217) I considered running clippy as well but ort takes too long to build --- .github/workflows/lint.yml | 5 +++++ .lintrunner.toml | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index d1f9efc47d..8eb4c8dbc9 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -40,6 +40,11 @@ jobs: with: # Version range or exact version of Python to use, using SemVer's version range syntax. Reads from .python-version if unset. python-version: "3.10" + - name: Setup Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + components: rustfmt - name: Install dependencies run: | python -m pip install -r requirements-dev.txt diff --git a/.lintrunner.toml b/.lintrunner.toml index ce123c06ca..b742375b7b 100644 --- a/.lintrunner.toml +++ b/.lintrunner.toml @@ -152,3 +152,19 @@ init_command = [ '--dry-run={{DRYRUN}}', 'pylint==2.15.5', ] + +[[linter]] +code = 'RUSTFMT' +include_patterns = ['**/*.rs'] +command = [ + 'python', + '-m', + 'lintrunner_adapters', + 'run', + 'rustfmt_linter', + '--binary=rustfmt', + '--config-path=rust/rustfmt.toml', + '--', + '@{{PATHSFILE}}' +] +is_formatter = true