From e0514c484bf5bc38764b2a5fb2b729b01044db87 Mon Sep 17 00:00:00 2001 From: Christopher Chang <51393127+chriscerie@users.noreply.github.com> Date: Fri, 13 Oct 2023 20:24:39 -0700 Subject: [PATCH 01/63] Add machine applicable diagnostic --- Cargo.lock | 1 + selene-lib/Cargo.toml | 1 + selene-lib/src/lints.rs | 20 +++++ selene-lib/src/lints/empty_loop.rs | 3 +- selene-lib/src/lints/test_util.rs | 64 +++++++++++++++- .../lints/empty_loop/empty_loop.fixed.diff | 74 +++++++++++++++++++ .../empty_loop/empty_loop_comments.fixed.diff | 73 ++++++++++++++++++ 7 files changed, 233 insertions(+), 3 deletions(-) create mode 100644 selene-lib/tests/lints/empty_loop/empty_loop.fixed.diff create mode 100644 selene-lib/tests/lints/empty_loop/empty_loop_comments.fixed.diff diff --git a/Cargo.lock b/Cargo.lock index 0309ef6b..ab5be762 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -966,6 +966,7 @@ version = "0.25.0" dependencies = [ "codespan", "codespan-reporting", + "diff", "full_moon", "id-arena", "if_chain", diff --git a/selene-lib/Cargo.toml b/selene-lib/Cargo.toml index 96f8ce6e..44c58138 100644 --- a/selene-lib/Cargo.toml +++ b/selene-lib/Cargo.toml @@ -12,6 +12,7 @@ edition.workspace = true [dependencies] codespan = "0.11" codespan-reporting = "0.11" +diff = "0.1.13" full_moon.workspace = true id-arena = "2.2" if_chain = "1.0.2" diff --git a/selene-lib/src/lints.rs b/selene-lib/src/lints.rs index fa42553c..f09ebf9b 100644 --- a/selene-lib/src/lints.rs +++ b/selene-lib/src/lints.rs @@ -96,6 +96,7 @@ pub struct Diagnostic { pub notes: Vec, pub primary_label: Label, pub secondary_labels: Vec