From 74177339f3a1b5e1b7d5e660b45479ecc0aa834e Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Tue, 12 Dec 2023 20:36:35 -0500 Subject: [PATCH] Always comment when Squawk checks a file (#330) Previously we would only add or update a comment if violations found. In cases where violations were resolved, this would leave stale warnings in comments. Now we will always comment as long as files are found and checked. There is a slight edge case where if a file is no longer in the pull request, the comment won't be updated. related: #326 --- CHANGELOG.md | 6 ++++++ Cargo.lock | 2 +- cli/Cargo.toml | 2 +- cli/src/subcommand.rs | 4 +++- flake.nix | 2 +- package.json | 2 +- 6 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51ce8dd6..bc17d5ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## v0.26.0 - 2023-12-12 + +### Changed + +- `squawk upload-to-github` will always leave a pull request comment if files are evaluated. Previously if violations were resolved, stale warnings would be left in a comment. (#330) + ## v0.25.0 - 2023-12-09 ### Added diff --git a/Cargo.lock b/Cargo.lock index d58a1f06..89de50ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1595,7 +1595,7 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "squawk" -version = "0.25.0" +version = "0.26.0" dependencies = [ "atty", "base64 0.12.3", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 8794b736..4b006c8d 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "squawk" -version = "0.25.0" +version = "0.26.0" authors = ["Steve Dignam "] edition = "2018" license = "GPL-3.0" diff --git a/cli/src/subcommand.rs b/cli/src/subcommand.rs index 69365b83..fbe86e0a 100644 --- a/cli/src/subcommand.rs +++ b/cli/src/subcommand.rs @@ -191,7 +191,9 @@ pub fn check_and_comment_on_pr( pg_version, assume_in_transaction, )?; - if file_results.is_empty() { + + // We should only leave a comment when there are files checked. + if paths.is_empty() { info!("no files checked, exiting"); return Ok(()); } diff --git a/flake.nix b/flake.nix index e0b931d9..7cc1c956 100644 --- a/flake.nix +++ b/flake.nix @@ -18,7 +18,7 @@ { squawk = final.rustPlatform.buildRustPackage { pname = "squawk"; - version = "0.25.0"; + version = "0.26.0"; cargoLock = { lockFile = ./Cargo.lock; diff --git a/package.json b/package.json index 63a6fbee..6688f7be 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "squawk-cli", - "version": "0.25.0", + "version": "0.26.0", "description": "linter for PostgreSQL, focused on migrations", "repository": "git@github.com:sbdchd/squawk.git", "author": "Steve Dignam ",