mirror of
https://github.com/godotengine/godot.git
synced 2025-10-31 21:51:22 +00:00
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
parent
07bc4e2f96
commit
0ee0fa42e6
683 changed files with 22803 additions and 12225 deletions
|
|
@ -217,13 +217,15 @@ void ShaderTextEditor::_validate_script() {
|
|||
String error_text = "error(" + itos(sl.get_error_line()) + "): " + sl.get_error_text();
|
||||
set_error(error_text);
|
||||
set_error_pos(sl.get_error_line() - 1, 0);
|
||||
for (int i = 0; i < get_text_edit()->get_line_count(); i++)
|
||||
for (int i = 0; i < get_text_edit()->get_line_count(); i++) {
|
||||
get_text_edit()->set_line_as_marked(i, false);
|
||||
}
|
||||
get_text_edit()->set_line_as_marked(sl.get_error_line() - 1, true);
|
||||
|
||||
} else {
|
||||
for (int i = 0; i < get_text_edit()->get_line_count(); i++)
|
||||
for (int i = 0; i < get_text_edit()->get_line_count(); i++) {
|
||||
get_text_edit()->set_line_as_marked(i, false);
|
||||
}
|
||||
set_error("");
|
||||
}
|
||||
|
||||
|
|
@ -265,16 +267,18 @@ void ShaderEditor::_menu_option(int p_option) {
|
|||
shader_editor->move_lines_down();
|
||||
} break;
|
||||
case EDIT_INDENT_LEFT: {
|
||||
if (shader.is_null())
|
||||
if (shader.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextEdit *tx = shader_editor->get_text_edit();
|
||||
tx->indent_left();
|
||||
|
||||
} break;
|
||||
case EDIT_INDENT_RIGHT: {
|
||||
if (shader.is_null())
|
||||
if (shader.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TextEdit *tx = shader_editor->get_text_edit();
|
||||
tx->indent_right();
|
||||
|
|
@ -287,8 +291,9 @@ void ShaderEditor::_menu_option(int p_option) {
|
|||
shader_editor->clone_lines_down();
|
||||
} break;
|
||||
case EDIT_TOGGLE_COMMENT: {
|
||||
if (shader.is_null())
|
||||
if (shader.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
shader_editor->toggle_inline_comment("//");
|
||||
|
||||
|
|
@ -418,11 +423,13 @@ void ShaderEditor::_reload_shader_from_disk() {
|
|||
}
|
||||
|
||||
void ShaderEditor::edit(const Ref<Shader> &p_shader) {
|
||||
if (p_shader.is_null() || !p_shader->is_text_shader())
|
||||
if (p_shader.is_null() || !p_shader->is_text_shader()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (shader == p_shader)
|
||||
if (shader == p_shader) {
|
||||
return;
|
||||
}
|
||||
|
||||
shader = p_shader;
|
||||
|
||||
|
|
@ -687,8 +694,9 @@ void ShaderEditorPlugin::make_visible(bool p_visible) {
|
|||
|
||||
} else {
|
||||
button->hide();
|
||||
if (shader_editor->is_visible_in_tree())
|
||||
if (shader_editor->is_visible_in_tree()) {
|
||||
editor->hide_bottom_panel();
|
||||
}
|
||||
shader_editor->apply_shaders();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue