Skip to content

Commit 6e0bf9f

Browse files
committed
Create workflow
1 parent d743fb1 commit 6e0bf9f

File tree

60 files changed

+310
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+310
-127
lines changed

.codespellrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[codespell]
2+
skip = demo/addons/gut
3+
builtin = en-GB_to_en-US

.gdlintrc

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
class-definitions-order:
2+
- tools
3+
- classnames
4+
- extends
5+
- signals
6+
- enums
7+
- consts
8+
- exports
9+
- pubvars
10+
- prvvars
11+
- onreadypubvars
12+
- onreadyprvvars
13+
- others
14+
class-load-variable-name: (([A-Z][a-z0-9]*)+|_?[a-z][a-z0-9]*(_[a-z0-9]+)*)
15+
class-name: ([A-Z][a-z0-9]*)+
16+
class-variable-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
17+
comparison-with-itself: null
18+
constant-name: '[A-Z][A-Z0-9]*(_[A-Z0-9]+)*'
19+
disable: []
20+
duplicated-load: null
21+
enum-element-name: '[A-Z][A-Z0-9]*(_[A-Z0-9]+)*'
22+
enum-name: ([A-Z][a-z0-9]*)+
23+
excluded_directories: !!set
24+
.git: null
25+
expression-not-assigned: null
26+
function-argument-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
27+
function-arguments-number: 10
28+
function-name: (_on_([A-Z][a-z0-9]*)+(_[a-z0-9]+)*|_?[a-z][a-z0-9]*(_[a-z0-9]+)*)
29+
function-preload-variable-name: ([A-Z][a-z0-9]*)+
30+
function-variable-name: '[a-z][a-z0-9]*(_[a-z0-9]+)*'
31+
load-constant-name: (([A-Z][a-z0-9]*)+|[A-Z][A-Z0-9]*(_[A-Z0-9]+)*)
32+
loop-variable-name: _?[a-z][a-z0-9]*(_[a-z0-9]+)*
33+
max-file-lines: 1000
34+
max-line-length: 100
35+
max-public-methods: 20
36+
max-returns: 6
37+
mixed-tabs-and-spaces: null
38+
no-elif-return: null
39+
no-else-return: null
40+
private-method-call: null
41+
signal-name: '[a-z][a-z0-9]*(_[a-z0-9]+)*'
42+
sub-class-name: _?([A-Z][a-z0-9]*)+
43+
tab-characters: 1
44+
trailing-whitespace: null
45+
unnecessary-pass: null
46+
unused-argument: null

.github/workflows/master.yml

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: 🌟 Master
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
gdscript:
9+
name: 💅 Linting / 🤖 GDScript
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- run: pip3 install "gdtoolkit==4.*"
14+
- run: bash -c 'for f in ./demo/addons/json_config_file/**/*.gd; do gdlint "$f"; done'
15+
- run: bash -c 'for f in ./demo/tests/**/*.gd; do gdlint "$f"; done'
16+
17+
spelling:
18+
name: 💅 Linting / 👓 Spelling
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v3
22+
- uses: codespell-project/actions-codespell@v1
23+
24+
unit-testing:
25+
name: 🧪 Unit Testing
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
30+
- name: Download Godot
31+
run: |
32+
curl -O https://downloads.tuxfamily.org/godotengine/4.0.3/Godot_v4.0.3-stable_linux.x86_64.zip
33+
unzip Godot_v4.0.3-stable_linux.x86_64.zip
34+
35+
- name: Execute tests
36+
run: |
37+
./Godot_v4.0.3-stable_linux.x86_64 --headless -d -s --path ./demo addons/gut/gut_cmdln.gd
38+
39+
package:
40+
name: 📦 Package
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Create addon
46+
run: |
47+
mkdir addons
48+
cp -R demo/addons/json_config_file addons
49+
cp LICENSE.md addons/json_config_file
50+
51+
- name: Create package
52+
run: |
53+
zip -r json_config_file.zip addons
54+
55+
- name: Upload addon
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: json_config_file
59+
path: json_config_file.zip

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
.godot
1+
2+
#################################################################
3+
# TODO: Replace with .godot when the following issue is solved: #
4+
# https://github.com/godotengine/godot/issues/75684 #
5+
demo/.godot/editor
6+
demo/.godot/shader_cache
7+
#################################################################
28
.import/
39
export.cfg
410
export_presets.cfg

LICENSE.txt renamed to LICENSE.md

+2

