Skip to content

Subset of clang-format changes.#965

Merged
ahmedcharles merged 2 commits intoMudlet:developmentfrom
ahmedcharles:formatting
Apr 27, 2017
Merged

Subset of clang-format changes.#965
ahmedcharles merged 2 commits intoMudlet:developmentfrom
ahmedcharles:formatting

Conversation

@ahmedcharles
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Member

@SlySven SlySven left a comment

Choose a reason for hiding this comment

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

I had "gone off the boil" before I got to the end there... so if there are any other issues then they slip by this time. OTOH If there are any issues then because this is just formatting they are not going to be made better or worse by this PR anyhow! 😀

mInsertedMissingLF = true;
if( (cmd == "") && ( mUSE_IRE_DRIVER_BUGFIX ) && ( ! mUSE_FORCE_LF_AFTER_PROMPT ) )
{
if ((cmd == "") && (mUSE_IRE_DRIVER_BUGFIX) && (!mUSE_FORCE_LF_AFTER_PROMPT)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd prefer cmd.isEmpty() to avoid a raw string literal. 😁

sendRaw( "\n" );//NOTE: damit leerprompt moeglich sind
QStringList commandList = cmd.split(QString(mCommandSeparator), QString::SkipEmptyParts);
if (!dontExpandAliases) {
if (commandList.size() == 0) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

commandList.isEmpty() is more human readable than commandList.size() == 0 IMVHO...

continue;
}
QString command = commandList[i];
command.replace("\n", "");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Isn't this the same as command.remove("\n") - or even better command.remove(QChar::LineFeed)?

}
QString command = commandList[i];
command.replace("\n", "");
mReplacementCommand = "";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As (void) Host::setReplacementCommand(const QString &) is not used, Host::replacementCommand never gets set to anything - so the fact that this clears it and dontExpandAliases is never set I think there is some cruft to clear out in this region.

}

void Host::raiseEvent( const TEvent & pE )
void Host::raiseEvent(const TEvent& pE)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I thought I had been through and replaced pE with event as this is NOT a pointer (any more?) 😖

Ah, turns out that was #934 which I've had to hold to split clean up - so will need to cherry-pick and base on code post this one anyhow...!

{
qDebug()<<"CRITICAL ERROR: SHOULD NOT HAPPEN->pcre_info() got wrong num of cap groups ovector only has room for %d captured substrings\n";
if (rc == 0) {
qDebug() << "CRITICAL ERROR: SHOULD NOT HAPPEN->pcre_info() got wrong num of cap groups ovector only has room for %d captured substrings\n";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🪲 same bug as above - but this time I think the constant is 30 (see the pcre_exec(...) call).

@@ -183,75 +171,75 @@ void TArea::determineAreaExitsOfRoom( int id )
// The second term in the ifs below looks for exit room id in TArea
// instance's own list of rooms which will fail (with a -1 if it is NOT in
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oops 😊 - I think I forgot to update the comment when I moved to a QSet<int> TArea::rooms data structure - the reference to a -1 result is no longer relevant!


quotationFormat.setForeground( Qt::darkGreen );
rule.pattern = QRegExp( "\"[^\"]*\"" );
quotationFormat.setForeground(Qt::darkGreen);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤔 That reminds me, quotation formatting breaks for escaped quotes in the Lua Script editor, i.e. a literal \" is actually treated like a plain " when one wants to embed " in a string to display to the user...

: QDialog( pF )
, mpTrigger( pT )
, mMode( mode )
dlgColorTrigger::dlgColorTrigger(QWidget* pF, TTrigger* pT, int mode) : QDialog(pF), mpTrigger(pT), mMode(mode)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry to pick at something that must be getting a bit scabbed by now but didn't we find a way/want to have the initialisations one per line?

@@ -404,16 +387,15 @@ void dlgColorTrigger::setColorLightMagenta()

void dlgColorTrigger::setColorWhite()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🤔 IIRC if we could set up a QSignalMappper we could considerably cut down on the "copy and modify" blocks of largely repetitive code here.

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Apr 26, 2017

I am not sure why are you doing a full review of code for a PR that is just about changing the formatting of it... I mean the comments given aren't in scope of the PR and unless someone goes through and addresses them, they'll be lost?

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Apr 26, 2017

They're very good comments, but addressing them would not be in scope of this PR, so what do we do with them?

@SlySven
Copy link
Copy Markdown
Member

SlySven commented Apr 26, 2017

*thinks* Of course!

That was a stupid thing for me to waste time doing 😒

@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Apr 26, 2017

Well, I'll work on putting them in for you, don't want any time to be wasted. It just wasn't the right place to do such a thorough review on,

vadi2 added a commit to vadi2/Mudlet that referenced this pull request Apr 26, 2017
Ones I felt comfortable with anyhow
@vadi2
Copy link
Copy Markdown
Member

vadi2 commented Apr 26, 2017

#968

QPair<QString, int> exitData;
exitData.second = itAreaExit.value().first;
switch( itAreaExit.value().second ) {
case DIR_NORTH: exitData.first = QString("north"); break;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would like to keep this - it's far more readable than the exploded variant

@ahmedcharles ahmedcharles merged commit a28a173 into Mudlet:development Apr 27, 2017
@ahmedcharles ahmedcharles deleted the formatting branch April 27, 2017 10:55
vadi2 added a commit that referenced this pull request Apr 28, 2017
Ones I felt comfortable with anyhow
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.

3 participants