Skip to content

Commit 1b86734

Browse files
Jammy-LouieTeamModerne
authored andcommitted
refactor: New line at the end of SourceSpecs text blocks
Use this link to re-run the recipe: https://app.moderne.io/recipes/org.openrewrite.java.recipes.SourceSpecTextBlockNewLine?organizationId=T3BlblJld3JpdGU%3D Co-authored-by: Moderne <[email protected]>
1 parent 74e3ca9 commit 1b86734

File tree

3 files changed

+28
-14
lines changed

3 files changed

+28
-14
lines changed

rewrite-python/src/test/java/org/openrewrite/python/style/AutodetectTest.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ class AutodetectTest implements RewriteTest {
3333
void autodetectSpaces2() {
3434
rewriteRun(
3535
hasIndentation(2),
36-
python("""
36+
python(
37+
"""
3738
if 1 > 0:
3839
print("This one-space indent will be effectively ignored")
3940
@@ -42,15 +43,17 @@ void autodetectSpaces2() {
4243
for j in range(1, i):
4344
x = j * j
4445
print(i, j)
45-
""")
46+
"""
47+
)
4648
);
4749
}
4850

4951
@Test
5052
void autodetectSpaces4() {
5153
rewriteRun(
5254
hasIndentation(4),
53-
python("""
55+
python(
56+
"""
5457
if 1 > 0:
5558
print("This one-space indent will be effectively ignored")
5659
@@ -59,7 +62,8 @@ void autodetectSpaces4() {
5962
for j in range(1, i):
6063
x = j * j
6164
print(i, j)
62-
""")
65+
"""
66+
)
6367
);
6468
}
6569

@@ -89,7 +93,8 @@ void autodetectOperatorSpacing() {
8993
y = 3 * 4
9094
z = x + y
9195
result = (x + y) * z
92-
""")
96+
"""
97+
)
9398
);
9499
}
95100

@@ -107,7 +112,8 @@ void autodetectNoOperatorSpacing() {
107112
y=3*4
108113
z=x+y
109114
result=(x+y)*z
110-
""")
115+
"""
116+
)
111117
);
112118
}
113119

@@ -124,7 +130,8 @@ def test ( x, y ):
124130
return x + y
125131
126132
result = test ( 1, 2 )
127-
""")
133+
"""
134+
)
128135
);
129136
}
130137

@@ -141,7 +148,8 @@ def calculate(x : int, y : float) -> float:
141148
return x + y
142149
143150
result : float = calculate(1, 2.0)
144-
""")
151+
"""
152+
)
145153
);
146154
}
147155

@@ -177,7 +185,8 @@ void autodetectBraceAndBracketSpacing() {
177185
numbers = [ 1, 2, 3 ]
178186
data = { "a": 1, "b": 2 }
179187
matrix = [ [ 1, 2 ], [ 3, 4 ] ]
180-
""")
188+
"""
189+
)
181190
);
182191
}
183192

@@ -193,7 +202,8 @@ void autodetectBraceAndBracketSpacingEmpty() {
193202
numbers = [ ]
194203
data = { }
195204
matrix = [ [ ], [ ] ]
196-
""")
205+
"""
206+
)
197207
);
198208
}
199209

@@ -208,7 +218,8 @@ void autodetectComprehensionSpacing() {
208218
"""
209219
squares = [ x*x for x in range(10) ]
210220
evens = { x for x in range(20) if x % 2 == 0 }
211-
""")
221+
"""
222+
)
212223
);
213224
}
214225

rewrite-python/src/test/java/org/openrewrite/python/tree/ImportTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ void multipleImports() {
112112
import sys
113113
114114
import math
115-
""")
115+
"""
116+
)
116117
);
117118
}
118119

@@ -126,7 +127,8 @@ from math import (
126127
sin,
127128
cos
128129
)
129-
""")
130+
"""
131+
)
130132
);
131133
}
132134

rewrite-python/src/test/java/org/openrewrite/python/tree/VariableScopeTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ void assignment() {
5959
import pygenie
6060
6161
pygenie.conf.DEFAULT_GENIE_URL = "http://genie:8080"
62-
""")
62+
"""
63+
)
6364
);
6465
}
6566
}

0 commit comments

Comments
 (0)