From a70624cd47ace4fd04eaba98b36c2942f72b2197 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Thu, 6 Oct 2022 07:01:11 -0500 Subject: [PATCH] add instructions for setting up cargo insta (#334) --- CONTRIBUTING.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 94fcb0e34ff77..9d3fc4c7f79ae 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,12 @@ your proposed change. ruff is written in Rust (1.63.0). You'll need to install the [Rust toolchain](https://www.rust-lang.org/tools/install) for development. +You'll also need [Insta](https://insta.rs/docs/) to update snapshot tests: + +```shell +cargo install cargo-insta +``` + ### Development After cloning the repository, run ruff locally with: @@ -58,7 +64,7 @@ similar rules are implemented. To add a test fixture, create a file under `resources/test/fixtures`, named to match the `CheckCode` you defined earlier (e.g., `E402.py`). This file should contain a variety of violations and non-violations designed to evaluate and demonstrate the behavior of your lint rule. Run ruff locally -with (e.g.) `cargo run resources/test/fixtures/E402.py`. Once you're satisified with the output, +with (e.g.) `cargo run resources/test/fixtures/E402.py`. Once you're satisfied with the output, codify the behavior as a snapshot test by adding a new function to the `mod tests` section of `src/linter.rs`, like so: