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

📐 Reformated code #52

Closed
wants to merge 1 commit into from
Closed

Conversation

AnotherFoxGuy
Copy link
Member

Used the ben2.cfg from uncrustify

Fixes #50

Copy link
Member

@ohlidalp ohlidalp left a comment

Choose a reason for hiding this comment

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

Nice work, the reformatting really helps.

However, I have one major issue with the formatting - { placement and member indentation of class.

};
typedef std::vector<callback_t> callbackList;
typedef std::vector<callback_t> callbackList;

class ScriptEngine {
Copy link
Member

Choose a reason for hiding this comment

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

{ placement of class should be consistent with struct, and I like it placed on the next line.

* @return true if the callback exists
*/
bool callbackExists(const std::string &type, asIScriptFunction *func, asIScriptObject *obj);
ScriptEngine(Sequencer *seq);
Copy link
Member

Choose a reason for hiding this comment

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

Class members absolutely must be indented (I don't even remember seeing it unindented anywhere). It should also be consistent with struct which is indented here.

};

BEGIN_EVENT_TABLE(MyDialog, wxDialog
)
)
Copy link
Member

Choose a reason for hiding this comment

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

Please hand-edit this and put the closing brackets on the same line as the macro 😄

@@ -20,15 +20,15 @@
#include "wx/dcclient.h"

IMPLEMENT_DYNAMIC_CLASS(wxStaticPicture, wxControl
)
const wxChar *wxStaticPictureNameStr = wxT("staticPicture");
)
Copy link
Member

Choose a reason for hiding this comment

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

ditto; please hand-edit and put the () on single line.


/*
* wxStaticPicture
*/

BEGIN_EVENT_TABLE(wxStaticPicture, wxControl
)
)
Copy link
Member

Choose a reason for hiding this comment

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

ditto; please hand-edit and put the () on single line.

// necessary to register your own string type if you don't want to.
RegisterStdString(engine);
RegisterScriptArray(engine,
true); // true = allow arrays to be registered as type[] (e.g. int[]). Needed for backwards compatibillity.
Copy link
Member

Choose a reason for hiding this comment

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

This call was probably line-broken because of the long comment.
If you wouldn't mind the comment spanning far to the right (I wouldn't), just remove the linebreak please.
Otherwise, rewrite like this:

const bool allow_cstyle_array_syntax = true; // e.g. int[]; Needed for backwards compatibility
RegisterScriptArray(engine, allow_cstyle_array_syntax);

* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
Copy link
Member

@ohlidalp ohlidalp May 7, 2018

Choose a reason for hiding this comment

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

Please substitute Foobar with Rigs of Rods Server everywhere 🤣

#define VAL_BOOL(_STR_)(RudeStrToBool(value))

void ProcessConfigEntry(const char *key, const char *value) {
if (strcmp(key, "baseconfig") == 0) { LoadConfigFile(VAL_STR (value)); }
Copy link
Member

Choose a reason for hiding this comment

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

If possible, I'd prefer this if-elseif... cascade to be excluded from the auto-formatting and left as-is, perhaps just aligned to columns.

@AnotherFoxGuy
Copy link
Member Author

@only-a-ptr everything should be fixed now.

@ohlidalp
Copy link
Member

Something I missed the last time: indentation depth of 3 = 🤢. Keep 4 please.
Also, the block comments of class members are now displaced (unindented) from the members they document.

@ohlidalp
Copy link
Member

@AnotherFoxGuy Sorry for letting this rot... please reset it to current upstream and re-run the formatting.

@AnotherFoxGuy
Copy link
Member Author

I will replace this with clang-format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code formatting
2 participants