summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-02-01 13:25:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-02-01 13:25:23 +0100
commit0a9e6e478e3183d7bf3c5cb895c706bc6275d3ea (patch)
treef0aafb3a890737c99179bda69830ecae24774770
parentc461d3880fe6e0561dafd79054185e25d36a0e34 (diff)
parent435bf4e030f420c887898cd63d225e1c87447e25 (diff)
Merge pull request #71800 from akien-mga/ci-codespell-action
CI: Add official codespell action with PR annotations
-rw-r--r--.github/workflows/static_checks.yml8
-rw-r--r--core/config/project_settings.cpp4
-rw-r--r--core/math/quick_hull.cpp10
-rw-r--r--core/math/transform_2d.cpp8
-rw-r--r--core/object/worker_thread_pool.h4
-rw-r--r--doc/classes/OS.xml4
-rw-r--r--editor/filesystem_dock.cpp24
-rwxr-xr-xmisc/scripts/codespell.sh6
-rw-r--r--modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs18
-rw-r--r--platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java2
-rw-r--r--scene/2d/navigation_agent_2d.cpp2
-rw-r--r--scene/3d/navigation_agent_3d.cpp2
-rw-r--r--scene/main/node.cpp6
-rw-r--r--scene/resources/resource_format_text.cpp6
-rw-r--r--servers/rendering/renderer_rd/storage_rd/material_storage.h10
-rw-r--r--servers/rendering/shader_language.cpp8
-rw-r--r--tests/scene/test_text_edit.h14
17 files changed, 72 insertions, 64 deletions
diff --git a/.github/workflows/static_checks.yml b/.github/workflows/static_checks.yml
index d10156c04e..eece270dd9 100644
--- a/.github/workflows/static_checks.yml
+++ b/.github/workflows/static_checks.yml
@@ -71,3 +71,11 @@ jobs:
- name: Style checks via dotnet format (dotnet_format.sh)
run: |
bash ./misc/scripts/dotnet_format.sh
+
+ - name: Spell checks via codespell
+ uses: codespell-project/actions-codespell@v1
+ with:
+ skip: ./.*,./**/.*,./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json
+ check_hidden: false
+ ignore_words_list: curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te
+ only_warn: true
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 6a1d802453..39f8ad68e4 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -301,13 +301,13 @@ bool ProjectSettings::_set(const StringName &p_name, const Variant &p_value) {
for (int i = 1; i < s.size(); i++) {
String feature = s[i].strip_edges();
- Pair<StringName, StringName> fo(feature, p_name);
+ Pair<StringName, StringName> feature_override(feature, p_name);
if (!feature_overrides.has(s[0])) {
feature_overrides[s[0]] = LocalVector<Pair<StringName, StringName>>();
}
- feature_overrides[s[0]].push_back(fo);
+ feature_overrides[s[0]].push_back(feature_override);
}
}
}
diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp
index 9488c6bcff..4483f61bc4 100644
--- a/core/math/quick_hull.cpp
+++ b/core/math/quick_hull.cpp
@@ -383,15 +383,15 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry3D::MeshData &r_
if (O->get().plane.is_equal_approx(f.plane)) {
//merge and delete edge and contiguous face, while repointing edges (uuugh!)
- int ois = O->get().indices.size();
+ int o_index_size = O->get().indices.size();
- for (int j = 0; j < ois; j++) {
+ for (int j = 0; j < o_index_size; j++) {
//search a
if (O->get().indices[j] == a) {
//append the rest
- for (int k = 0; k < ois; k++) {
- int idx = O->get().indices[(k + j) % ois];
- int idxn = O->get().indices[(k + j + 1) % ois];
+ for (int k = 0; k < o_index_size; k++) {
+ int idx = O->get().indices[(k + j) % o_index_size];
+ int idxn = O->get().indices[(k + j + 1) % o_index_size];
if (idx == b && idxn == a) { //already have b!
break;
}
diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp
index 96010b4096..868665cb5c 100644
--- a/core/math/transform_2d.cpp
+++ b/core/math/transform_2d.cpp
@@ -151,7 +151,7 @@ void Transform2D::orthonormalize() {
Vector2 y = columns[1];
x.normalize();
- y = (y - x * (x.dot(y)));
+ y = y - x * x.dot(y);
y.normalize();
columns[0] = x;
@@ -159,9 +159,9 @@ void Transform2D::orthonormalize() {
}
Transform2D Transform2D::orthonormalized() const {
- Transform2D on = *this;
- on.orthonormalize();
- return on;
+ Transform2D ortho = *this;
+ ortho.orthonormalize();
+ return ortho;
}
bool Transform2D::is_equal_approx(const Transform2D &p_transform) const {
diff --git a/core/object/worker_thread_pool.h b/core/object/worker_thread_pool.h
index cf3f7f0885..c62e05fc28 100644
--- a/core/object/worker_thread_pool.h
+++ b/core/object/worker_thread_pool.h
@@ -173,8 +173,8 @@ public:
template <class C, class M, class U>
GroupID add_template_group_task(C *p_instance, M p_method, U p_userdata, int p_elements, int p_tasks = -1, bool p_high_priority = false, const String &p_description = String()) {
- typedef GroupUserData<C, M, U> GUD;
- GUD *ud = memnew(GUD);
+ typedef GroupUserData<C, M, U> GroupUD;
+ GroupUD *ud = memnew(GroupUD);
ud->instance = p_instance;
ud->method = p_method;
ud->userdata = p_userdata;
diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml
index 04895c28a8..ca090d596e 100644
--- a/doc/classes/OS.xml
+++ b/doc/classes/OS.xml
@@ -553,11 +553,11 @@
[b]Note:[/b] If the user has disabled the recycle bin on their system, the file will be permanently deleted instead.
[codeblocks]
[gdscript]
- var file_to_remove = "user://slot1.sav"
+ var file_to_remove = "user://slot1.save"
OS.move_to_trash(ProjectSettings.globalize_path(file_to_remove))
[/gdscript]
[csharp]
- var fileToRemove = "user://slot1.sav";
+ var fileToRemove = "user://slot1.save";
OS.MoveToTrash(ProjectSettings.GlobalizePath(fileToRemove));
[/csharp]
[/codeblocks]
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 92e3631015..cf3504fcc1 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -241,8 +241,8 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
}
for (int i = 0; i < favorite_paths.size(); i++) {
- String fave = favorite_paths[i];
- if (!fave.begins_with("res://")) {
+ String favorite = favorite_paths[i];
+ if (!favorite.begins_with("res://")) {
continue;
}
@@ -252,18 +252,18 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
String text;
Ref<Texture2D> icon;
Color color;
- if (fave == "res://") {
+ if (favorite == "res://") {
text = "/";
icon = folder_icon;
color = folder_color;
- } else if (fave.ends_with("/")) {
- text = fave.substr(0, fave.length() - 1).get_file();
+ } else if (favorite.ends_with("/")) {
+ text = favorite.substr(0, favorite.length() - 1).get_file();
icon = folder_icon;
color = folder_color;
} else {
- text = fave.get_file();
+ text = favorite.get_file();
int index;
- EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->find_file(fave, &index);
+ EditorFileSystemDirectory *dir = EditorFileSystem::get_singleton()->find_file(favorite, &index);
if (dir) {
icon = _get_tree_item_icon(dir->get_file_import_is_valid(index), dir->get_file_type(index));
} else {
@@ -277,18 +277,18 @@ void FileSystemDock::_update_tree(const Vector<String> &p_uncollapsed_paths, boo
ti->set_text(0, text);
ti->set_icon(0, icon);
ti->set_icon_modulate(0, color);
- ti->set_tooltip_text(0, fave);
+ ti->set_tooltip_text(0, favorite);
ti->set_selectable(0, true);
- ti->set_metadata(0, fave);
- if (p_select_in_favorites && fave == path) {
+ ti->set_metadata(0, favorite);
+ if (p_select_in_favorites && favorite == path) {
ti->select(0);
ti->set_as_cursor(0);
}
- if (!fave.ends_with("/")) {
+ if (!favorite.ends_with("/")) {
Array udata;
udata.push_back(tree_update_id);
udata.push_back(ti);
- EditorResourcePreview::get_singleton()->queue_resource_preview(fave, this, "_tree_thumbnail_done", udata);
+ EditorResourcePreview::get_singleton()->queue_resource_preview(favorite, this, "_tree_thumbnail_done", udata);
}
}
}
diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh
index 0551492420..1268350180 100755
--- a/misc/scripts/codespell.sh
+++ b/misc/scripts/codespell.sh
@@ -1,8 +1,8 @@
#!/bin/sh
-SKIP_LIST="./.*,./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,"
-SKIP_LIST+="./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,"
+SKIP_LIST="./.*,./**/.*,./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./AUTHORS.md,./COPYRIGHT.txt,./DONORS.md,"
+SKIP_LIST+="./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/project_converter_3_to_4.cpp,./misc/scripts/codespell.sh,"
SKIP_LIST+="./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json,"
-IGNORE_LIST="alo,ba,complies,curvelinear,doubleclick,expct,fave,findn,gird,gud,inout,lod,nd,numer,ois,readded,ro,sav,statics,te,varius,varn,wan"
+IGNORE_LIST="curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,nd,numer,ot,te"
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}" --builtin "clear,rare,en-GB_to_en-US"
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
index 5283dc7ec6..d7392dbda8 100644
--- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
+++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Transform2D.cs
@@ -247,19 +247,19 @@ namespace Godot
/// <returns>The orthonormalized transform.</returns>
public readonly Transform2D Orthonormalized()
{
- Transform2D on = this;
+ Transform2D ortho = this;
- Vector2 onX = on.X;
- Vector2 onY = on.Y;
+ Vector2 orthoX = ortho.X;
+ Vector2 orthoY = ortho.Y;
- onX.Normalize();
- onY = onY - (onX * onX.Dot(onY));
- onY.Normalize();
+ orthoX.Normalize();
+ orthoY = orthoY - orthoX * orthoX.Dot(orthoY);
+ orthoY.Normalize();
- on.X = onX;
- on.Y = onY;
+ ortho.X = orthoX;
+ ortho.Y = orthoY;
- return on;
+ return ortho;
}
/// <summary>
diff --git a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
index 65032d6a68..677c9d8f13 100644
--- a/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
+++ b/platform/android/java/lib/src/org/godotengine/godot/FullScreenGodotApp.java
@@ -99,7 +99,7 @@ public abstract class FullScreenGodotApp extends FragmentActivity implements God
// from scratch. Therefore, we need to kill the whole app process and relaunch it.
//
// Restarting only the activity, wouldn't be enough unless it did proper cleanup (including
- // releasing and reloading native libs or resetting their state somehow and clearing statics).
+ // releasing and reloading native libs or resetting their state somehow and clearing static data).
Log.v(TAG, "Restarting Godot instance...");
ProcessPhoenix.triggerRebirth(FullScreenGodotApp.this);
}
diff --git a/scene/2d/navigation_agent_2d.cpp b/scene/2d/navigation_agent_2d.cpp
index 380a684c9b..ed6f3b8020 100644
--- a/scene/2d/navigation_agent_2d.cpp
+++ b/scene/2d/navigation_agent_2d.cpp
@@ -140,7 +140,7 @@ void NavigationAgent2D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_POST_ENTER_TREE: {
// need to use POST_ENTER_TREE cause with normal ENTER_TREE not all required Nodes are ready.
- // cannot use READY as ready does not get called if Node is readded to SceneTree
+ // cannot use READY as ready does not get called if Node is re-added to SceneTree
set_agent_parent(get_parent());
set_physics_process_internal(true);
diff --git a/scene/3d/navigation_agent_3d.cpp b/scene/3d/navigation_agent_3d.cpp
index 5db8611d72..1ffabbb6da 100644
--- a/scene/3d/navigation_agent_3d.cpp
+++ b/scene/3d/navigation_agent_3d.cpp
@@ -143,7 +143,7 @@ void NavigationAgent3D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_POST_ENTER_TREE: {
// need to use POST_ENTER_TREE cause with normal ENTER_TREE not all required Nodes are ready.
- // cannot use READY as ready does not get called if Node is readded to SceneTree
+ // cannot use READY as ready does not get called if Node is re-added to SceneTree
set_agent_parent(get_parent());
set_physics_process_internal(true);
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index ba75c92c85..52c1df8110 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2135,13 +2135,13 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c
} else if ((p_flags & DUPLICATE_USE_INSTANTIATION) && !get_scene_file_path().is_empty()) {
Ref<PackedScene> res = ResourceLoader::load(get_scene_file_path());
ERR_FAIL_COND_V(res.is_null(), nullptr);
- PackedScene::GenEditState ges = PackedScene::GEN_EDIT_STATE_DISABLED;
+ PackedScene::GenEditState edit_state = PackedScene::GEN_EDIT_STATE_DISABLED;
#ifdef TOOLS_ENABLED
if (p_flags & DUPLICATE_FROM_EDITOR) {
- ges = PackedScene::GEN_EDIT_STATE_INSTANCE;
+ edit_state = PackedScene::GEN_EDIT_STATE_INSTANCE;
}
#endif
- node = res->instantiate(ges);
+ node = res->instantiate(edit_state);
ERR_FAIL_COND_V(!node, nullptr);
node->set_scene_instance_load_placeholder(get_scene_instance_load_placeholder());
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 608d15019e..3006da5309 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -2379,15 +2379,15 @@ Error ResourceFormatSaverText::set_uid(const String &p_path, ResourceUID::ID p_u
String local_path = ProjectSettings::get_singleton()->localize_path(p_path);
Error err = OK;
{
- Ref<FileAccess> fo = FileAccess::open(p_path, FileAccess::READ);
- if (fo.is_null()) {
+ Ref<FileAccess> file = FileAccess::open(p_path, FileAccess::READ);
+ if (file.is_null()) {
ERR_FAIL_V(ERR_CANT_OPEN);
}
ResourceLoaderText loader;
loader.local_path = local_path;
loader.res_path = loader.local_path;
- err = loader.set_uid(fo, p_uid);
+ err = loader.set_uid(file, p_uid);
}
if (err == OK) {
diff --git a/servers/rendering/renderer_rd/storage_rd/material_storage.h b/servers/rendering/renderer_rd/storage_rd/material_storage.h
index 0ac5557659..ac217d9a49 100644
--- a/servers/rendering/renderer_rd/storage_rd/material_storage.h
+++ b/servers/rendering/renderer_rd/storage_rd/material_storage.h
@@ -323,13 +323,13 @@ public:
// http://andrewthall.org/papers/df64_qf128.pdf
#ifdef REAL_T_IS_DOUBLE
- static _FORCE_INLINE_ void split_double(double a, float *ahi, float *alo) {
+ static _FORCE_INLINE_ void split_double(double a, float *a_hi, float *a_lo) {
const double SPLITTER = (1 << 29) + 1;
double t = a * SPLITTER;
- double thi = t - (t - a);
- double tlo = a - thi;
- *ahi = (float)thi;
- *alo = (float)tlo;
+ double t_hi = t - (t - a);
+ double t_lo = a - t_hi;
+ *a_hi = (float)t_hi;
+ *a_lo = (float)t_lo;
}
#endif
diff --git a/servers/rendering/shader_language.cpp b/servers/rendering/shader_language.cpp
index 11a9303f11..44c4ad6e56 100644
--- a/servers/rendering/shader_language.cpp
+++ b/servers/rendering/shader_language.cpp
@@ -4530,14 +4530,14 @@ bool ShaderLanguage::_check_node_constness(const Node *p_node) const {
case Node::TYPE_CONSTANT:
break;
case Node::TYPE_VARIABLE: {
- const VariableNode *varn = static_cast<const VariableNode *>(p_node);
- if (!varn->is_const) {
+ const VariableNode *var_node = static_cast<const VariableNode *>(p_node);
+ if (!var_node->is_const) {
return false;
}
} break;
case Node::TYPE_ARRAY: {
- const ArrayNode *arrn = static_cast<const ArrayNode *>(p_node);
- if (!arrn->is_const) {
+ const ArrayNode *arr_node = static_cast<const ArrayNode *>(p_node);
+ if (!arr_node->is_const) {
return false;
}
} break;
diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h
index f2663b037d..77312a8604 100644
--- a/tests/scene/test_text_edit.h
+++ b/tests/scene/test_text_edit.h
@@ -3086,7 +3086,7 @@ TEST_CASE("[SceneTree][TextEdit] context menu") {
text_edit->get_viewport()->set_embedding_subwindows(true); // Bypass display server for drop handling.
text_edit->set_size(Size2(800, 200));
- text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
MessageQueue::get_singleton()->flush();
text_edit->set_context_menu_enabled(false);
@@ -3227,7 +3227,7 @@ TEST_CASE("[SceneTree][TextEdit] mouse") {
SceneTree::get_singleton()->get_root()->add_child(text_edit);
text_edit->set_size(Size2(800, 200));
- text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
MessageQueue::get_singleton()->flush();
CHECK(text_edit->get_word_at_pos(text_edit->get_pos_at_line_column(0, 1)) == "Lorem");
@@ -3305,9 +3305,9 @@ TEST_CASE("[SceneTree][TextEdit] caret") {
SEND_GUI_ACTION(text_edit, "ui_text_caret_left");
CHECK(text_edit->get_caret_column() == 0);
- text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
for (int i = 0; i < 3; i++) {
- text_edit->insert_line_at(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->insert_line_at(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
}
MessageQueue::get_singleton()->flush();
@@ -3519,7 +3519,7 @@ TEST_CASE("[SceneTree][TextEdit] line wrapping") {
// Set size for boundary.
text_edit->set_size(Size2(800, 200));
- text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->set_line(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
CHECK_FALSE(text_edit->is_line_wrapped(0));
CHECK(text_edit->get_line_wrap_count(0) == 0);
CHECK(text_edit->get_line_wrap_index_at_column(0, 130) == 0);
@@ -3569,7 +3569,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") {
// No subcases here for performance.
text_edit->set_size(Size2(800, 600));
for (int i = 0; i < 50; i++) {
- text_edit->insert_line_at(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec varius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
+ text_edit->insert_line_at(0, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vasius mattis leo, sed porta ex lacinia bibendum. Nunc bibendum pellentesque.");
}
MessageQueue::get_singleton()->flush();
@@ -3897,7 +3897,7 @@ TEST_CASE("[SceneTree][TextEdit] viewport") {
CHECK(text_edit->get_h_scroll() == 0);
text_edit->set_h_scroll(10000000);
- CHECK(text_edit->get_h_scroll() == 313);
+ CHECK(text_edit->get_h_scroll() == 314);
text_edit->set_h_scroll(-100);
CHECK(text_edit->get_h_scroll() == 0);