diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..e1345f2 --- /dev/null +++ b/.clang-format @@ -0,0 +1,17 @@ +--- +BasedOnStyle: Google +AccessModifierOffset: -4 +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Inline +AllowShortLambdasOnASingleLine: Inline +BinPackArguments: false +BinPackParameters: false +ColumnLimit: 120 +IncludeBlocks: Preserve +IndentWidth: 4 +Language: Cpp +PackConstructorInitializers: Never +PenaltyBreakAssignment: 80 +SortIncludes: true +SpacesBeforeTrailingComments: 1 +Standard: c++17 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..d9e2b24 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,25 @@ +repos: + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v17.0.2 + hooks: + - id: clang-format + files: '.*\.(hpp|cpp|h)' + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-json + - id: check-shebang-scripts-are-executable + - id: check-merge-conflict + - id: check-vcs-permalinks + - id: check-yaml + - id: destroyed-symlinks + - id: end-of-file-fixer + - id: mixed-line-ending + - id: trailing-whitespace + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes diff --git a/examples/minimal/main.cpp b/examples/minimal/main.cpp index d9237bf..fe08f5a 100644 --- a/examples/minimal/main.cpp +++ b/examples/minimal/main.cpp @@ -8,8 +8,7 @@ #include #endif -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); #endif diff --git a/src/core/geojson_p.hpp b/src/core/geojson_p.hpp index dbda1a2..3827942 100644 --- a/src/core/geojson_p.hpp +++ b/src/core/geojson_p.hpp @@ -8,8 +8,8 @@ #include "types.hpp" #include -#include #include +#include #include diff --git a/src/core/map_renderer_p.hpp b/src/core/map_renderer_p.hpp index 6fce5da..ecca0f5 100644 --- a/src/core/map_renderer_p.hpp +++ b/src/core/map_renderer_p.hpp @@ -12,9 +12,10 @@ #include #include -#include #include +#include + #include #include diff --git a/src/core/renderer_backend.cpp b/src/core/renderer_backend.cpp index 3715292..542c65c 100644 --- a/src/core/renderer_backend.cpp +++ b/src/core/renderer_backend.cpp @@ -8,9 +8,10 @@ #include #include -#include #include +#include + namespace QMapLibre { class RenderableResource final : public mbgl::gl::RenderableResource { diff --git a/src/core/utils.cpp b/src/core/utils.cpp index e84c5fc..f03fc2f 100644 --- a/src/core/utils.cpp +++ b/src/core/utils.cpp @@ -7,8 +7,8 @@ #include #include -#include #include +#include // mbgl::NetworkStatus::Status static_assert(mbgl::underlying_type(QMapLibre::Online) == mbgl::underlying_type(mbgl::NetworkStatus::Status::Online), diff --git a/src/location/plugins/qml_types.hpp b/src/location/plugins/qml_types.hpp index 691eeab..27b153b 100644 --- a/src/location/plugins/qml_types.hpp +++ b/src/location/plugins/qml_types.hpp @@ -5,12 +5,12 @@ #ifndef QMAPLIBREQMLTYPES_H #define QMAPLIBREQMLTYPES_H -#include -#include -#include - #include "../qgeomap.hpp" +#include +#include +#include + class MapLibreStyleAttached : public QObject { Q_OBJECT QML_ANONYMOUS diff --git a/src/location/qgeomap.cpp b/src/location/qgeomap.cpp index 3bc1177..24b9276 100644 --- a/src/location/qgeomap.cpp +++ b/src/location/qgeomap.cpp @@ -23,9 +23,9 @@ #include #include #include +#include // for debugging the context name #include #include -#include // for debugging the context name #include diff --git a/src/location/qgeomap_p.hpp b/src/location/qgeomap_p.hpp index 582e492..16479c5 100644 --- a/src/location/qgeomap_p.hpp +++ b/src/location/qgeomap_p.hpp @@ -6,13 +6,14 @@ #pragma once +#include + #include #include #include #include #include #include -#include namespace QMapLibre { class Map; diff --git a/src/location/qt_mapping_engine.cpp b/src/location/qt_mapping_engine.cpp index 8a30166..382d162 100644 --- a/src/location/qt_mapping_engine.cpp +++ b/src/location/qt_mapping_engine.cpp @@ -7,8 +7,8 @@ #include "qt_mapping_engine.hpp" #include "qgeomap.hpp" +#include #include -#include #include #include #include diff --git a/src/location/qt_mapping_engine.hpp b/src/location/qt_mapping_engine.hpp index 50db0b1..520db57 100644 --- a/src/location/qt_mapping_engine.hpp +++ b/src/location/qt_mapping_engine.hpp @@ -10,8 +10,8 @@ #include -#include #include +#include namespace QMapLibre { diff --git a/src/location/stylechange.cpp b/src/location/stylechange.cpp index 78190a5..36fdec6 100644 --- a/src/location/stylechange.cpp +++ b/src/location/stylechange.cpp @@ -5,6 +5,8 @@ #include "stylechange_p.h" +#include + #include #include #include @@ -12,7 +14,6 @@ #include #include #include -#include #include diff --git a/src/location/stylechange_p.h b/src/location/stylechange_p.h index 897159e..06db46f 100644 --- a/src/location/stylechange_p.h +++ b/src/location/stylechange_p.h @@ -5,17 +5,18 @@ #pragma once +#include +#include +#include +#include +#include + #include #include #include #include #include #include -#include -#include -#include -#include -#include #include