demo/.godot/.gdignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
list=Array[Dictionary]([{
2+
"base": &"RefCounted",
3+
"class": &"GutHookScript",
4+
"icon": "",
5+
"language": &"GDScript",
6+
"path": "res://addons/gut/hook_script.gd"
7+
}, {
8+
"base": &"RefCounted",
9+
"class": &"GutStringUtils",
10+
"icon": "",
11+
"language": &"GDScript",
12+
"path": "res://addons/gut/strutils.gd"
13+
}, {
14+
"base": &"Node",
15+
"class": &"GutTest",
16+
"icon": "",
17+
"language": &"GDScript",
18+
"path": "res://addons/gut/test.gd"
19+
}, {
20+
"base": &"Object",
21+
"class": &"JSONConfigFile",
22+
"icon": "",
23+
"language": &"GDScript",
24+
"path": "res://addons/json_config_file/json_config_file.gd"
25+
}, {
26+
"base": &"Object",
27+
"class": &"JSONSchema",
28+
"icon": "",
29+
"language": &"GDScript",
30+
"path": "res://addons/json_config_file/json_schema.gd"
31+
}, {
32+
"base": &"GutTest",
33+
"class": &"PropertyGutTest",
34+
"icon": "",
35+
"language": &"GDScript",
36+
"path": "res://tests/properties/property_gut_test.gd"
37+
}])
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="401e77d048b500d714375a77d4ca4326"
2+
dest_md5="5b1c05f40fbc665e33ca0e2dec4e6e0e"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="75a018507317f09d0004b8c1148dd3e5"
2+
dest_md5="5f4892d10f008ec5c814acfa2970ab31"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="b3f0e3061651d3bf5c65104a3179e57b"
2+
dest_md5="721f89063bdbefea56b813948517b02e"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="418d6668afcddb7714104f43bfb39657"
2+
dest_md5="04d841b5b58415455fd9361ffce923ad"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="696e70ec3151341523d0a1362670d8ad"
2+
dest_md5="64d5ad625ce18c3207bd390c980d3368"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="15e9706fbc67b38db21e8e963fc1a6c0"
2+
dest_md5="fddfc8c0f7282b08cbd665756e303d84"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="ace04e0c254883041bc7effb9d951cf2"
2+
dest_md5="38f8c244682ef406b4babad518971503"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="03ef685b34f3356631c3f60c91917002"
2+
dest_md5="9e790277f7ef9d8f24f9eade11650424"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="a39e5778312a715a82d7afe88ebac015"
2+
dest_md5="e1708fcd9d3301aa864cf42a7d0e2a23"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="9f56fb2bffbac7662cb53b783248698a"
2+
dest_md5="93e345b09264548aaa90c394d7b04722"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="40a68e931d9f1c543eac616acb53b2d8"
2+
dest_md5="a1691b09fea8925eecd82b2ca432d59f"
3+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="fb8c29136b1ee99fe9dd45a6f8bcc9fd"
2+
dest_md5="09b7222b159c15b9f87a0ed1324575bd"
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="e08fa5e2d1db0b8c3be5d7c3a283e0d6"
2+
dest_md5="4a3771c003760773de74ab4e1fcdf319"
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="7e797286efcb86b4faa1ffb8c94d3729"
2+
dest_md5="9dd9518447983107985e8dea670a3760"
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="49322323dbfd05d7490287be3ef71455"
2+
dest_md5="39c9c350813a86129ddc5a401087969e"
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="f882b9f30a6463fbe33f92d3de5591a1"
2+
dest_md5="47f392d2dafc98219db2ee08876166fe"
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="a7e19d807f2c9531dad610497baf5c99"
2+
dest_md5="a4b804eb87c97b53fccc0d3a20a03e22"
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="76aafb04bec0b2c96e9bbcd625a4f6a1"
2+
dest_md5="39aa4086ff9a60a7337c59f1bfe17ac1"
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="6f7a0200c4c8d72d3a94d011d1934fbb"
2+
dest_md5="c5f1d867a4296b4a8fde39b9852aa412"
3+
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source_md5="2bfcbc12c7b7fc61fc6d0576796962ba"
2+
dest_md5="acb879a463bc0701372e6b74dc6321fd"
3+

demo/.godot/uid_cache.bin

1.72 KB
Binary file not shown.

demo/.gutconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"dirs": [
3+
"res://tests/"
4+
],
5+
"include_subdirs": true,
6+
"selected": "",
7+
"should_exit": true,
8+
"should_maximize": false,
9+
"tests": [],
10+
"unit_test_name": "",
11+
"disabled_colors": true
12+
}

demo/addons/gut/gui/GutSceneTheme.tres

+4-4
Large diffs are not rendered by default.

demo/addons/json_config_file/json_schema.gd

