From f020e68552ac95f1ad91eb9bcce2e61c90de115e Mon Sep 17 00:00:00 2001 From: Sebastiaan Speck Date: Tue, 10 Dec 2024 07:03:42 +0100 Subject: [PATCH] Fix build --- .../magik/checks/checks/FormattingCheck.java | 3 ++- .../formatting/MagikFormattingSettings.java | 2 +- .../formatting/MagikFormattingStrategy.java | 4 +++- .../formatting/FormattingWalkerTest.java | 20 +++++++++---------- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/checks/FormattingCheck.java b/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/checks/FormattingCheck.java index c5410c91..0c05487a 100644 --- a/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/checks/FormattingCheck.java +++ b/magik-checks/src/main/java/nl/ramsolutions/sw/magik/checks/checks/FormattingCheck.java @@ -53,7 +53,8 @@ public class FormattingCheck extends MagikCheck { protected void walkPostMagik(final AstNode node) { final boolean insertSpaces = this.indentCharacter.equalsIgnoreCase("space"); final FormattingOptions formattingOptions = - new FormattingOptions(this.tabWidth, insertSpaces, false, false, false, this.checkIndentation); + new FormattingOptions( + this.tabWidth, insertSpaces, false, false, false, this.checkIndentation); final FormattingWalker walker = new FormattingWalker(formattingOptions); final AstNode topNode = this.getMagikFile().getTopNode(); walker.walkAst(topNode); diff --git a/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingSettings.java b/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingSettings.java index f8af6118..8e560ea6 100644 --- a/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingSettings.java +++ b/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingSettings.java @@ -57,7 +57,7 @@ public boolean trimFinalNewlines() { public boolean checkIndentation() { return this.properties.getPropertyBoolean(KEY_MAGIK_FORMATTING_CHECK_INDENTATION, true); - } + } public String getIndent() { final char indentChar = this.getIndentChar(); diff --git a/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingStrategy.java b/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingStrategy.java index bfec4cd3..08835766 100644 --- a/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingStrategy.java +++ b/magik-squid/src/main/java/nl/ramsolutions/sw/magik/formatting/MagikFormattingStrategy.java @@ -279,7 +279,9 @@ private boolean isBinaryExpression(final AstNode node) { @CheckForNull private TextEdit ensureIndenting(final Token token) { - if (this.indent == 0 && !this.tokenIs(this.lastToken, GenericTokenType.WHITESPACE) && !this.options.isCheckIndentation()) { + if (this.indent == 0 + && !this.tokenIs(this.lastToken, GenericTokenType.WHITESPACE) + && !this.options.isCheckIndentation()) { return null; } diff --git a/magik-squid/src/test/java/nl/ramsolutions/sw/magik/formatting/FormattingWalkerTest.java b/magik-squid/src/test/java/nl/ramsolutions/sw/magik/formatting/FormattingWalkerTest.java index 56c0c759..ec3a8ad9 100644 --- a/magik-squid/src/test/java/nl/ramsolutions/sw/magik/formatting/FormattingWalkerTest.java +++ b/magik-squid/src/test/java/nl/ramsolutions/sw/magik/formatting/FormattingWalkerTest.java @@ -17,7 +17,7 @@ class FormattingWalkerTest { private List getEdits(final String code) { - final FormattingOptions options = new FormattingOptions(8, false, false, true, false); + final FormattingOptions options = new FormattingOptions(8, false, false, true, false, true); return this.getEdits(code, options); } @@ -441,7 +441,7 @@ void testCommentsLineAfter() { @Test void testNoTrimTrailingWhitespaceStatement() { final String code = "a \n"; - final FormattingOptions options = new FormattingOptions(8, false, false, false, false); + final FormattingOptions options = new FormattingOptions(8, false, false, false, false, true); final List edits = this.getEdits(code, options); assertThat(edits).isEmpty(); } @@ -449,7 +449,7 @@ void testNoTrimTrailingWhitespaceStatement() { @Test void testTrimTrailingWhitespaceStatement() { final String code = "a \n"; - final FormattingOptions options = new FormattingOptions(8, false, false, true, false); + final FormattingOptions options = new FormattingOptions(8, false, false, true, false, true); final List edits = this.getEdits(code, options); assertThat(edits) .containsExactly( @@ -462,7 +462,7 @@ void testTrimTrailingWhitespaceStatement() { @Test void testNoTrimTrailingWhitespaceComment() { final String code = "# comment \n"; - final FormattingOptions options = new FormattingOptions(8, false, false, false, false); + final FormattingOptions options = new FormattingOptions(8, false, false, false, false, true); final List edits = this.getEdits(code, options); assertThat(edits).isEmpty(); } @@ -470,7 +470,7 @@ void testNoTrimTrailingWhitespaceComment() { @Test void testTrimTrailingWhitespaceComment() { final String code = "# comment \n"; - final FormattingOptions options = new FormattingOptions(8, false, false, true, false); + final FormattingOptions options = new FormattingOptions(8, false, false, true, false, true); final List edits = this.getEdits(code, options); assertThat(edits) .containsExactly( @@ -600,7 +600,7 @@ void testSingleWhitelineMethodDoc() { @Test void testInsertFinalNewlinePresent() { final String code = "1 + 1\n"; - final FormattingOptions options = new FormattingOptions(8, false, true, false, false); + final FormattingOptions options = new FormattingOptions(8, false, true, false, false, true); final List edits = this.getEdits(code, options); assertThat(edits).isEmpty(); } @@ -608,7 +608,7 @@ void testInsertFinalNewlinePresent() { @Test void testInsertFinalNewlineAbsent() { final String code = "1 + 1"; - final FormattingOptions options = new FormattingOptions(8, false, true, false, false); + final FormattingOptions options = new FormattingOptions(8, false, true, false, false, true); final List edits = this.getEdits(code, options); assertThat(edits) .containsExactly( @@ -619,7 +619,7 @@ void testInsertFinalNewlineAbsent() { @Test void testTrimFinalNewlinesAbsent() { final String code = "1 + 1"; - final FormattingOptions options = new FormattingOptions(8, false, false, false, true); + final FormattingOptions options = new FormattingOptions(8, false, false, false, true, true); final List edits = this.getEdits(code, options); assertThat(edits).isEmpty(); } @@ -631,7 +631,7 @@ void testTrimFinalNewlinesPresent() { 1 + 1 """; - final FormattingOptions options = new FormattingOptions(8, false, false, false, true); + final FormattingOptions options = new FormattingOptions(8, false, false, false, true, true); final List edits = this.getEdits(code, options); assertThat(edits) .containsExactly( @@ -650,7 +650,7 @@ void testFormattingCrLf() { a.do()\r _endblock\r """; - final FormattingOptions options = new FormattingOptions(8, false, false, true, false); + final FormattingOptions options = new FormattingOptions(8, false, false, true, false, true); final List edits = this.getEdits(code, options); assertThat(edits) .containsExactly(