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:
Rémi Verschelde 2021-05-05 12:44:11 +02:00
parent b8d198eeed
commit 140350d767
No known key found for this signature in database
GPG key ID: C3336907360768E1
694 changed files with 23283 additions and 12499 deletions

View file

@ -58,8 +58,9 @@ void VisualScriptPropertySelector::_sbox_input(const Ref<InputEvent> &p_ie) {
search_box->accept_event();
TreeItem *root = search_options->get_root();
if (!root->get_children())
if (!root->get_children()) {
break;
}
TreeItem *current = search_options->get_selected();
@ -148,11 +149,13 @@ void VisualScriptPropertySelector::_update_search() {
}
}
for (List<PropertyInfo>::Element *F = props.front(); F; F = F->next()) {
if (!(F->get().usage & PROPERTY_USAGE_EDITOR) && !(F->get().usage & PROPERTY_USAGE_SCRIPT_VARIABLE))
if (!(F->get().usage & PROPERTY_USAGE_EDITOR) && !(F->get().usage & PROPERTY_USAGE_SCRIPT_VARIABLE)) {
continue;
}
if (type_filter.size() && type_filter.find(F->get().type) == -1)
if (type_filter.size() && type_filter.find(F->get().type) == -1) {
continue;
}
// capitalize() also converts underscore to space, we'll match again both possible styles
String get_text_raw = String(vformat(TTR("Get %s"), F->get().name));
@ -204,14 +207,17 @@ void VisualScriptPropertySelector::_update_search() {
}
for (List<MethodInfo>::Element *M = methods.front(); M; M = M->next()) {
String name = M->get().name.get_slice(":", 0);
if (name.begins_with("_") && !(M->get().flags & METHOD_FLAG_VIRTUAL))
if (name.begins_with("_") && !(M->get().flags & METHOD_FLAG_VIRTUAL)) {
continue;
}
if (virtuals_only && !(M->get().flags & METHOD_FLAG_VIRTUAL))
if (virtuals_only && !(M->get().flags & METHOD_FLAG_VIRTUAL)) {
continue;
}
if (!virtuals_only && (M->get().flags & METHOD_FLAG_VIRTUAL))
if (!virtuals_only && (M->get().flags & METHOD_FLAG_VIRTUAL)) {
continue;
}
MethodInfo mi = M->get();
String desc_arguments;
@ -351,8 +357,9 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt
bool in_modifier = p_modifiers.empty();
for (Set<String>::Element *F = p_modifiers.front(); F && in_modifier; F = F->next()) {
if (E->get().findn(F->get()) != -1)
if (E->get().findn(F->get()) != -1) {
in_modifier = true;
}
}
if (!in_modifier) {
continue;
@ -404,8 +411,9 @@ void VisualScriptPropertySelector::get_visual_node_names(const String &root_filt
void VisualScriptPropertySelector::_confirmed() {
TreeItem *ti = search_options->get_selected();
if (!ti)
if (!ti) {
return;
}
emit_signal("selected", ti->get_metadata(0), ti->get_metadata(1), ti->get_metadata(2));
hide();
}
@ -414,8 +422,9 @@ void VisualScriptPropertySelector::_item_selected() {
help_bit->set_text("");
TreeItem *item = search_options->get_selected();
if (!item)
if (!item) {
return;
}
String name = item->get_metadata(0);
String class_type;
@ -500,8 +509,9 @@ void VisualScriptPropertySelector::_item_selected() {
memdelete(names);
if (text == String())
if (text == String()) {
return;
}
help_bit->set_text(text);
}
@ -522,10 +532,11 @@ void VisualScriptPropertySelector::select_method_from_base_type(const String &p_
virtuals_only = p_virtuals_only;
show_window(.5f);
if (clear_text)
if (clear_text) {
search_box->set_text("");
else
} else {
search_box->select_all();
}
search_box->grab_focus();
connecting = p_connecting;
@ -547,10 +558,11 @@ void VisualScriptPropertySelector::select_from_base_type(const String &p_base, c
virtuals_only = p_virtuals_only;
show_window(.5f);
if (clear_text)
if (clear_text) {
search_box->set_text("");
else
} else {
search_box->select_all();
}
search_box->grab_focus();
seq_connect = p_seq_connect;
connecting = p_connecting;
@ -571,10 +583,11 @@ void VisualScriptPropertySelector::select_from_script(const Ref<Script> &p_scrip
virtuals_only = false;
show_window(.5f);
if (clear_text)
if (clear_text) {
search_box->set_text("");
else
} else {
search_box->select_all();
}
search_box->grab_focus();
seq_connect = false;
connecting = p_connecting;
@ -594,10 +607,11 @@ void VisualScriptPropertySelector::select_from_basic_type(Variant::Type p_type,
virtuals_only = false;
show_window(.5f);
if (clear_text)
if (clear_text) {
search_box->set_text("");
else
} else {
search_box->select_all();
}
search_box->grab_focus();
seq_connect = false;
connecting = p_connecting;
@ -616,10 +630,11 @@ void VisualScriptPropertySelector::select_from_action(const String &p_type, cons
virtuals_only = false;
show_window(.5f);
if (clear_text)
if (clear_text) {
search_box->set_text("");
else
} else {
search_box->select_all();
}
search_box->grab_focus();
seq_connect = true;
connecting = p_connecting;
@ -638,10 +653,11 @@ void VisualScriptPropertySelector::select_from_instance(Object *p_instance, cons
virtuals_only = false;
show_window(.5f);
if (clear_text)
if (clear_text) {
search_box->set_text("");
else
} else {
search_box->select_all();
}
search_box->grab_focus();
seq_connect = false;
connecting = p_connecting;
@ -659,10 +675,11 @@ void VisualScriptPropertySelector::select_from_visual_script(const String &p_bas
instance = nullptr;
virtuals_only = false;
show_window(.5f);
if (clear_text)
if (clear_text) {
search_box->set_text("");
else
} else {
search_box->select_all();
}
search_box->grab_focus();
connecting = p_connecting;