Skip to content

Commit 44d1d72

Browse files
committed
Add GDScript .editorconfig rules
- Uniformize `.gd` unit test files indentation to tabs (where needed)
1 parent 91713ce commit 44d1d72

25 files changed

+236
-226
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,13 @@ indent_size = 4
2121
[*.{yml,yaml}]
2222
indent_style = space
2323
indent_size = 2
24+
25+
# GDScript unit test files
26+
[*.gd]
27+
indent_style = tab
28+
indent_size = 4
29+
insert_final_newline = true
30+
trim_trailing_whitespace = true
31+
32+
[*.out]
33+
insert_final_newline = true

modules/gdscript/tests/scripts/analyzer/errors/enum_preload_unnamed_assign_to_named.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
enum MyEnum { VALUE_A, VALUE_B, VALUE_C = 42 }
2+
23
func test():
34
const P = preload("../features/enum_value_from_parent.gd")
45
var local_var: MyEnum
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
class A:
2-
class B:
3-
func test():
4-
print(A.B.D)
2+
class B:
3+
func test():
4+
print(A.B.D)
55

66
class C:
7-
class D:
8-
pass
7+
class D:
8+
pass
99

1010
func test():
11-
var inst = A.B.new()
12-
inst.test()
11+
var inst = A.B.new()
12+
inst.test()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
func test() -> void:
2-
return null
2+
return null
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
func test() -> void:
2-
var a
3-
a = 1
4-
return a
2+
var a
3+
a = 1
4+
return a

modules/gdscript/tests/scripts/analyzer/features/base_outer_resolution.gd

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ func test() -> void:
1111
Extend.InnerClass.InnerInnerClass.test_a_b_c(A.new(), B.new(), C.new())
1212
Extend.InnerClass.InnerInnerClass.test_enum(C.TestEnum.HELLO_WORLD)
1313
Extend.InnerClass.InnerInnerClass.test_a_prime(A.APrime.new())
14-
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
class A:
2-
var x = 3
2+
var x = 3
33

44
class B:
5-
var x = 4
5+
var x = 4
66

77
class C:
8-
var x = 5
8+
var x = 5
99

1010
class Test:
11-
var a = A.new()
12-
var b: B = B.new()
13-
var c := C.new()
11+
var a = A.new()
12+
var b: B = B.new()
13+
var c := C.new()
1414

1515
func test():
16-
var test_instance := Test.new()
17-
prints(test_instance.a.x)
18-
prints(test_instance.b.x)
19-
prints(test_instance.c.x)
16+
var test_instance := Test.new()
17+
prints(test_instance.a.x)
18+
prints(test_instance.b.x)
19+
prints(test_instance.c.x)

modules/gdscript/tests/scripts/analyzer/features/external_enum_as_constant.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ const External = preload("external_enum_as_constant_external.notest.gd")
22
const MyEnum = External.MyEnum
33

44
func test():
5-
print(MyEnum.WAITING == 0)
6-
print(MyEnum.GODOT == 1)
5+
print(MyEnum.WAITING == 0)
6+
print(MyEnum.GODOT == 1)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
enum MyEnum {
2-
WAITING,
3-
GODOT
2+
WAITING,
3+
GODOT
44
}
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
# Inner-outer class lookup
22
class A:
3-
const Q: = "right one"
3+
const Q: = "right one"
44

55
class X:
6-
const Q: = "wrong one"
6+
const Q: = "wrong one"
77

88
class Y extends X:
9-
class B extends A:
10-
static func check() -> void:
11-
print(Q)
9+
class B extends A:
10+
static func check() -> void:
11+
print(Q)
1212

1313
# External class lookup
1414
const External: = preload("lookup_class_external.notest.gd")
1515

1616
class Internal extends External.A:
17-
static func check() -> void:
18-
print(TARGET)
17+
static func check() -> void:
18+
print(TARGET)
1919

20-
class E extends External.E:
21-
static func check() -> void:
22-
print(TARGET)
23-
print(WAITING)
20+
class E extends External.E:
21+
static func check() -> void:
22+
print(TARGET)
23+
print(WAITING)
2424

