Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor plugin.gd for improved readability and maintainability #2012

Merged
merged 3 commits into from
Jan 20, 2024
Merged

Refactor plugin.gd for improved readability and maintainability #2012

merged 3 commits into from
Jan 20, 2024

Conversation

Miisan-png
Copy link
Contributor

This commit includes several changes to improve the readability and maintainability of the plugin.gd file:

  1. More descriptive comments have been added to provide better context for the code.
  2. Repeated code checking the existence of editor_view and editor_view.editors_manager has been moved into a helper function _editor_view_and_manager_exist().
  3. String literals that were used multiple times in the code have been replaced with constants to avoid magic strings and make future changes easier.

This commit includes several changes to improve the readability and maintainability of the plugin.gd file:

1. More descriptive comments have been added to provide better context for the code.
2. Repeated code checking the existence of `editor_view` and `editor_view.editors_manager` has been moved into a helper function `_editor_view_and_manager_exist()`.
3. String literals that were used multiple times in the code have been replaced with constants to avoid magic strings and make future changes easier.
@Jowan-Spooner
Copy link
Member

Jowan-Spooner commented Jan 10, 2024

Thanks. I like the majority of these changes.

But:

  • Documentation strings should start with ##

  • Methods should be separated with two empty lines

  • I would keep the sections, although they should be replaced with the new code regions. This is a personal preference, but I like to visualy indicate code that belongs together, I find it easier for navigation especially in long files.

  • You seem to be using spaces instead of tabs. This is not a big deal, but a bit annoying, as we've used tabs across the whole project.

Edit: Additionally

  • I would prefer to keep the short description at the top of the file. We've added those on many files to make it easier for new-comers scanning the plugins to understand the purpose of each file.

@Jowan-Spooner
Copy link
Member

Btw, if you intend to do more PR's, feel free to join emilios discord where most of the developement discussion happens.

Updated the requested changes
@Miisan-png
Copy link
Contributor Author

Thanks, sure i will do that.

- adds code regions
- uses tabs
- makes a few things statically typed
- simplifies some methods
@Jowan-Spooner Jowan-Spooner merged commit d38ec68 into dialogic-godot:main Jan 20, 2024
1 check passed
Invertex pushed a commit to Invertex/dialogic that referenced this pull request Jan 26, 2024
…ogic-godot#2012)

* Refactor plugin.gd for improved readability and maintainability

This commit includes several changes to improve the readability and maintainability of the plugin.gd file:

1. More descriptive comments have been added to provide better context for the code.
2. Repeated code checking the existence of `editor_view` and `editor_view.editors_manager` has been moved into a helper function `_editor_view_and_manager_exist()`.
3. String literals that were used multiple times in the code have been replaced with constants to avoid magic strings and make future changes easier.

* Update plugin.gd

Updated the requested changes

* Make some style changes

- adds code regions
- uses tabs
- makes a few things statically typed
- simplifies some methods

---------

Co-authored-by: Jowan-Spooner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants