C++ Format Style for EmulationStation?
-
I have been reading the ES code (C++) for a while and I noticed there are different coding styles present:
- Most of the time hard tabs are used
- The block opening bracket
{
is sometimes on the same line, sometimes on the next line, - Line length seems to have no limit
- A space between
if
/for
and opening bracket(
is present or missing - Single line blocks after
if
/for
have often no brackets{}
(IMHO dangerous) - ...
So I am asking if the maintainers can provide some coding styles (C++ clang, aso.)? Also I am asking for a ruleset and tool (
clang
,uncrustify
,astyle
, younameit) any contributor can apply before sending in a PR.I don't mind how the final format will be, but there should only be one. Personally I have a strong bias towards soft tabs, but I have no problem to play by the rules, once they are set.
Thoughts?
-
@Lolonois unfortunately what you are looking for doesn't exist. My understanding is that only real guideline we have is to conform to the style around the edits you are making. I believe that this was largely based on the idea that if Aloshi ever restarted development it would make it easier to keep in sync. There has been some discussion about making the code style more consistent, but I guess it hasn't been that much of an issue for anyone to actually take the time to fix it.
-
Thanks for the reply. Not the expected answer, but at least some clarification on the status quo.
Works for me. I will pay respect to what is found as formatting in a file (and not procject atm) and will format my edits accordingly.
And also pledge to other PR issuers to do the same (if they haven't done so in the past).
However, if the maintainers ( @herb_fargus , @petrockblog @psyke83 @BuZz ... ) have a informal list of format styles ready (or want to discuss/collect them here) I am more than willing to transform them in a formal formatter config with a formatting tool is easily available for the Linux and Windows platform.
Cheers,
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.