2525
# Variable lookup
2626
class C:
27-
var Q := 'right one'
27+
var Q := 'right one'
2828

2929
class D:
30-
const Q := 'wrong one'
30+
const Q := 'wrong one'
3131

3232
class E extends D:
33-
class F extends C:
34-
func check() -> void:
35-
print(Q)
33+
class F extends C:
34+
func check() -> void:
35+
print(Q)
3636

3737
# Test
3838
func test() -> void:
39-
# Inner-outer class lookup
40-
Y.B.check()
41-
print("---")
42-
43-
# External class lookup
44-
Internal.check()
45-
Internal.E.check()
46-
print("---")
47-
48-
# Variable lookup
49-
var f: = E.F.new()
50-
f.check()
39+
# Inner-outer class lookup
40+
Y.B.check()
41+
print("---")
42+
43+
# External class lookup
44+
Internal.check()
45+
Internal.E.check()
46+
print("---")
47+
48+
# Variable lookup
49+
var f: = E.F.new()
50+
f.check()
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
11
signal hello
22

33
func get_signal() -> Signal:
4-
return hello
4+
return hello
55

66
class A:
7-
signal hello
7+
signal hello
88

9-
func get_signal() -> Signal:
10-
return hello
9+
func get_signal() -> Signal:
10+
return hello
1111

12-
class B:
13-
signal hello
12+
class B:
13+
signal hello
1414

15-
func get_signal() -> Signal:
16-
return hello
15+
func get_signal() -> Signal:
16+
return hello
1717

1818
class C extends A.B:
19-
func get_signal() -> Signal:
20-
return hello
19+
func get_signal() -> Signal:
20+
return hello
2121

2222
func test():
23-
var a: = A.new()
24-
var b: = A.B.new()
25-
var c: = C.new()
26-
27-
var hello_a_result: = hello == a.get_signal()
28-
var hello_b_result: = hello == b.get_signal()
29-
var hello_c_result: = hello == c.get_signal()
30-
var a_b_result: = a.get_signal() == b.get_signal()
31-
var a_c_result: = a.get_signal() == c.get_signal()
32-
var b_c_result: = b.get_signal() == c.get_signal()
33-
var c_c_result: = c.get_signal() == c.get_signal()
34-
35-
print("hello == A.hello? %s" % hello_a_result)
36-
print("hello == A.B.hello? %s" % hello_b_result)
37-
print("hello == C.hello? %s" % hello_c_result)
38-
print("A.hello == A.B.hello? %s" % a_b_result)
39-
print("A.hello == C.hello? %s" % a_c_result)
40-
print("A.B.hello == C.hello? %s" % b_c_result)
41-
print("C.hello == C.hello? %s" % c_c_result)
23+
var a: = A.new()
24+
var b: = A.B.new()
25+
var c: = C.new()
26+
27+
var hello_a_result: = hello == a.get_signal()
28+
var hello_b_result: = hello == b.get_signal()
29+
var hello_c_result: = hello == c.get_signal()
30+
var a_b_result: = a.get_signal() == b.get_signal()
31+
var a_c_result: = a.get_signal() == c.get_signal()
32+
var b_c_result: = b.get_signal() == c.get_signal()
33+
var c_c_result: = c.get_signal() == c.get_signal()
34+
35+
print("hello == A.hello? %s" % hello_a_result)
36+
print("hello == A.B.hello? %s" % hello_b_result)
37+
print("hello == C.hello? %s" % hello_c_result)
38+
print("A.hello == A.B.hello? %s" % a_b_result)
39+
print("A.hello == C.hello? %s" % a_c_result)
40+
print("A.B.hello == C.hello? %s" % b_c_result)
41+
print("C.hello == C.hello? %s" % c_c_result)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
func variant() -> Variant:
2-
return 'variant'
2+
return 'variant'
33

44
func test():
5-
print(variant())
5+
print(variant())

modules/gdscript/tests/scripts/parser/errors/class_name_after_annotation.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
class_name HelloWorld
44

