1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-20 14:45:44 +00:00

GDScript: Add debug/gdscript/warnings/directory_rules project setting

This commit is contained in:
Danil Alexeev
2025-11-01 16:08:07 +03:00
parent 8327dfa215
commit 1bd7b99182
10 changed files with 222 additions and 96 deletions

View File

@@ -145,6 +145,7 @@ GDScriptTestRunner::GDScriptTestRunner(const String &p_source_dir, bool p_init_l
if (do_init_languages) {
init_language(p_source_dir);
}
#ifdef DEBUG_ENABLED
// Set all warning levels to "Warn" in order to test them properly, even the ones that default to error.
ProjectSettings::get_singleton()->set_setting("debug/gdscript/warnings/enable", true);
@@ -153,12 +154,16 @@ GDScriptTestRunner::GDScriptTestRunner(const String &p_source_dir, bool p_init_l
// TODO: Add ability for test scripts to specify which warnings to enable/disable for testing.
continue;
}
String warning_setting = GDScriptWarning::get_settings_path_from_code((GDScriptWarning::Code)i);
ProjectSettings::get_singleton()->set_setting(warning_setting, (int)GDScriptWarning::WARN);
const String setting_path = GDScriptWarning::get_setting_path_from_code((GDScriptWarning::Code)i);
ProjectSettings::get_singleton()->set_setting(setting_path, (int)GDScriptWarning::WARN);
}
#endif
// Enable printing to show results
// Force the call, since the language is initialized **before** applying project settings
// and the `settings_changed` signal is emitted with `call_deferred()`.
GDScriptParser::update_project_settings();
#endif // DEBUG_ENABLED
// Enable printing to show results.
CoreGlobals::print_line_enabled = true;
CoreGlobals::print_error_enabled = true;
}