gdharness 1.1.22 → 1.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,18 +3,22 @@ extends RefCounted
3
3
  const Read = preload("reading.gd")
4
4
  const Log = preload("logger.gd")
5
5
 
6
- # The base class each category name stands for.
6
+ # The base classes each category name stands for. Kept to the list the tool's schema offers, which
7
+ # a case holds: the schema offered physics3d and ui, which this refused, and physics answered the 3D
8
+ # bodies alone beside physics2d and physics3d.
7
9
  const CATEGORY_BASES: Dictionary = {
8
- "node": "Node",
9
- "node2d": "Node2D",
10
- "node3d": "Node3D",
11
- "control": "Control",
12
- "resource": "Resource",
13
- "physics": "PhysicsBody3D",
14
- "physics2d": "PhysicsBody2D",
15
- "audio": "AudioStream",
16
- "visual": "VisualInstance3D",
17
- "animation": "AnimationMixer",
10
+ "node": ["Node"],
11
+ "node2d": ["Node2D"],
12
+ "node3d": ["Node3D"],
13
+ "control": ["Control"],
14
+ "ui": ["Control"],
15
+ "resource": ["Resource"],
16
+ "physics": ["PhysicsBody2D", "PhysicsBody3D"],
17
+ "physics2d": ["PhysicsBody2D"],
18
+ "physics3d": ["PhysicsBody3D"],
19
+ "audio": ["AudioStream"],
20
+ "visual": ["VisualInstance3D"],
21
+ "animation": ["AnimationMixer"],
18
22
  }
19
23
 
20
24
  var _log: Log
@@ -24,6 +28,14 @@ func _init(p_log: Log) -> void:
24
28
  _log = p_log
25
29
 
26
30
 
31
+ static func _under_any(name: String, bases: Array) -> bool:
32
+ for base: Variant in bases:
33
+ var base_name: String = str(base)
34
+ if name == base_name or ClassDB.is_parent_class(name, base_name):
35
+ return true
36
+ return false
37
+
38
+
27
39
  # Query available classes from ClassDB with optional filtering
28
40
  func query_classes(params: Dictionary) -> Dictionary:
29
41
  var filter: String = str(params.get("filter", ""))
@@ -42,10 +54,10 @@ func query_classes(params: Dictionary) -> Dictionary:
42
54
  )
43
55
  )
44
56
 
45
- var base_class: String = ""
57
+ var bases: Array = []
46
58
  if not category.is_empty():
47
- base_class = CATEGORY_BASES.get(category.to_lower(), "")
48
- if base_class.is_empty():
59
+ bases = CATEGORY_BASES.get(category.to_lower(), [])
60
+ if bases.is_empty():
49
61
  return _log.failure("Unknown category: " + category + ". Valid: " + str(CATEGORY_BASES.keys()))
50
62
 
51
63
  var all_classes: PackedStringArray = ClassDB.get_class_list()
@@ -60,9 +72,8 @@ func query_classes(params: Dictionary) -> Dictionary:
60
72
  if not filter.is_empty() and not class_name_str.to_lower().contains(filter.to_lower()):
61
73
  continue
62
74
 
63
- if not base_class.is_empty():
64
- if not ClassDB.is_parent_class(class_name_str, base_class) and class_name_str != base_class:
65
- continue
75
+ if not bases.is_empty() and not _under_any(class_name_str, bases):
76
+ continue
66
77
 
67
78
  filtered_classes.append(class_name_str)
68
79
 
@@ -106,7 +106,8 @@ func get_project_health(params: Dictionary) -> Dictionary:
106
106
  if "scenes" in check_categories:
107
107
  var details: Array[String] = []
108
108
 
109
- var scene_files: Array[String] = _files.find_files("res://", ".tscn")
109
+ # Binary scenes too, which a project may save instead and which counted as none.
110
+ var scene_files: Array[String] = _files.find_files_with_extensions("res://", ["tscn", "scn"])
110
111
  if scene_files.size() == 0:
111
112
  details.append("No scene files found in project")
112
113
  deductions += 5