55
func test():
6-
pass
6+
pass
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
func test():
2-
var dictionary = { hello = "world",, }
2+
var dictionary = { hello = "world",, }
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
func test():
2-
match 1:
3-
[[[var a]]], 2:
4-
pass
2+
match 1:
3+
[[[var a]]], 2:
4+
pass
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
11
func foo(x):
2-
match x:
3-
1 + 1:
4-
print("1+1")
5-
[1,2,[1,{1:2,2:var z,..}]]:
6-
print("[1,2,[1,{1:2,2:var z,..}]]")
7-
print(z)
8-
1 if true else 2:
9-
print("1 if true else 2")
10-
1 < 2:
11-
print("1 < 2")
12-
1 or 2 and 1:
13-
print("1 or 2 and 1")
14-
6 | 1:
15-
print("1 | 1")
16-
1 >> 1:
17-
print("1 >> 1")
18-
1, 2 or 3, 4:
19-
print("1, 2 or 3, 4")
20-
_:
21-
print("wildcard")
2+
match x:
3+
1 + 1:
4+
print("1+1")
5+
[1,2,[1,{1:2,2:var z,..}]]:
6+
print("[1,2,[1,{1:2,2:var z,..}]]")
7+
print(z)
8+
1 if true else 2:
9+
print("1 if true else 2")
10+
1 < 2:
11+
print("1 < 2")
12+
1 or 2 and 1:
13+
print("1 or 2 and 1")
14+
6 | 1:
15+
print("1 | 1")
16+
1 >> 1:
17+
print("1 >> 1")
18+
1, 2 or 3, 4:
19+
print("1, 2 or 3, 4")
20+
_:
21+
print("wildcard")
2222

2323
func test():
24-
foo(6 | 1)
25-
foo(1 >> 1)
26-
foo(2)
27-
foo(1)
28-
foo(1+1)
29-
foo(1 < 2)
30-
foo([2, 1])
31-
foo(4)
32-
foo([1, 2, [1, {1 : 2, 2:3}]])
33-
foo([1, 2, [1, {1 : 2, 2:[1,3,5, "123"], 4:2}]])
34-
foo([1, 2, [1, {1 : 2}]])
24+
foo(6 | 1)
25+
foo(1 >> 1)
26+
foo(2)
27+
foo(1)
28+
foo(1+1)
29+
foo(1 < 2)
30+
foo([2, 1])
31+
foo(4)
32+
foo([1, 2, [1, {1 : 2, 2:3}]])
33+
foo([1, 2, [1, {1 : 2, 2:[1,3,5, "123"], 4:2}]])
34+
foo([1, 2, [1, {1 : 2}]])
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
func foo(x):
2-
match x:
3-
1:
4-
print("1")
5-
2:
6-
print("2")
7-
[1, 2]:
8-
print("[1, 2]")
9-
3 or 4:
10-
print("3 or 4")
11-
4:
12-
print("4")
13-
{1 : 2, 2 : 3}:
14-
print("{1 : 2, 2 : 3}")
15-
_:
16-
print("wildcard")
2+
match x:
3+
1:
4+
print("1")
5+
2:
6+
print("2")
7+
[1, 2]:
8+
print("[1, 2]")
9+
3 or 4:
10+
print("3 or 4")
11+
4:
12+
print("4")
13+
{1 : 2, 2 : 3}:
14+
print("{1 : 2, 2 : 3}")
15+
_:
16+
print("wildcard")
1717

1818
func test():
19-
foo(0)
20-
foo(1)
21-
foo(2)
22-
foo([1, 2])
23-
foo(3)
24-
foo(4)
25-
foo([4,4])
26-
foo({1 : 2, 2 : 3})
27-
foo({1 : 2, 4 : 3})
19+
foo(0)
20+
foo(1)
21+
foo(2)
22+
foo([1, 2])
23+
foo(3)
24+
foo(4)
25+
foo([4,4])
26+
foo({1 : 2, 2 : 3})
27+
foo({1 : 2, 4 : 3})

0 commit comments

Comments
 (0)