From 134d53d07d8b34e544c8df2e6282286bb10e9fff Mon Sep 17 00:00:00 2001 From: Christopher Dignam Date: Wed, 15 Jun 2022 09:44:29 -0400 Subject: [PATCH] fix parsing configuration file enum members (#217) Before we were getting this error: ``` Configuration error: Failed to parse configuration file: unknown variant `require-concurrent-index-creation`, expected one of `RequireConcurrentIndexCreation`, `RequireConcurrentIndexDeletion`, `ConstraintMissingNotValid`, `AddingFieldWithDefault`, `AddingForeignKeyConstraint`, `ChangingColumnType`, `AddingNotNullableField`, `AddingSerialPrimaryKeyField`, `RenamingColumn`, `RenamingTable`, `DisallowedUniqueConstraint`, `BanDropDatabase`, `PreferTextField`, `PreferRobustStmts`, `BanCharField`, `BanDropColumn` for key `excluded_rules` at line 1 column 1 ``` --- CHANGELOG.md | 6 ++++++ Cargo.lock | 2 +- cli/Cargo.toml | 2 +- cli/src/reporter.rs | 2 +- linter/src/violations.rs | 1 + package.json | 2 +- 6 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d616d72e..b1593c4e 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.13.1 - 2022-06-15 + +## Fixed + +- fix parsing enum values from configuration file. (#217) + ## v0.13.0 - 2022-06-06 ## Added diff --git a/Cargo.lock b/Cargo.lock index da798388..f653c16e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1616,7 +1616,7 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "squawk" -version = "0.13.0" +version = "0.13.1" dependencies = [ "atty", "base64 0.12.3", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 1bd174a0..7f1bdece 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "squawk" -version = "0.13.0" +version = "0.13.1" authors = ["Steve Dignam "] edition = "2018" license = "GPL-3.0" diff --git a/cli/src/reporter.rs b/cli/src/reporter.rs index 2fc93811..d6e66a53 100644 --- a/cli/src/reporter.rs +++ b/cli/src/reporter.rs @@ -663,7 +663,7 @@ SELECT 1; ); assert!(res.is_ok()); - assert_display_snapshot!(String::from_utf8_lossy(&buff), @r###"[{"file":"main.sql","line":1,"column":0,"level":"Warning","messages":[{"Note":"Adding a NOT NULL field requires exclusive locks and table rewrites."},{"Help":"Make the field nullable."}],"rule_name":"AddingNotNullableField"},{"file":"main.sql","line":3,"column":1,"level":"Warning","messages":[{"Note":"Adding a NOT NULL field requires exclusive locks and table rewrites."},{"Help":"Make the field nullable."}],"rule_name":"AddingNotNullableField"}] + assert_display_snapshot!(String::from_utf8_lossy(&buff), @r###"[{"file":"main.sql","line":1,"column":0,"level":"Warning","messages":[{"Note":"Adding a NOT NULL field requires exclusive locks and table rewrites."},{"Help":"Make the field nullable."}],"rule_name":"adding-not-nullable-field"},{"file":"main.sql","line":3,"column":1,"level":"Warning","messages":[{"Note":"Adding a NOT NULL field requires exclusive locks and table rewrites."},{"Help":"Make the field nullable."}],"rule_name":"adding-not-nullable-field"}] "###); } diff --git a/linter/src/violations.rs b/linter/src/violations.rs index be570fb5..80f213ba 100644 --- a/linter/src/violations.rs +++ b/linter/src/violations.rs @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize}; pub use squawk_parser::ast::Span; #[derive(Debug, PartialEq, Clone, Serialize, Hash, Eq, Deserialize)] +#[serde(rename_all = "kebab-case")] pub enum RuleViolationKind { RequireConcurrentIndexCreation, RequireConcurrentIndexDeletion, diff --git a/package.json b/package.json index 7a003fb1..aaf7da50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "squawk-cli", - "version": "0.13.0", + "version": "0.13.1", "description": "linter for PostgreSQL, focused on migrations", "repository": "git@github.com:sbdchd/squawk.git", "author": "Steve Dignam ",