Skip to content

Commit 1ca70bb

Browse files
authored
Merge pull request fralx#472 from aol-nnov/define-codestyle
Define codestyle
2 parents 472781c + 0fca716 commit 1ca70bb

File tree

285 files changed

+19083
-17838
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+19083
-17838
lines changed

.clang-format

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
BasedOnStyle: WebKit
3+
Language: Cpp
4+
AlignAfterOpenBracket: Align
5+
AllowShortEnumsOnASingleLine: false
6+
BreakInheritanceList: AfterColon
7+
BreakConstructorInitializers: AfterColon
8+
SpaceBeforeCtorInitializerColon: false
9+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
10+
AllowAllConstructorInitializersOnNextLine: false
11+
SpaceBeforeInheritanceColon: false
12+
PointerAlignment: Left
13+
ReflowComments: true
14+
FixNamespaceComments: true
15+
SortIncludes: true
16+
SortUsingDeclarations: true
17+
IncludeBlocks: Regroup
18+
# regular expressions are matched against the filename of an include (including the <> or “”) in order:
19+
# topmost: main header file (the one that has the same name as .cpp-file) and ui_XXX.h, if exists
20+
# second group: local header files (i.e. "something.h")
21+
# third group: external header files (i.e. <smth/other.h>)
22+
# fourth group: Qt toolkit headers (actually, anything that starts with a 'Q')
23+
# last group: all other external header files
24+
# headers in all groups are sorted by name
25+
IncludeCategories:
26+
- Regex: '"ui_.*'
27+
Priority: 0
28+
- Regex: '^".*'
29+
Priority: 1
30+
- Regex: '^<Qt.*'
31+
Priority: 3
32+
- Regex: '^<.*/.*\.h>'
33+
Priority: 2
34+
- Regex: '^<Q.*'
35+
Priority: 3
36+
- Regex: '^<.*'
37+
Priority: 4
38+
ColumnLimit: 100
39+
TabWidth: 4
40+
UseTab: Never
41+
MaxEmptyLinesToKeep: 1

.github/workflows/cmake.yml

+13
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,19 @@ env:
1111
BUILD_TYPE: Release
1212

1313
jobs:
14+
check-code-style:
15+
runs-on: ubuntu-22.04
16+
name: "Check code style"
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Perform check
21+
run: ./tools/check_code_style.sh
22+
1423
build:
1524
runs-on: ubuntu-${{ matrix.ubuntu_version }}
1625
name: Ubuntu-${{ matrix.ubuntu_version }}-Qt-${{ matrix.qt_version }}-static-${{ matrix.static }}
26+
needs: check-code-style
1727
strategy:
1828
fail-fast: false
1929
matrix:
@@ -55,6 +65,7 @@ jobs:
5565
MSVC:
5666
name: windows-${{ matrix.win_version }}-Qt-${{ matrix.qt_version }}-static-${{ matrix.static }}
5767
runs-on: windows-${{ matrix.win_version }}
68+
needs: check-code-style
5869
strategy:
5970
fail-fast: false
6071
matrix:
@@ -96,6 +107,7 @@ jobs:
96107
MinGW-w64:
97108
runs-on: windows-2022
98109
name: msys2-${{ matrix.msystem }}-Qt-${{ matrix.qt_version }}-static-${{ matrix.static }}
110+
needs: check-code-style
99111
strategy:
100112
fail-fast: false
101113
matrix:
@@ -165,6 +177,7 @@ jobs:
165177
macos:
166178
runs-on: macos-${{ matrix.macos_version }}
167179
name: macos-${{ matrix.macos_version }}-Qt-${{ matrix.qt_version }}-static-${{ matrix.static }}
180+
needs: check-code-style
168181
strategy:
169182
fail-fast: false
170183
matrix:

console/main.cpp

+49-41
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1+
#include "../limereport/version.h"
2+
13
#include <QApplication>
2-
#include <QUuid>
3-
#include <LimeReport>
4-
#include <iostream>
4+
#include <QCommandLineParser>
55
#include <QDebug>
66
#include <QDir>
77
#include <QFile>
8-
#include <QCommandLineParser>
9-
#include "../limereport/version.h"
8+
#include <QUuid>
9+
10+
#include <LimeReport>
11+
#include <iostream>
1012

1113
#ifdef _WIN32
12-
#include <io.h>
13-
#include <fcntl.h>
14+
#include <fcntl.h>
15+
#include <io.h>
1416
#endif
1517

