Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiaanspeck committed Dec 10, 2024
1 parent 0ca0b4f commit f020e68
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class FormattingWalkerTest {

private List<TextEdit> 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);
}

Expand Down Expand Up @@ -441,15 +441,15 @@ 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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits).isEmpty();
}

@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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits)
.containsExactly(
Expand All @@ -462,15 +462,15 @@ 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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits).isEmpty();
}

@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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits)
.containsExactly(
Expand Down Expand Up @@ -600,15 +600,15 @@ 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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits).isEmpty();
}

@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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits)
.containsExactly(
Expand All @@ -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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits).isEmpty();
}
Expand All @@ -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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits)
.containsExactly(
Expand All @@ -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<TextEdit> edits = this.getEdits(code, options);
assertThat(edits)
.containsExactly(
Expand Down

0 comments on commit f020e68

Please sign in to comment.