From 323f7f4b71f5525563fc733471f2ed8487ad3d36 Mon Sep 17 00:00:00 2001 From: Michael Dowling Date: Mon, 12 Feb 2024 13:59:19 -0600 Subject: [PATCH] Fix CSV headers after moving line and column --- .../smithy/cli/commands/ValidationEventFormatOptions.java | 2 +- .../software/amazon/smithy/cli/commands/DiffCommandTest.java | 2 +- .../amazon/smithy/cli/commands/ValidateCommandTest.java | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ValidationEventFormatOptions.java b/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ValidationEventFormatOptions.java index 7e1b265bec4..9eb3c6d94b7 100644 --- a/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ValidationEventFormatOptions.java +++ b/smithy-cli/src/main/java/software/amazon/smithy/cli/commands/ValidationEventFormatOptions.java @@ -29,7 +29,7 @@ void print(CliPrinter printer, ValidationEventFormatter formatter, ValidationEve CSV { @Override void beginPrinting(CliPrinter printer) { - printer.println("severity,id,shape,file,message,hint,suppressionReason"); + printer.println("severity,id,shape,file,line,column,message,hint,suppressionReason"); } @Override diff --git a/smithy-cli/src/test/java/software/amazon/smithy/cli/commands/DiffCommandTest.java b/smithy-cli/src/test/java/software/amazon/smithy/cli/commands/DiffCommandTest.java index f71620cb39f..19a2150caf7 100644 --- a/smithy-cli/src/test/java/software/amazon/smithy/cli/commands/DiffCommandTest.java +++ b/smithy-cli/src/test/java/software/amazon/smithy/cli/commands/DiffCommandTest.java @@ -33,7 +33,7 @@ public void canOutputCsv() throws Exception { String[] lines = result.stdout().split("(\\r\\n|\\r|\\n)"); assertThat(lines.length, is(2)); - assertThat(lines[0], containsString("severity,id,shape,file,message,hint,suppressionReason")); + assertThat(lines[0], containsString("severity,id,shape,file,line,column,message,hint,suppressionReason")); assertThat(lines[1], containsString("\"ERROR\",\"ChangedShapeType\",\"smithy.example#Hello\"")); } } diff --git a/smithy-cli/src/test/java/software/amazon/smithy/cli/commands/ValidateCommandTest.java b/smithy-cli/src/test/java/software/amazon/smithy/cli/commands/ValidateCommandTest.java index 91654f57c6b..7461b109bf3 100644 --- a/smithy-cli/src/test/java/software/amazon/smithy/cli/commands/ValidateCommandTest.java +++ b/smithy-cli/src/test/java/software/amazon/smithy/cli/commands/ValidateCommandTest.java @@ -18,6 +18,7 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import java.net.URISyntaxException; @@ -228,6 +229,9 @@ public void canOutputCsv() throws Exception { assertThat(result.stdout(), containsString("EmitDangers")); assertThat(result.stdout(), containsString("HttpLabelTrait")); assertThat(result.stdout(), not(containsString("FAILURE"))); // stderr + + String[] lines = result.stdout().split("(\\r\\n|\\r|\\n)"); + assertThat(lines[0], containsString("severity,id,shape,file,line,column,message,hint,suppressionReason")); } @Test