16-
int main(int argc, char *argv[])
18+
int main(int argc, char* argv[])
1719
{
1820
QApplication a(argc, argv);
1921
QApplication::setApplicationVersion(LIMEREPORT_VERSION_STR);
@@ -23,63 +25,69 @@ int main(int argc, char *argv[])
2325
QCommandLineParser parser;
2426
parser.addHelpOption();
2527
parser.addVersionOption();
26-
QCommandLineOption sourceOption(QStringList() << "s" << "source",
27-
QCoreApplication::translate("main", "Limereport pattern file name"),
28-
QCoreApplication::translate("main", "source"));
28+
QCommandLineOption sourceOption(
29+
QStringList() << "s"
30+
<< "source",
31+
QCoreApplication::translate("main", "Limereport pattern file name"),
32+
QCoreApplication::translate("main", "source"));
2933
parser.addOption(sourceOption);
30-
QCommandLineOption destinationOption(QStringList() << "d" << "destination",
31-
QCoreApplication::translate("main", "Output file name"),
32-
QCoreApplication::translate("main", "destination"));
34+
QCommandLineOption destinationOption(QStringList() << "d"
35+
<< "destination",
36+
QCoreApplication::translate("main", "Output file name"),
37+
QCoreApplication::translate("main", "destination"));
3338
parser.addOption(destinationOption);
34-
QCommandLineOption variablesOption(QStringList() << "p" << "param",
35-
QCoreApplication::translate("main", "Report parameter (can be more than one)"),
36-
QCoreApplication::translate("main", "param_name=param_value"));
39+
QCommandLineOption variablesOption(
40+
QStringList() << "p"
41+
<< "param",
42+
QCoreApplication::translate("main", "Report parameter (can be more than one)"),
43+
QCoreApplication::translate("main", "param_name=param_value"));
3744
parser.addOption(variablesOption);
3845
parser.process(a);
3946

4047
LimeReport::ReportEngine report;
4148

42-
if (parser.value(sourceOption).isEmpty()){
43-
std::cerr<<"Error! Report file is not specified !! \n";
49+
if (parser.value(sourceOption).isEmpty()) {
50+
std::cerr << "Error! Report file is not specified !! \n";
4451
return 1;
4552
}
4653

47-
if (!report.loadFromFile(parser.value(sourceOption))){
48-
std::cerr<<"Error! Report file \""+parser.value(sourceOption).toStdString()+"\" not found \n";
54+
if (!report.loadFromFile(parser.value(sourceOption))) {
55+
std::cerr << "Error! Report file \"" + parser.value(sourceOption).toStdString()
56+
+ "\" not found \n";
4957
return 1;
5058
}
5159

52-
if (!parser.values(variablesOption).isEmpty()){
53-
foreach(QString var, parser.values(variablesOption)){
60+
if (!parser.values(variablesOption).isEmpty()) {
61+
foreach (QString var, parser.values(variablesOption)) {
5462
QStringList varItem = var.split("=");
5563
if (varItem.size() == 2)
56-
report.dataManager()->setReportVariable(varItem.at(0),varItem.at(1));
64+
report.dataManager()->setReportVariable(varItem.at(0), varItem.at(1));
5765
}
5866
}
5967

60-
if (parser.value(destinationOption).isEmpty()){
68+
if (parser.value(destinationOption).isEmpty()) {
6169
report.printToPDF(QFileInfo(parser.value(sourceOption)).baseName());
6270
} else {
6371
report.printToPDF(parser.value(destinationOption));
6472
}
6573
#else
66-
std::cerr<<"This demo intended for Qt 5.2 and higher\n";
74+
std::cerr << "This demo intended for Qt 5.2 and higher\n";
6775
#endif
68-
// QUuid uid = QUuid::createUuid();
69-
// QString uidStr = uid.toString()+".pdf";
70-
// report.printToPDF(uidStr);
71-
// QFile in(uidStr);
72-
// QFile out;
73-
// out.open(stdout, QFile::WriteOnly);
74-
// in.open(QIODevice::ReadOnly);
75-
//#ifdef _WIN32
76-
// _setmode(fileno(stdout),O_BINARY);
77-
//#endif
78-
// QByteArray buffer = in.readAll();
79-
// fwrite(buffer,1,buffer.size(),stdout);
80-
// in.close();
81-
// in.remove();
76+
// QUuid uid = QUuid::createUuid();
77+
// QString uidStr = uid.toString()+".pdf";
78+
// report.printToPDF(uidStr);
79+
// QFile in(uidStr);
80+
// QFile out;
81+
// out.open(stdout, QFile::WriteOnly);
82+
// in.open(QIODevice::ReadOnly);
83+
//#ifdef _WIN32
84+
// _setmode(fileno(stdout),O_BINARY);
85+
//#endif
86+
// QByteArray buffer = in.readAll();
87+
// fwrite(buffer,1,buffer.size(),stdout);
88+
// in.close();
89+
// in.remove();
8290

8391
return 0;
84-
//return a.exec();
92+
// return a.exec();
8593
}

demo_r1/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
* GNU General Public License for more details. *
2929
****************************************************************************/
3030
#include "mainwindow.h"
31-
#include <QApplication>
3231

32+
#include <QApplication>
3333

34-
int main(int argc, char *argv[])
34+
int main(int argc, char* argv[])
3535
{
3636
QApplication a(argc, argv);
3737
MainWindow w;

0 commit comments

Comments
 (0)