Fix GDScript editor warnings (shadowed vars, unused param, integer division)

Renames locals/params that shadowed base-class properties (Node.name,
Control.size, BoxContainer.alignment), prefixes an intentionally-unused
parameter, and annotates a deliberate integer division so the console
stays clean during development.
This commit is contained in:
hz
2026-07-23 14:30:48 -05:00
parent 4a4bed2ac5
commit 48f404518f
4 changed files with 12 additions and 11 deletions
+2 -2
View File
@@ -237,8 +237,8 @@ func fetch_counts() -> void:
_enqueue_json("GET", "/counts", "", func(parsed): counts_changed.emit(parsed if typeof(parsed) == TYPE_DICTIONARY else {}), "counts")
func create_deck(name: String, description: String) -> void:
_enqueue_json("POST", "/decks", JSON.stringify({"name": name, "description": description}),
func create_deck(deck_name: String, description: String) -> void:
_enqueue_json("POST", "/decks", JSON.stringify({"name": deck_name, "description": description}),
func(_parsed): fetch_decks(), "decks")
+6 -5
View File
@@ -296,9 +296,9 @@ func _build_footer() -> void:
add_child(status)
func _footer_label(alignment: HorizontalAlignment) -> Label:
func _footer_label(h_align: HorizontalAlignment) -> Label:
var label := Label.new()
label.horizontal_alignment = alignment
label.horizontal_alignment = h_align
label.size_flags_horizontal = Control.SIZE_EXPAND_FILL
label.add_theme_font_size_override("font_size", 14)
Brand.apply_font(label)
@@ -912,6 +912,7 @@ func _simulated_time_text(minute: int, include_day: bool = true) -> String:
func _elapsed_simulated_text(minutes: int) -> String:
@warning_ignore("integer_division")
return "%d Days %02d Hrs %02d Mins" % [minutes / 1440, (minutes % 1440) / 60, minutes % 60]
@@ -980,9 +981,9 @@ func _zoom(delta: float) -> void:
func _apply_text_scale() -> void:
for label in clinical_labels:
var size := maxi(12, int(round(float(label.get_meta("ccs_base_font_size", 16)) * CCSService.text_scale)))
label.add_theme_font_size_override("normal_font_size", size)
label.add_theme_font_size_override("bold_font_size", size)
var font_size := maxi(12, int(round(float(label.get_meta("ccs_base_font_size", 16)) * CCSService.text_scale)))
label.add_theme_font_size_override("normal_font_size", font_size)
label.add_theme_font_size_override("bold_font_size", font_size)
func _report() -> void:
+1 -1
View File
@@ -99,7 +99,7 @@ func _field_label(text: String) -> Label:
return label
func open_for_question(question: Dictionary, current_answer: Dictionary) -> void:
func open_for_question(question: Dictionary, _current_answer: Dictionary) -> void:
var stem := str(question.get("stem", "")).strip_edges()
var lead_in := str(question.get("lead_in", "")).strip_edges()
front_input.text = "%s\n\n%s" % [stem, lead_in] if not lead_in.is_empty() else stem
+3 -3
View File
@@ -597,7 +597,7 @@ func _refresh_deck_panel() -> void:
if deck_ring == null:
return
var dark := UIThemeService.is_dark_mode()
var name := "All decks"
var deck_name := "All decks"
var total := 0
var mastered := 0
var is_system := false
@@ -609,12 +609,12 @@ func _refresh_deck_panel() -> void:
for summary in decks:
var deck: Dictionary = summary.get("deck", {})
if str(deck.get("id", "")) == deck_id:
name = str(deck.get("name", "Deck"))
deck_name = str(deck.get("name", "Deck"))
total = int(summary.get("total", 0))
mastered = int(summary.get("mastered", 0))
is_system = bool(deck.get("isSystem", false))
break
deck_name_label.text = name
deck_name_label.text = deck_name
deck_system_badge.visible = is_system
var fraction := float(mastered) / float(total) if total > 0 else 0.0
deck_ring.configure(fraction, "%d%%" % roundi(fraction * 100.0), "Mastery", Brand.ROYAL_BLUE, dark)