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

Apply Rebel coding style #19

Merged
merged 10 commits into from
Nov 30, 2023
Merged

Conversation

madmiraal
Copy link
Contributor

A good coding style makes the code easier to read and troubleshoot. This PR defines and applies the Rebel coding style.

clang-format is used to standardise the coding style used. Although it does an amazing job, it is not bug-free, and sometimes clang-format does not apply the coding style as expected. Many of these issues can be resolved by modifying (simplifying!) the code, but not always. /* clang-format off */ can be used to disable clang-format in a particular section of code, but it should be used sparingly. It should not be used to "fix" a bug in clang-format, because, when the bug is fixed, it will continue to disable clang-format. If the unexpected application of the coding style cannot be fixed by modifying the code, but it is tolerable, it is better not to use /* clang-format off */.

This PR splits the application of the Rebel coding style into multiple commits. This makes it easier to see the changes that clang-format has made. This is especially relevant when the application of a clang-format rule has made some noticeably unexpected changes.

The application of the Rebel coding style revealed some hidden bugs. These have also been addressed.

- Move class_db.h dependency in object.h to the top of the header.
- Remove object.h dependency in class_db.h.
- Remove object.h dependency in method_bind.h.
- Move PropertyInfo and MethodInfo declarations to type_info.h.
- Move Object variant enum cast to object.cpp
- Add missing dependencies:
  - Add hash_map.h dependency to class_db.h
  - Add color.h dependency to color_names.inc
@madmiraal madmiraal self-assigned this Nov 29, 2023
Copy link
Contributor

@DanielaOrtner DanielaOrtner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good :)

@DanielaOrtner
Copy link
Contributor

Thank you!

@DanielaOrtner DanielaOrtner merged commit 870aeb0 into RebelToolbox:main Nov 30, 2023
13 checks passed
@madmiraal madmiraal deleted the update-styles branch December 2, 2023 07:38
@madmiraal madmiraal added the PR Type: Enhancement Your current game will work better. label May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR Type: Enhancement Your current game will work better.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants