Skip to content

Commit

Permalink
tweak clang-format for better include grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
nschimme committed Jun 16, 2024
1 parent 48690b8 commit 3907375
Show file tree
Hide file tree
Showing 343 changed files with 1,729 additions and 1,346 deletions.
21 changes: 18 additions & 3 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,24 @@ ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<Q.*'
Priority: 200
# Headers in ""
- Regex: '^"'
Priority: 1
SortPriority: 1
# Headers in <>
- Regex: '^<[^Q][^/]*>$'
Priority: 2
SortPriority: 2
# Headers in <>
- Regex: '^<[^Q].*[/]'
Priority: 3
SortPriority: 3
# Qt headers
- Regex: '^<Q[^>]'
Priority: 4
SortPriority: 4
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 4
Expand All @@ -97,7 +112,7 @@ PenaltyExcessCharacter: 50
PenaltyReturnTypeOnItsOwnLine: 300
PointerAlignment: Right
ReflowComments: false
SortIncludes: true
SortIncludes: CaseSensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
Expand Down
5 changes: 3 additions & 2 deletions src/adventure/adventuresession.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
// Copyright (C) 2023 The MMapper Authors
// Author: Mike Repass <[email protected]> (Taryn)

#include "../../tests/testadventure.h"

#include <chrono>
#include <QString>

#include "../../tests/testadventure.h"
#include <QString>