+21-35
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,9 @@ func _add_property(name: StringName, property_script: Script) -> Object:
111111

112112
func add_exclusivity(property_names: Array[StringName], one_is_required := false) -> void:
113113
assert(property_names.all(func(name: StringName) -> bool: return _property_exists(name)))
114-
assert(
115-
property_names.all(
116-
func(name: StringName) -> bool: return _get_property_by_name(name)._required == false
117-
)
118-
)
114+
assert(property_names.all(
115+
func(name: StringName) -> bool: return _get_property_by_name(name)._required == false
116+
))
119117

120118
_exclusivity_relations.append(_ExclusivityRelation.new(property_names, one_is_required))
121119

@@ -220,49 +218,38 @@ func _parse(value: Variant, json_config_file_path := "") -> Dictionary:
220218

221219

222220
static func _not_allowed_property_error(property: StringName) -> _ValidationMsg:
223-
return (
224-
_ValidationMsg
225-
. new_error(
226-
_type_name + ":not_allowed_property",
227-
"Unkown property: '%s', this property is not allowed" % property,
228-
{"property": property},
229-
)
221+
return _ValidationMsg.new_error(
222+
_type_name + ":not_allowed_property",
223+
"Unkown property: '%s', this property is not allowed" % property,
224+
{"property": property},
230225
)
231226

232227

233228
static func _required_property_error(property: StringName) -> _ValidationMsg:
234-
return (
235-
_ValidationMsg
236-
. new_error(
237-
_type_name + ":required_property",
238-
"Missing property: '%s', this property is required" % property,
239-
{"property": property},
240-
)
229+
return _ValidationMsg.new_error(
230+
_type_name + ":required_property",
231+
"Missing property: '%s', this property is required" % property,
232+
{"property": property},
241233
)
242234

243235

244236
static func _required_dependent_property_error(
245237
main_property: StringName, dependent_property: StringName
246238
) -> _ValidationMsg:
247-
return (
248-
_ValidationMsg
249-
. new_error(
250-
_type_name + ":required_dependent_property",
251-
(
252-
"Missing property: '%s', this property is required if '%s' has been specified"
253-
% [dependent_property, main_property]
254-
),
255-
{"main_property": main_property, "dependent_property": dependent_property},
256-
)
239+
return _ValidationMsg.new_error(
240+
_type_name + ":required_dependent_property",
241+
"Missing property: '%s', this property is required if '%s' has been specified" % [
242+
dependent_property, main_property
243+
],
244+
{"main_property": main_property, "dependent_property": dependent_property},
257245
)
258246

259247

260248
static func _one_property_is_required_error(properties: Array[StringName]) -> _ValidationMsg:
261249
return _ValidationMsg.new_error(
262250
_type_name + ":one_property_is_required",
263-
(
264-
"One of this properties needs to be specified: %s"
265-
% _ValidationMsg._array_as_text(properties)
251+
"One of this properties needs to be specified: %s" % _ValidationMsg._array_as_text(
252+
properties
266253
),
267254
{"properties": properties}
268255
)
@@ -271,9 +258,8 @@ static func _one_property_is_required_error(properties: Array[StringName]) -> _V
271258
static func _exclusive_properties_error(properties: Array[StringName]) -> _ValidationMsg:
272259
return _ValidationMsg.new_error(
273260
_type_name + ":exclusive_properties",
274-
(
275-
"This properties can not be defined at the same time: %s"
276-
% _ValidationMsg._array_as_text(properties)
261+
"This properties can not be defined at the same time: %s" % _ValidationMsg._array_as_text(
262+
properties
277263
),
278264
{"properties": properties}
279265
)

demo/addons/json_config_file/scripts/validation_msg.gd

+6-10
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ static func new_warning(code: StringName, message: String, info: Dictionary) ->
3434
func as_text() -> String:
3535
if context_levels.is_empty():
3636
return message + "."
37-
else:
38-
return message + ", at '" + _context_as_text() + "'."
37+
return message + ", at '" + _context_as_text() + "'."
3938

4039

4140
func _context_as_text() -> String:
@@ -65,14 +64,11 @@ func _to_string() -> String:
6564

6665

6766
static func _wrong_type_error(type: String) -> ValidationMsg:
68-
return (
69-
ValidationMsg
70-
. new(
71-
Importance.ERROR,
72-
"wrong_type",
73-
"Wrong type: expected '%s'" % type,
74-
{"type": type},
75-
)
67+
return ValidationMsg.new(
68+
Importance.ERROR,
69+
"wrong_type",
70+
"Wrong type: expected '%s'" % type,
71+
{"type": type},
7672
)
7773

7874

0 commit comments

Comments
 (0)