class AdventureSession
{
Expand Down
4 changes: 2 additions & 2 deletions src/adventure/adventuretracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// Copyright (C) 2023 The MMapper Authors
// Author: Mike Repass <[email protected]> (Taryn)

#include <QObject>

#include "../observer/gameobserver.h"
#include "adventuresession.h"
#include "lineparsers.h"

#include <QObject>

class AdventureTracker final : public QObject
{
Q_OBJECT
Expand Down
6 changes: 3 additions & 3 deletions src/adventure/adventurewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include "adventurewidget.h"

#include <QtCore>
#include <QtWidgets>

#include "../configuration/configuration.h"
#include "adventuresession.h"

#include <QtCore>
#include <QtWidgets>

AdventureWidget::AdventureWidget(AdventureTracker &at, QWidget *const parent)
: QWidget{parent}
, m_adventureTracker{at}
Expand Down
4 changes: 2 additions & 2 deletions src/adventure/adventurewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// Copyright (C) 2023 The MMapper Authors
// Author: Mike Repass <[email protected]> (Taryn)

#include "adventuretracker.h"

#include <QString>
#include <QWidget>
#include <QtCore>
#include <QtWidgets>

#include "adventuretracker.h"

class AdventureWidget : public QWidget
{
Q_OBJECT
Expand Down
4 changes: 2 additions & 2 deletions src/adventure/xpstatuswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
// Copyright (C) 2023 The MMapper Authors
// Author: Mike Repass <[email protected]> (Taryn)

#include "adventuretracker.h"

#include <QLabel>
#include <QPushButton>
#include <QStatusBar>

#include "adventuretracker.h"

class XPStatusWidget : public QPushButton
{
Q_OBJECT
Expand Down
11 changes: 6 additions & 5 deletions src/client/ClientTelnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,20 @@

#include "ClientTelnet.h"

#include "../configuration/configuration.h"
#include "../global/io.h"
#include "../global/utils.h"
#include "../proxy/TextCodec.h"

#include <limits>

#include <QApplication>
#include <QByteArray>
#include <QHostAddress>
#include <QMessageLogContext>
#include <QObject>
#include <QString>

#include "../configuration/configuration.h"
#include "../global/io.h"
#include "../global/utils.h"
#include "../proxy/TextCodec.h"

ClientTelnet::ClientTelnet(QObject *const parent)
: AbstractTelnet(TextCodecStrategyEnum::FORCE_LATIN_1, parent, "MMapper")
{
Expand Down
6 changes: 3 additions & 3 deletions src/client/ClientTelnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
// Copyright (C) 2019 The MMapper Authors
// Author: Nils Schimmelmann <[email protected]> (Jahara)

#include "../global/io.h"
#include "../proxy/AbstractTelnet.h"

#include <QAbstractSocket>
#include <QObject>
#include <QTcpSocket>

#include "../global/io.h"
#include "../proxy/AbstractTelnet.h"

class ClientTelnet final : public AbstractTelnet
{
Q_OBJECT
Expand Down
8 changes: 4 additions & 4 deletions src/client/ClientWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@

#include "ClientWidget.h"

#include <QString>
#include <QTimer>
#include <QtWidgets>

#include "../configuration/configuration.h"
#include "ClientTelnet.h"
#include "displaywidget.h"
#include "stackedinputwidget.h"
#include "ui_ClientWidget.h"

#include <QString>
#include <QTimer>
#include <QtWidgets>

ClientWidget::ClientWidget(QWidget *const parent)
: QWidget(parent)
, ui(new Ui::ClientWidget)
Expand Down
4 changes: 2 additions & 2 deletions src/client/ClientWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// Copyright (C) 2019 The MMapper Authors
// Author: Nils Schimmelmann <[email protected]> (Jahara)

#include "../global/macros.h"

#include <QPointer>
#include <QString>
#include <QWidget>
#include <QtCore>

#include "../global/macros.h"

class QObject;
class QEvent;
class ClientTelnet;
Expand Down
6 changes: 3 additions & 3 deletions src/client/displaywidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

#include "displaywidget.h"

#include "../configuration/configuration.h"
#include "../global/AnsiColor.h"

#include <QMessageLogContext>
#include <QRegularExpression>
#include <QScrollBar>
Expand All @@ -12,9 +15,6 @@
#include <QToolTip>
#include <QtGui>

#include "../configuration/configuration.h"
#include "../global/AnsiColor.h"

static const constexpr int SCROLLBAR_BUFFER = 1;
static const constexpr int TAB_WIDTH_SPACES = 8;

Expand Down
4 changes: 2 additions & 2 deletions src/client/displaywidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// Copyright (C) 2019 The MMapper Authors
// Author: Nils Schimmelmann <[email protected]> (Jahara)

#include "../global/macros.h"

#include <QColor>
#include <QFont>
#include <QSize>
Expand All @@ -13,8 +15,6 @@
#include <QtCore>
#include <QtGui>

#include "../global/macros.h"

class QObject;
class QResizeEvent;
class QTextDocument;
Expand Down
4 changes: 2 additions & 2 deletions src/client/inputwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "inputwidget.h"

#include "../configuration/configuration.h"

#include <QLinkedList>
#include <QMessageLogContext>
#include <QRegularExpression>
Expand All @@ -12,8 +14,6 @@
#include <QtGui>
#include <QtWidgets>

#include "../configuration/configuration.h"

static constexpr const int MIN_WORD_LENGTH = 3;

static const QRegularExpression s_whitespaceRx(R"(\W+)");
Expand Down
5 changes: 3 additions & 2 deletions src/client/inputwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
// Copyright (C) 2019 The MMapper Authors
// Author: Nils Schimmelmann <[email protected]> (Jahara)

#include "../global/macros.h"

#include <iterator>
#include <list>

#include <QEvent>
#include <QObject>
#include <QPlainTextEdit>
Expand All @@ -13,8 +16,6 @@
#include <QWidget>
#include <QtCore>

#include "../global/macros.h"

class QKeyEvent;
class QObject;
class QWidget;
Expand Down
4 changes: 2 additions & 2 deletions src/client/stackedinputwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#include "stackedinputwidget.h"

#include "inputwidget.h"

#include <QLineEdit>
#include <QString>

#include "inputwidget.h"

class QWidget;

StackedInputWidget::StackedInputWidget(QWidget *const parent)
Expand Down
9 changes: 5 additions & 4 deletions src/clock/mumeclock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

#include "mumeclock.h"

#include "../global/Array.h"
#include "../proxy/GmcpMessage.h"
#include "mumemoment.h"

#include <cassert>

#include <QDebug>
#include <QMetaEnum>
#include <QObject>
#include <QRegularExpression>
#include <QString>

#include "../global/Array.h"
#include "../proxy/GmcpMessage.h"
#include "mumemoment.h"

static constexpr const int DEFAULT_MUME_START_EPOCH = 1517443173;
static constexpr const int DEFAULT_TOLERANCE_LIMIT = 10;
static constexpr const int ONE_RL_DAY_IN_SECONDS = 86400;
Expand Down
9 changes: 5 additions & 4 deletions src/clock/mumeclock.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
// Copyright (C) 2019 The MMapper Authors
// Author: Nils Schimmelmann <[email protected]> (Jahara)

#include "../global/macros.h"
#include "../observer/gameobserver.h"
#include "mumemoment.h"

#include <cstdint>

#include <QList>
#include <QMetaEnum>
#include <QObject>
#include <QString>
#include <QtCore>

#include "../global/macros.h"
#include "../observer/gameobserver.h"
#include "mumemoment.h"

class GmcpMessage;
class QMetaEnum;

Expand Down
9 changes: 5 additions & 4 deletions src/clock/mumeclockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

#include "mumeclockwidget.h"

#include "../configuration/configuration.h"
#include "mumeclock.h"
#include "mumemoment.h"

#include <cassert>
#include <memory>

#include <QDateTime>
#include <QLabel>
#include <QMouseEvent>
#include <QString>

#include "../configuration/configuration.h"
#include "mumeclock.h"
#include "mumemoment.h"

MumeClockWidget::MumeClockWidget(MumeClock *const clock, QWidget *const parent)
: QWidget(parent)
, m_clock(clock)
Expand Down
9 changes: 5 additions & 4 deletions src/clock/mumeclockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
// Copyright (C) 2019 The MMapper Authors
// Author: Nils Schimmelmann <[email protected]> (Jahara)

#include "mumeclock.h"
#include "mumemoment.h"
#include "ui_mumeclockwidget.h"

#include <memory>

#include <QString>
#include <QWidget>
#include <QtCore>

#include "mumeclock.h"
#include "mumemoment.h"
#include "ui_mumeclockwidget.h"

class QMouseEvent;
class QObject;
class QTimer;
Expand Down
4 changes: 2 additions & 2 deletions src/clock/mumemoment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

#include "mumemoment.h"

#include <iostream>

#include "../global/Debug.h"
#include "mumeclock.h"

#include <iostream>

static void maybe_warn_if_not_clamped(
const char *const name, bool &warned, const int val, const int lo, const int hi)
{
Expand Down
Loading

0 comments on commit 3907375

Please sign in to comment.