From 4355ee12474eeb05c295219c668be59bc90082e5 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 20:20:37 +0000 Subject: [PATCH 01/16] updated pre-commit hooks --- .pre-commit-config.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c38055..64d532d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,10 +1,9 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-added-large-files - - id: check-byte-order-marker - id: check-case-conflict - id: check-merge-conflict - id: check-symlinks @@ -25,7 +24,7 @@ repos: hooks: - id: cmake-format - repo: https://github.com/adrienverge/yamllint.git - rev: v1.37.0 + rev: v1.37.1 hooks: - id: yamllint args: [--format, parsable, -d, relaxed] From 7ca34a1fab3e129d95d1cad5581c35e40fc04171 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 20:22:46 +0000 Subject: [PATCH 02/16] migrate gitpod to ona --- .devcontainer/Dockerfile | 22 ++++++++- .devcontainer/devcontainer.json | 88 +++++++++++++++++++-------------- .gitpod.yml | 26 ---------- .gitpod/automation.yml | 19 +++++++ 4 files changed, 91 insertions(+), 64 deletions(-) delete mode 100644 .gitpod.yml create mode 100644 .gitpod/automation.yml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index d5eb1b0..0a09ad4 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,11 +1,14 @@ -FROM mcr.microsoft.com/devcontainers/base:dev-ubuntu24.04 -LABEL maintainer="Michel Estermann " +ARG BASE_IMAGE=mcr.microsoft.com/devcontainers/base:ubuntu + +FROM $BASE_IMAGE +LABEL maintainer="Michel Estermann " ARG CLANG_VERSION=18 ARG GCC_VERSION=14 RUN apt-get update \ + && apt-get clean \ && apt-get -qq install -y --no-install-recommends \ make \ build-essential \ @@ -25,6 +28,7 @@ RUN apt-get update \ gcc-14 \ file \ ssh-client \ + && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Install locales package and generate en_US.UTF-8 locale @@ -132,3 +136,17 @@ RUN update-alternatives --install /usr/bin/cc cc /usr/bin/clang-${CLANG_VERSION} RUN update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-${CLANG_VERSION} 100 RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-${CLANG_VERSION} 100 RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-${CLANG_VERSION} 100 + +# Install packages +RUN apt-get update \ + && apt-get -qq install -y --no-install-recommends \ + ubuntu-desktop \ + tightvncserver \ + novnc \ + websockify \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +EXPOSE 5901 6080 + +CMD ["sh", "-c", "/usr/share/novnc/utils/launch.sh --vnc localhost:5901 & vncserver :1 -geometry 1400x1000 -depth 24 && tail -f /dev/null"] diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 88c4459..933ac77 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,40 +1,56 @@ { - "name": "C++", - "build": { + "name": "C++ noVNC", + "build": { "context": "..", - "dockerfile": "Dockerfile", - "args": { - "CLANG_VERSION": "18", - "GCC_VERSION": "14" - } - }, - "mounts": [ - "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind", - "source=${localEnv:HOME}/.conan2,target=/home/vscode/.conan2,type=bind", - "source=native-ccache,target=/opt/.native-ccache,type=volume" - ], + "dockerfile": "Dockerfile", + "args": { + "CLANG_VERSION": "19", + "GCC_VERSION": "14", + "BASE_IMAGE": "mcr.microsoft.com/devcontainers/base:ubuntu" + } + }, + "mounts": [ + "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind" + ], + "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/Coronan,type=bind", "updateRemoteUserUID": true, - "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", - - "postAttachCommand": "pre-commit install -f --hook-type pre-commit && conan profile detect --force && conan install . --build=missing --settings=build_type=Debug && conan install . --build=missing --settings=build_type=Release", - "customizations": { - "vscode": { - "extensions": [ - "ms-vscode.cpptools", - "ms-vscode.cpptools-extension-pack", - "xaver.clang-format", - "llvm-vs-code-extensions.vscode-clangd", - "twxs.cmake", - "ms-vscode.cmake-tools", - "mhutchie.git-graph", - "donjayamanne.githistory", - "webfreak.debug", - "jnoortheen.nix-ide", - "ms-python.python", - "hbenl.vscode-test-explorer", - "ms-azuretools.vscode-docker", - "codacy-app.codacy" - ] - } - } + "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "postAttachCommand": "pre-commit install -f --hook-type pre-commit && conan profile detect --force", + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.cmake-tools", + "xaver.clang-format", + "ms-python.python", + "ms-python.autopep8", + "jeff-hykin.better-cpp-syntax", + "matepek.vscode-catch2-test-adapter", + "mhutchie.git-graph", + "cs128.cs128-clang-tidy", + "donjayamanne.githistory", + "webfreak.debug", + "jnoortheen.nix-ide", + "hbenl.vscode-test-explorer", + "ms-azuretools.vscode-docker", + "actboy168.tasks", + "streetsidesoftware.code-spell-checker", + "github.vscode-pull-request-github" + ] + } + }, + "features": { + "ghcr.io/devcontainers/features/nix:1": {}, + "ghcr.io/ChristopherMacGown/devcontainer-features/direnv:1": {} + }, + "forwardPorts": [ + 6080 + ], + "portsAttributes": { + "6080": { + "label": "noVNC", + "onAutoForward": "openPreview" + } + } } diff --git a/.gitpod.yml b/.gitpod.yml deleted file mode 100644 index 4fd2783..0000000 --- a/.gitpod.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -image: - file: .devcontainer/Dockerfile - -tasks: - - before: | - pre-commit install -f --hook-type pre-commit - rm -rf build - export CXX=clang++-18 - export CC=clang-18 - conan profile detect - init: conan install . --build=missing --settings=build_type=Debug - command: cmake -S . -B build --preset=linux-clang-debug - -vscode: - extensions: - - ms-vscode.cmake-tools - - github.vscode-pull-request-github - - jnoortheen.nix-ide - - webfreak.debug - - mhutchie.git-graph - - gruntfuggly.todo-tree - - vscode-icons-team.vscode-icons - - matepek.vscode-catch2-test-adapter - - xaver.clang-format - - streetsidesoftware.code-spell-checker diff --git a/.gitpod/automation.yml b/.gitpod/automation.yml new file mode 100644 index 0000000..d78c6e7 --- /dev/null +++ b/.gitpod/automation.yml @@ -0,0 +1,19 @@ +--- +tasks: + before-000: + command: | + pre-commit install -f --hook-type pre-commit + rm -rf build + export CXX=clang++-19 + export CC=clang-19 + conan profile detect + description: before task migrated from .gitpod.yml + name: 'Task 0: before' + init-000: + command: conan install . --build=missing --settings=build_type=Debug + dependsOn: + - before-000 + description: init task migrated from .gitpod.yml + name: 'Task 0: init' + triggeredBy: + - postDevcontainerStart From f48480f933d86652249f5e28186c19984f951df3 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 20:25:32 +0000 Subject: [PATCH 03/16] updated and restructured nix stuff --- default.nix | 2 +- nix-lock.toml | 9 --------- cmake.nix => nix/cmake.nix | 0 nix/nix-lock.toml | 9 +++++++++ shell.nix => nix/shell.nix | 8 ++------ sources.nix => nix/sources.nix | 0 6 files changed, 12 insertions(+), 16 deletions(-) delete mode 100644 nix-lock.toml rename cmake.nix => nix/cmake.nix (100%) create mode 100644 nix/nix-lock.toml rename shell.nix => nix/shell.nix (91%) rename sources.nix => nix/sources.nix (100%) diff --git a/default.nix b/default.nix index 80c53ac..caff26c 100644 --- a/default.nix +++ b/default.nix @@ -1 +1 @@ -import shell.nix +import nix/shell.nix diff --git a/nix-lock.toml b/nix-lock.toml deleted file mode 100644 index bcd5d2f..0000000 --- a/nix-lock.toml +++ /dev/null @@ -1,9 +0,0 @@ -[nixpkgs] -ref = "24.11" -rev = "63dacb46bf939521bdc93981b4cbb7ecb58427a0" -sha256 = "1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx" - -[cmake] -ref = "3.31.4" -rev = "3.31.4" -sha256 = "09bz1y5jr4n2ln9q6zlm44ar78f0yxcl7qvjwrrmrfpmfpz0n4x6" diff --git a/cmake.nix b/nix/cmake.nix similarity index 100% rename from cmake.nix rename to nix/cmake.nix diff --git a/nix/nix-lock.toml b/nix/nix-lock.toml new file mode 100644 index 0000000..f11e8a6 --- /dev/null +++ b/nix/nix-lock.toml @@ -0,0 +1,9 @@ +[nixpkgs] +ref = "25.05" +rev = "11cb3517b3af6af300dd6c055aeda73c9bf52c48" +sha256 = "1915r28xc4znrh2vf4rrjnxldw2imysz819gzhk9qlrkqanmfsxd" + +[cmake] +ref = "3.31.10" +rev = "3.31.10" +sha256 = "0a9y7nqr27rl8acvjyj8s57q87bdjxa9w2g5mphsh7ylsvgzl1ng" diff --git a/shell.nix b/nix/shell.nix similarity index 91% rename from shell.nix rename to nix/shell.nix index 06d3275..11357d4 100644 --- a/shell.nix +++ b/nix/shell.nix @@ -2,13 +2,9 @@ with (import ./sources.nix); with nixpkgs; let gcc = gcc14; - clang = clang_18; + clang = clang_19; cmake_331 = (import ./cmake.nix).cmake; - gcovr = python3.withPackages(ps: [ - ps.gcovr - ]); - in stdenvNoCC.mkDerivation { name = "shell"; hardeningDisable = [ "all" ]; @@ -31,7 +27,6 @@ in stdenvNoCC.mkDerivation { qt6.qtbase qt6.qtcharts lcov - gcovr perl doxygen graphviz @@ -39,6 +34,7 @@ in stdenvNoCC.mkDerivation { pre-commit python3 cmake-format + gcovr python3Packages.setuptools python3Packages.pip python3Packages.virtualenv diff --git a/sources.nix b/nix/sources.nix similarity index 100% rename from sources.nix rename to nix/sources.nix From eaa24ca078446e8c6e5326d5f1fef040a3fb17c0 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 20:26:18 +0000 Subject: [PATCH 04/16] changed to conanfile.py --- conanfile.py | 32 ++++++++++++++++++++++++++++++++ conanfile.txt | 25 ------------------------- 2 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 conanfile.py delete mode 100644 conanfile.txt diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..400024d --- /dev/null +++ b/conanfile.py @@ -0,0 +1,32 @@ +from conan import ConanFile +from conan.tools.cmake import cmake_layout + + +class CoronanRecipe(ConanFile): + settings = 'os', 'compiler', 'build_type', 'arch' + generators = 'CMakeDeps' + + def configure(self): + self.options['poco'].enable_data = False + self.options['poco'].enable_data_postgresql = False + self.options['poco'].enable_data_mysql = False + self.options['poco'].enable_data_sqlite = False + self.options['poco'].enable_data_odbc = False + self.options['poco'].enable_mongodb = False + self.options['poco'].enable_redis = False + self.options['poco'].enable_jwt = False + self.options['poco'].enable_zip = False + self.options['poco'].enable_activerecord = False + + + def requirements(self): + self.requires('poco/1.14.2') + self.requires('rapidjson/cci.20230929') + self.requires('lyra/1.7.0') + self.requires('catch2/3.11.0') + self.requires('fmt/12.1.0') + self.requires('date/3.0.4') + + + def layout(self): + cmake_layout(self) diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index e63af10..0000000 --- a/conanfile.txt +++ /dev/null @@ -1,25 +0,0 @@ -[requires] -poco/1.13.3 -rapidjson/cci.20230929 -lyra/1.6.1 -catch2/3.8.0 -fmt/11.1.1 -date/3.0.3 - -[generators] -CMakeDeps - -[options] -poco/*:enable_data = False -poco/*:enable_data_postgresql = False -poco/*:enable_data_mysql = False -poco/*:enable_data_sqlite = False -poco/*:enable_data_odbc = False -poco/*:enable_mongodb = False -poco/*:enable_redis = False -poco/*:enable_jwt = False -poco/*:enable_zip = False -poco/*:enable_activerecord = False - -[layout] -cmake_layout From 13ef406c53ad671a5c45ea9506fcb4d914346757 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 20:26:45 +0000 Subject: [PATCH 05/16] updated python requirements --- py-requirements.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/py-requirements.txt b/py-requirements.txt index a658d59..fed16f0 100644 --- a/py-requirements.txt +++ b/py-requirements.txt @@ -1,10 +1,10 @@ cmake>=3.31,<4.0 -conan>=2.15 -gcovr>=8.2 -pre-commit>=4.0.1 -cmake-format>=0.6.13 -setuptools>=75.0.0 -python-dateutil==2.9.0 -requests>=2.32.2 # not directly required, pinned by Snyk to avoid a vulnerability -zipp>=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability -urllib3>=1.26.19 # not directly required, pinned by Snyk to avoid a vulnerability +conan~=2.22.0 +gcovr~=8.0 +pre-commit>=4.0.0, <5.0.0 +cmake-format~=0.6.0 +setuptools~=75.0.0 +python-dateutil>=2.8.0, <3.0 +requests~=2.32.2 # not directly required, pinned by Snyk to avoid a vulnerability +zipp~=3.19.1 # not directly required, pinned by Snyk to avoid a vulnerability +urllib3~=1.26.19 # not directly required, pinned by Snyk to avoid a vulnerability From 139b576e517ed1f33112caf8e23979d67830dd84 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 20:45:10 +0000 Subject: [PATCH 06/16] updated build.sh and shebangs to be more portable --- .github/workflows/ci-linux.yml | 17 +++++++++++++---- build.sh | 5 +++-- format_source_files.sh | 2 +- install-qt.sh | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 2cb2e96..4fe4511 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -79,12 +79,21 @@ jobs: generator: Ninja coverage: OFF download_qt: OFF - - name: ubuntu-24.04-clang-18-download-qt + - name: ubuntu-24.04-clang-19 os: ubuntu-24.04 build_type: Release - cppcompiler: clang++-18 - ccompiler: clang-18 - clang-tidy: clang-tidy-18 + cppcompiler: clang++-19 + ccompiler: clang-19 + clang-tidy: clang-tidy-19 + generator: Ninja + coverage: OFF + download_qt: OFF + - name: ubuntu-24.04-clang-19-download-qt + os: ubuntu-24.04 + build_type: Release + cppcompiler: clang++-19 + ccompiler: clang-19 + clang-tidy: clang-tidy-19 generator: Ninja coverage: OFF download_qt: ON diff --git a/build.sh b/build.sh index a051393..8a0e380 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e @@ -11,6 +11,7 @@ BUILD_TARGET="--target all" CXX_COMPILER="g++" C_COMPILER="gcc" COMPILER_VERSION="$(g++ -dumpversion)" +LIBCXX="libstdc++11" CLEAR_BUILD=false CONAN=conan @@ -112,7 +113,7 @@ if [[ "${CLEAR_BUILD}" = true ]] ; then fi echo "run conan install" -"${CONAN}" install . --build=missing --settings=build_type="${BUILD_TYPE}" --settings=compiler="${C_COMPILER}" --settings=compiler.version="${COMPILER_VERSION}" --settings=compiler.cppstd=17 +"${CONAN}" install . --build=missing --settings build_type="${BUILD_TYPE}" --settings compiler="${C_COMPILER}" --settings compiler.version="${COMPILER_VERSION}" --settings compiler.libcxx="${LIBCXX}" --settings compiler.cppstd=17 if [[ "${COVERAGE}" = true ]] ; then "${CMAKE}" -S . -B "${BUILD_DIR}" "${CMAKE_GENERATOR}" -DENABLE_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug diff --git a/format_source_files.sh b/format_source_files.sh index c5ea518..9ef9145 100755 --- a/format_source_files.sh +++ b/format_source_files.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e diff --git a/install-qt.sh b/install-qt.sh index c6f8b52..997be36 100755 --- a/install-qt.sh +++ b/install-qt.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e From f885ad616e8dce58af8f57c4c073fa15f0a17408 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 21:04:32 +0000 Subject: [PATCH 07/16] enable warnings as errors by default --- .clang-tidy | 2 +- apps/qt/cmake/Qt.cmake | 2 +- apps/qt/country_data_model.cpp | 22 +++++++++------------- apps/qt/mainwindow.cpp | 6 +++--- cmake/CompilerWarnings.cmake | 2 +- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 670bd92..41bc61e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,5 +1,5 @@ --- -Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-altera-*,-llvm*,-modernize-use-trailing-return-type,-misc-include-cleaner' +Checks: '*,-fuchsia-*,-google-*,-zircon-*,-abseil-*,-altera-*,-llvm*,-modernize-use-trailing-return-type,-misc-include-cleaner,-readability-else-after-return' WarningsAsErrors: '' HeaderFilterRegex: '' FormatStyle: none diff --git a/apps/qt/cmake/Qt.cmake b/apps/qt/cmake/Qt.cmake index 0688d90..95075eb 100644 --- a/apps/qt/cmake/Qt.cmake +++ b/apps/qt/cmake/Qt.cmake @@ -37,7 +37,7 @@ FetchContent_Declare( GIT_TAG "${QT_VERSION}" GIT_SHALLOW TRUE GIT_PROGRESS TRUE - GIT_SUBMODULES ${QT_BUILD_SUBMODULES} + GIT_SUBMODULES ${QT_BUILD_SUBMODULES} SYSTEM ) FetchContent_MakeAvailable(qt6) diff --git a/apps/qt/country_data_model.cpp b/apps/qt/country_data_model.cpp index 74c7ab1..0dd4c7e 100644 --- a/apps/qt/country_data_model.cpp +++ b/apps/qt/country_data_model.cpp @@ -20,18 +20,14 @@ void CountryDataModel::populate_data(coronan::CountryData const& country_data) if (not country_data.timeline.empty()) { -// Unfortunatelly QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) -// does not fully support C++ 20 even for Qt >= 6.4 -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" + // Unfortunatelly QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) + // does not fully support C++ 20 even for Qt >= 6.4 auto const start_qdate = QDate(static_cast(country_data.timeline.front().date.year()), - static_cast(country_data.timeline.front().date.month()), - static_cast(country_data.timeline.front().date.day())); + static_cast(unsigned(country_data.timeline.front().date.month())), + static_cast(unsigned(country_data.timeline.front().date.day()))); auto const end_qdate = QDate(static_cast(country_data.timeline.back().date.year()), - static_cast(static_cast(country_data.timeline.back().date.month())), - static_cast(static_cast(country_data.timeline.back().date.day()))); - -#pragma GCC diagnostic pop + static_cast(unsigned(country_data.timeline.back().date.month())), + static_cast(unsigned(country_data.timeline.back().date.day()))); start_date = QDateTime{start_qdate, QTime(1, 0)}; end_date = QDateTime{end_qdate, QTime(1, 0)}; @@ -44,9 +40,9 @@ void CountryDataModel::populate_data(coronan::CountryData const& country_data) CountryTimelineData timeline_data; // Unfortunatelly QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) // does not fully support C++ 20 even for Qt >= 6.4 - auto const qdate = QDate(static_cast(data_point.date.year()), - static_cast(static_cast(data_point.date.month())), - static_cast(static_cast(data_point.date.day()))); + auto const qdate = + QDate(static_cast(data_point.date.year()), static_cast(unsigned(data_point.date.month())), + static_cast(unsigned(data_point.date.day()))); timeline_data.date = QDateTime{qdate, QTime(1, 0)}; timeline_data.deaths = data_point.deaths.has_value() ? QVariant{data_point.deaths.value()} : QVariant{}; min = std::min(min, data_point.deaths.value_or(min)); diff --git a/apps/qt/mainwindow.cpp b/apps/qt/mainwindow.cpp index e04701d..3d81566 100644 --- a/apps/qt/mainwindow.cpp +++ b/apps/qt/mainwindow.cpp @@ -62,9 +62,9 @@ void CoronanWidget::populate_date_boxes() auto const latest_date = latest_country_data.latest.date; // Unfortunatelly QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) does // not fully support C++ 20 even for Qt >= 6.4 - auto const latest_qdate = QDate(static_cast(latest_date.year()), // - static_cast(latest_date.month()), // - static_cast(latest_date.day())); + auto const latest_qdate = QDate(static_cast(latest_date.year()), // + static_cast(unsigned(latest_date.month())), // + static_cast(unsigned(latest_date.day()))); ui->startDate->setDate(default_start_date); ui->startDate->setMaximumDate(latest_qdate); diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index 7e7d705..3a394eb 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -1,5 +1,5 @@ function(set_project_warnings project_name) - option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF) + option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON) set(MSVC_WARNINGS /W4 # Baseline reasonable warnings From 82e8fdd61366cde96bdd92e4e890860d7072199b Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 21:04:52 +0000 Subject: [PATCH 08/16] updated ci pipelines --- .envrc | 4 ++-- .github/workflows/api-doc.yml | 2 +- .github/workflows/ci-linux-sanatizer.yml | 2 +- .github/workflows/ci-linux.yml | 20 +++++++++++++++- .github/workflows/ci-macos.yml | 13 ++++++++-- .github/workflows/ci-release.yml | 2 +- .github/workflows/ci-windows.yml | 30 ++++++++++++++++++++---- .github/workflows/nix.yml | 6 ++--- cmake/CompilerWarnings.cmake | 1 - cmake/StaticAnalyzers.cmake | 13 ++++++++-- nix/nix-lock.toml | 6 ++--- nix/shell.nix | 6 ++--- 12 files changed, 80 insertions(+), 25 deletions(-) diff --git a/.envrc b/.envrc index 22883b7..228bb02 100644 --- a/.envrc +++ b/.envrc @@ -1,5 +1,5 @@ # uncomment if you want to use a nix-shell to build # use nix -CC=gcc -CXX=g++ +export CC=gcc +export CXX=g++ diff --git a/.github/workflows/api-doc.yml b/.github/workflows/api-doc.yml index c0ab6d2..3366944 100644 --- a/.github/workflows/api-doc.yml +++ b/.github/workflows/api-doc.yml @@ -35,7 +35,7 @@ jobs: - name: Set conan compiler env run: conan profile detect - name: conan install - run: conan install . --build=missing --settings=build_type=Debug + run: conan install . --build=missing --settings build_type=Debug - name: cmake-configuration run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug - name: build-documentation diff --git a/.github/workflows/ci-linux-sanatizer.yml b/.github/workflows/ci-linux-sanatizer.yml index a3d0365..2c068ec 100644 --- a/.github/workflows/ci-linux-sanatizer.yml +++ b/.github/workflows/ci-linux-sanatizer.yml @@ -156,7 +156,7 @@ jobs: - name: Set conan compiler env run: conan profile detect - name: conan install - run: conan install . --build=missing --settings=build_type=Debug --settings=compiler.cppstd=17 + run: conan install . --build=missing --settings build_type=Debug --settings=compiler.cppstd=17 - name: CMake configure run: | cmake -S . --preset=${{ matrix.profile }} diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index 4fe4511..88368ca 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -133,6 +133,24 @@ jobs: generator: Ninja coverage: OFF download_qt: OFF + - name: ubuntu-24.04-arm-clang + os: ubuntu-24.04-arm + build_type: Release + cppcompiler: clang++ + ccompiler: clang + clang-tidy: clang-tidy + generator: Ninja + coverage: OFF + download_qt: OFF + - name: ubuntu-24.04-arm-gcc + os: ubuntu-24.04-arm + build_type: Release + cppcompiler: g++ + ccompiler: gcc + clang-tidy: clang-tidy + generator: Ninja + coverage: OFF + download_qt: OFF env: CXX: ${{ matrix.cppcompiler }} @@ -177,7 +195,7 @@ jobs: - name: Set conan compiler env run: conan profile detect - name: conan install - run: conan install . --build=missing --settings=build_type=${{ matrix.build_type }} --settings=compiler.cppstd=17 + run: conan install . --build=missing --settings build_type=${{ matrix.build_type }} --settings compiler.cppstd=17 - name: CMake configure run: | cmake -S . -B ./build -G "${{ matrix.generator }}" \ diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 53c6ee2..03c7746 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -21,20 +21,29 @@ jobs: build_type: Release cppcompiler: clang++ ccompiler: clang + libcxx: libc++ + generators: Ninja + - name: macOS-15-intel-clang + os: macos-15-intel + build_type: Release + cppcompiler: clang++ + ccompiler: clang + libcxx: libc++ generators: Ninja - name: macOS-14-clang os: macOS-14 build_type: Release cppcompiler: clang++ ccompiler: clang + libcxx: libc++ generators: Ninja - name: macOS-15-clang os: macOS-15 build_type: Release cppcompiler: clang++ ccompiler: clang + libcxx: libc++ generators: Ninja - env: CXX: ${{ matrix.cppcompiler }} CC: ${{ matrix.ccompiler }} @@ -63,7 +72,7 @@ jobs: - name: Set conan compiler env run: conan profile detect - name: conan install - run: conan install . --build=missing --settings=build_type=${{ matrix.build_type }} + run: conan install . --build=missing --settings build_type=${{ matrix.build_type }} --settings compiler.libcxx=${{ matrix.libcxx }} - name: CMake configure run: | cmake -S . -B ./build -G "${{ matrix.generators }}" \ diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index a41a452..588d2a1 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -42,7 +42,7 @@ jobs: - name: Set conan compiler env run: conan profile detect - name: conan install - run: conan install . --build=missing --settings=build_type=Release --settings=compiler.cppstd=17 + run: conan install . --build=missing --settings build_type=Release --settings compiler.cppstd=17 - name: CMake configure run: | cmake -S . --preset=linux-gcc-release diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index b382c65..bb46403 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -22,13 +22,27 @@ jobs: cppcompiler: cl ccompiler: cl generators: Visual Studio 17 2022 + arch: x64 + qt-host: windows + qt-arch: win64_msvc2022_64 - name: windows-2025-VS-2022 os: windows-2025 build_type: Release cppcompiler: cl ccompiler: cl generators: Visual Studio 17 2022 - + arch: x64 + qt-host: windows + qt-arch: win64_msvc2022_64 + - name: windows-11-arm-VS-2022 + os: windows-11-arm + build_type: Release + cppcompiler: cl + ccompiler: cl + generators: Visual Studio 17 2022 + arch: arm64 + qt-host: windows_arm64 + qt-arch: win64_msvc2022_arm64 env: CXX: ${{ matrix.cppcompiler }} CC: ${{ matrix.ccompiler }} @@ -50,19 +64,25 @@ jobs: uses: jurplel/install-qt-action@v4 with: version: 6.8.3 - host: windows + host: ${{ matrix.qt-host }} target: desktop - arch: win64_msvc2022_64 + arch: ${{ matrix.qt-arch }} modules: qtcharts + - name: Install Qt ifw + uses: jurplel/install-qt-action@v4 + if: matrix.qt-host == 'windows' + with: + host: windows + target: desktop tools: tools_ifw - name: setup-msvc-dev uses: TheMrMilchmann/setup-msvc-dev@v3 with: - arch: x64 + arch: ${{ matrix.arch }} - name: Set conan compiler env run: conan profile detect - name: conan install - run: conan install . --build=missing --settings=build_type=${{ matrix.build_type }} --settings=compiler.cppstd=17 + run: conan install . --build=missing --settings build_type=${{ matrix.build_type }} --settings compiler.cppstd=17 - name: CMake configure run: | cmake -S . -B ./build -G "${{ matrix.generators }}" diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 4a0e194..ff33343 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -41,13 +41,13 @@ jobs: ccache-${{ matrix.name }} - uses: cachix/install-nix-action@v27 with: - nix_path: nixpkgs=channel:nixos-24.11 + nix_path: nixpkgs=channel:nixos-25.05 - uses: cachix/cachix-action@v15 with: name: bbvch authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - run: | - nix-shell --command "conan profile detect" - nix-shell --command "conan install . --build=missing --settings=build_type=Debug" + nix-shell --command "source venv/bin/activate && conan profile detect" + nix-shell --command "source venv/bin/activate && conan install . --build=missing --settings build_type=Debug" nix-shell --command "cmake -S ${GITHUB_WORKSPACE} --preset=${{ matrix.configure_preset }}" nix-shell --command "cmake --build --preset=${{ matrix.build_preset }}" diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index 3a394eb..3c6b3f2 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -38,7 +38,6 @@ function(set_project_warnings project_name) ) set(CLANG_WARNINGS - -march=native -Wall -Wextra # reasonable and standard -Wshadow # warn the user if a variable declaration shadows one from a diff --git a/cmake/StaticAnalyzers.cmake b/cmake/StaticAnalyzers.cmake index 3a591cd..93c8968 100644 --- a/cmake/StaticAnalyzers.cmake +++ b/cmake/StaticAnalyzers.cmake @@ -23,8 +23,17 @@ endif() function(enable_static_analysis project_name) if(ENABLE_CPPCHECK) - set(CPPCHECK_PROPERTIES "${CPPCHECK}" "--suppress=missingInclude" "--enable=all" "--std=c++17" "--inline-suppr" - "--inconclusive" + set(CPPCHECK_PROPERTIES + "${CPPCHECK}" + "--enable=all" + "--disable=unusedFunction" + "--suppress=functionStatic" + "--suppress=missingIncludeSystem" + "--suppress=checkersReport" + "--std=c++17" + "--inline-suppr" + "--inconclusive" + "--check-level=exhaustive" ) set_target_properties(${project_name} PROPERTIES CXX_CPPCHECK "${CPPCHECK_PROPERTIES}") message(STATUS "cppcheck static analysis enabled for ${project_name} (cppcheck: ${CPPCHECK})") diff --git a/nix/nix-lock.toml b/nix/nix-lock.toml index f11e8a6..f2d0a82 100644 --- a/nix/nix-lock.toml +++ b/nix/nix-lock.toml @@ -1,7 +1,7 @@ [nixpkgs] -ref = "25.05" -rev = "11cb3517b3af6af300dd6c055aeda73c9bf52c48" -sha256 = "1915r28xc4znrh2vf4rrjnxldw2imysz819gzhk9qlrkqanmfsxd" +ref = "24.11" +rev = "63dacb46bf939521bdc93981b4cbb7ecb58427a0" +sha256 = "1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx" [cmake] ref = "3.31.10" diff --git a/nix/shell.nix b/nix/shell.nix index 11357d4..73bb969 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -2,7 +2,7 @@ with (import ./sources.nix); with nixpkgs; let gcc = gcc14; - clang = clang_19; + clang = clang_18; cmake_331 = (import ./cmake.nix).cmake; in stdenvNoCC.mkDerivation { @@ -43,7 +43,7 @@ in stdenvNoCC.mkDerivation { shellHook = '' pre-commit install -f --hook-type pre-commit virtualenv venv - source venv/bin/activate - python3 -m pip install -r py-requirements.txt + venv/bin/python3 -m pip install conan + venv/bin/python3 -m pip install python-dateutil ''; } From d379f3c0a334fe5e5514432bd5f6ed14c9a1b88f Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 21:05:09 +0000 Subject: [PATCH 09/16] updated tasks.json --- .vscode/tasks.json | 170 +++++++++++++++++++++++++++++++++------------ 1 file changed, 125 insertions(+), 45 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 77e91bc..152d8ae 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,55 +1,135 @@ { "version": "2.0.0", "tasks": [ - { - "label": "build", - "command": "cmake --build build", - "group": { - "kind": "build", - "isDefault": true + { + "label": "conan install", + "command": "conan", + "args": [ + "install", + ".", + "--build=missing", + "--settings", + "build_type=${input:buildType}", + "--settings", + "compiler=${input:compiler}", + "--settings", + "compiler.version=${input:compilerversion}", + "--settings", + "compiler.cppstd=gnu17", + "--settings", + "compiler.libcxx=libstdc++11", + "--update" + ], + "group": { + "kind": "build", + "isDefault": false + }, + "options": { + "cwd": "${workspaceFolder}/" + }, + "type": "shell", + "presentation": { + "clear": true + } }, - "problemMatcher": { - "base": "$gcc" + { + "label": "build", + "command": "cmake --build build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": { + "base": "$gcc" + }, + "options": { + "cwd": "${workspaceFolder}/" + }, + "type": "shell", + "presentation": { + "clear": true + } }, - "options": { - "cwd": "${workspaceFolder}/" + { + "label": "clean", + "command": "/usr/bin/rm -rf build", + "group": "build", + "problemMatcher": [], + "type": "shell" }, - "type": "shell", - "presentation": { - "clear": true + { + "label": "unittests", + "command": "cmake --build --preset=run-unittests", + "group": { + "isDefault": true, + "kind": "test" + }, + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [], + "type": "shell" + }, + { + "label": "format files", + "command": "./format_source_files.sh", + "problemMatcher": [], + "type": "shell" + }, + { + "label": "run pre-commit hooks", + "command": "pre-commit run --all-files", + "problemMatcher": [], + "type": "shell" } - }, - { - "label": "clean", - "command": "/usr/bin/rm -rf build", - "group": "build", - "problemMatcher": [], - "type": "shell" - }, - { - "label": "unittests", - "command": "cmake --build --preset=run-unittests", - "group": { - "isDefault": true, - "kind": "test" + ], + "inputs": [ + { + "id": "buildType", + "type": "pickString", + "description": "Choose an option", + "options": [ + "Debug", + "Release" + ] }, - "options": { - "cwd": "${workspaceFolder}" + { + "id": "compiler", + "type": "pickString", + "description": "Choose an option", + "options": [ + { + "label": "GCC", + "value": "gcc" + }, + { + "label": "Clang", + "value": "clang" + } + ] }, - "problemMatcher": [], - "type": "shell" - }, - { - "label": "format files", - "command": "./format_source_files.sh", - "problemMatcher": [], - "type": "shell" - }, - { - "label": "run pre-commit hooks", - "command": "pre-commit run --all-files", - "problemMatcher": [], - "type": "shell" - } + { + "id": "compilerversion", + "type": "pickString", + "description": "Choose an option", + "options": [ + { + "label": "13 (gcc)", + "value": "13" + }, + { + "label": "14 (gcc)", + "value": "14" + }, + { + "label": "18 (clang)", + "value": "18" + }, + { + "label": "19 (clang)", + "value": "19" + } + ] + } ] - } +} From 264aa1e3fcb1f9c534f54235000f54e960d1b08f Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 21:05:24 +0000 Subject: [PATCH 10/16] fixed presets.json --- CMakePresets.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index b7385da..3decfdd 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -119,8 +119,8 @@ }, { "name": "linux-gcc-release", - "displayName": "Release (gcc)", - "description": "Configure Release (gcc)", + "displayName": "Release (gnu)", + "description": "Configure Release (gnu)", "hidden": false, "inherits": [ "linux-gcc", From ce2d86c78b189e3f1a23f03e2fad5bec96f66cb4 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 21:06:00 +0000 Subject: [PATCH 11/16] updated/fixed README --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 06095da..b69940e 100644 --- a/README.md +++ b/README.md @@ -26,12 +26,12 @@ [![codecov](https://codecov.io/gh/bbvch/Coronan/branch/master/graph/badge.svg)](https://codecov.io/gh/bbvch/Coronan) -[![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-dark.svg)](https://sonarcloud.io/summary/new_code?id=bbvch_Coronan) +[![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-dark.svg)](https://sonarcloud.io/summary/overall?id=bbvch_Coronann) -[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=bugs)](https://sonarcloud.io/summary/new_code?id=bbvch_Coronan) -[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=bbvch_Coronan) -[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=coverage)](https://sonarcloud.io/summary/new_code?id=bbvch_Coronan) -[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=bbvch_Coronan) +[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=bugs)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) +[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=code_smells)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=coverage)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) +[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=duplicated_lines_density)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) @@ -200,7 +200,7 @@ You can also build it yourself using CMake and conan * __Install dependencies with conan__ ```bash - conan install . --build=missing --settings=build_type=Debug + conan install . --build=missing --settings build_type=Debug ``` Because the conan [cmake_layout](https://docs.conan.io/2/reference/tools/cmake/cmake_layout.html#) and the [`CMakeDeps`](https://docs.conan.io/2/reference/tools/cmake/cmakedeps.html) generator is used, the necessary cmake files used with `find_packages()` are generated into `build\\generators`. `CMAKE_PREFIX_PATH` is adapted accordingly in the root `CMakeLists.txt`. @@ -285,7 +285,7 @@ To start right away without installing anything on your local machine, you can s ## direnv & nix -If you have [direnv](https://direnv.net/) and [nix](https://nixos.org/) installed everything should be setup to start upon entering the project folder, if `use nix` is not commented out in [.envrc](.envrc). gcc (gcc14) is set as default C and C++ compiler. If you prefer clang (clang_18) change it in [.envrc](.envrc) +If you have [direnv](https://direnv.net/) and [nix](https://nixos.org/) installed everything should be setup to start upon entering the project folder, if `use nix` is not commented out in [.envrc](.envrc). gcc (gcc14) is set as default C and C++ compiler. If you prefer clang (clang-19) change it in [.envrc](.envrc) You can also use `nix-shell` directly to build when `use nix` is disabled, e.g.: From 7422fb97ccc9886e290f7f681e6cef5f46857480 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Mon, 24 Nov 2025 23:55:17 +0000 Subject: [PATCH 12/16] changed header file suffix to .h (Core Guideline recommendation) --- .gitignore | 1 - apps/cli/CMakeLists.txt | 2 +- apps/cli/src/argument_parser.cpp | 2 +- .../src/{argument_parser.hpp => argument_parser.h} | 0 apps/cli/src/main.cpp | 10 +++++----- apps/cli/tests/argument_parser_test.cpp | 2 +- apps/qt/CMakeLists.txt | 7 ++++--- apps/qt/country_chart_view.cpp | 4 ++-- apps/qt/country_data_model.cpp | 2 +- apps/qt/country_overview_table_model.cpp | 2 +- .../{country_chart_view.hpp => country_chart_view.h} | 0 .../{country_data_model.hpp => country_data_model.h} | 2 +- ...able_model.hpp => country_overview_table_model.h} | 2 +- apps/qt/include/mainwindow.h | 6 +++--- apps/qt/main.cpp | 6 +++--- apps/qt/mainwindow.cpp | 4 ++-- configured_files/CMakeLists.txt | 8 +++++++- configured_files/{config.hpp.in => version.h.in} | 3 +++ coronan.code-workspace | 2 +- format_source_files.sh | 2 +- .../{corona-api_client.hpp => corona-api_client.h} | 6 +++--- ...rona-api_datatypes.hpp => corona-api_datatypes.h} | 0 .../{corona-api_parser.hpp => corona-api_parser.h} | 2 +- include/coronan/{http_client.hpp => http_client.h} | 0 include/coronan/{ssl_client.hpp => ssl_client.h} | 0 include/coronan/{ssl_context.hpp => ssl_context.h} | 0 src/CMakeLists.txt | 12 ++++++------ src/corona-api_parser.cpp | 2 +- src/http_client.cpp | 2 +- src/ssl_client.cpp | 4 ++-- src/ssl_context-linux.cpp | 2 +- src/ssl_context-win.cpp | 2 +- tests/corona-api_client_test.cpp | 2 +- tests/corona-api_json_parser_test.cpp | 2 +- tests/http_client_test.cpp | 2 +- 35 files changed, 57 insertions(+), 48 deletions(-) rename apps/cli/src/{argument_parser.hpp => argument_parser.h} (100%) rename apps/qt/include/{country_chart_view.hpp => country_chart_view.h} (100%) rename apps/qt/include/{country_data_model.hpp => country_data_model.h} (97%) rename apps/qt/include/{country_overview_table_model.hpp => country_overview_table_model.h} (96%) rename configured_files/{config.hpp.in => version.h.in} (90%) rename include/coronan/{corona-api_client.hpp => corona-api_client.h} (98%) rename include/coronan/{corona-api_datatypes.hpp => corona-api_datatypes.h} (100%) rename include/coronan/{corona-api_parser.hpp => corona-api_parser.h} (97%) rename include/coronan/{http_client.hpp => http_client.h} (100%) rename include/coronan/{ssl_client.hpp => ssl_client.h} (100%) rename include/coronan/{ssl_context.hpp => ssl_context.h} (100%) diff --git a/.gitignore b/.gitignore index 0aa8af6..833f0d5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,5 @@ docs/conf.py CMakeFiles/* .cache/* CMakeUserPresets.json -include/coronan/config.hpp .github/workflows/ci-windows.yml .venv/ diff --git a/apps/cli/CMakeLists.txt b/apps/cli/CMakeLists.txt index 6554ddf..bd3fdfe 100644 --- a/apps/cli/CMakeLists.txt +++ b/apps/cli/CMakeLists.txt @@ -6,7 +6,7 @@ project( LANGUAGES CXX ) -set(HEADER_LIST "${CMAKE_CURRENT_LIST_DIR}/src/argument_parser.hpp") +set(HEADER_LIST "${CMAKE_CURRENT_LIST_DIR}/src/argument_parser.h") add_library(cli_arg_parser STATIC ${CMAKE_CURRENT_LIST_DIR}/src/argument_parser.cpp ${HEADER_LIST}) diff --git a/apps/cli/src/argument_parser.cpp b/apps/cli/src/argument_parser.cpp index 5e96674..994ce8c 100644 --- a/apps/cli/src/argument_parser.cpp +++ b/apps/cli/src/argument_parser.cpp @@ -1,4 +1,4 @@ -#include "argument_parser.hpp" +#include "argument_parser.h" #include #include diff --git a/apps/cli/src/argument_parser.hpp b/apps/cli/src/argument_parser.h similarity index 100% rename from apps/cli/src/argument_parser.hpp rename to apps/cli/src/argument_parser.h diff --git a/apps/cli/src/main.cpp b/apps/cli/src/main.cpp index c3d92a4..47a8661 100644 --- a/apps/cli/src/main.cpp +++ b/apps/cli/src/main.cpp @@ -1,8 +1,8 @@ -#include "argument_parser.hpp" -#include "coronan/corona-api_client.hpp" -#include "coronan/corona-api_datatypes.hpp" -#include "coronan/http_client.hpp" -#include "coronan/ssl_client.hpp" +#include "argument_parser.h" +#include "coronan/corona-api_client.h" +#include "coronan/corona-api_datatypes.h" +#include "coronan/http_client.h" +#include "coronan/ssl_client.h" #include #include diff --git a/apps/cli/tests/argument_parser_test.cpp b/apps/cli/tests/argument_parser_test.cpp index 4678de7..605b388 100644 --- a/apps/cli/tests/argument_parser_test.cpp +++ b/apps/cli/tests/argument_parser_test.cpp @@ -1,4 +1,4 @@ -#include "argument_parser.hpp" +#include "argument_parser.h" #include #include diff --git a/apps/qt/CMakeLists.txt b/apps/qt/CMakeLists.txt index ee84952..423349e 100644 --- a/apps/qt/CMakeLists.txt +++ b/apps/qt/CMakeLists.txt @@ -43,9 +43,9 @@ set(CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/${relDir}) message(STATUS "CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH}") set(HEADER_LIST - "${CMAKE_CURRENT_SOURCE_DIR}/include/country_overview_table_model.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/include/country_data_model.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/include/country_chart_view.hpp" "${CMAKE_CURRENT_SOURCE_DIR}/include/mainwindow.h" + "${CMAKE_CURRENT_SOURCE_DIR}/include/country_overview_table_model.h" + "${CMAKE_CURRENT_SOURCE_DIR}/include/country_data_model.h" + "${CMAKE_CURRENT_SOURCE_DIR}/include/country_chart_view.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/mainwindow.h" ) # AUTOMOC and AUTOUIC dows not work when Qt is built from source if(DOWNLOAD_QT6) @@ -80,6 +80,7 @@ target_link_libraries( PRIVATE coronan::library PRIVATE coronan::compile_warnings PRIVATE coronan::compile_options + PRIVATE coronan::version ) # include(StaticAnalyzers) enable_static_analysis(${PROJECT_NAME}) diff --git a/apps/qt/country_chart_view.cpp b/apps/qt/country_chart_view.cpp index 249dc57..cfd1491 100644 --- a/apps/qt/country_chart_view.cpp +++ b/apps/qt/country_chart_view.cpp @@ -1,6 +1,6 @@ -#include "country_chart_view.hpp" +#include "country_chart_view.h" -#include "country_data_model.hpp" +#include "country_data_model.h" #include #include diff --git a/apps/qt/country_data_model.cpp b/apps/qt/country_data_model.cpp index 0dd4c7e..ba3bcb1 100644 --- a/apps/qt/country_data_model.cpp +++ b/apps/qt/country_data_model.cpp @@ -1,4 +1,4 @@ -#include "country_data_model.hpp" +#include "country_data_model.h" namespace { inline constexpr auto columns = 5u; diff --git a/apps/qt/country_overview_table_model.cpp b/apps/qt/country_overview_table_model.cpp index ae9fb11..4f1c2be 100644 --- a/apps/qt/country_overview_table_model.cpp +++ b/apps/qt/country_overview_table_model.cpp @@ -1,4 +1,4 @@ -#include "country_overview_table_model.hpp" +#include "country_overview_table_model.h" #include #include diff --git a/apps/qt/include/country_chart_view.hpp b/apps/qt/include/country_chart_view.h similarity index 100% rename from apps/qt/include/country_chart_view.hpp rename to apps/qt/include/country_chart_view.h diff --git a/apps/qt/include/country_data_model.hpp b/apps/qt/include/country_data_model.h similarity index 97% rename from apps/qt/include/country_data_model.hpp rename to apps/qt/include/country_data_model.h index 627080c..ec0f794 100644 --- a/apps/qt/include/country_data_model.hpp +++ b/apps/qt/include/country_data_model.h @@ -1,6 +1,6 @@ #pragma once -#include "coronan/corona-api_datatypes.hpp" +#include "coronan/corona-api_datatypes.h" #include #include diff --git a/apps/qt/include/country_overview_table_model.hpp b/apps/qt/include/country_overview_table_model.h similarity index 96% rename from apps/qt/include/country_overview_table_model.hpp rename to apps/qt/include/country_overview_table_model.h index 8067608..408fcf7 100644 --- a/apps/qt/include/country_overview_table_model.hpp +++ b/apps/qt/include/country_overview_table_model.h @@ -1,6 +1,6 @@ #pragma once -#include "coronan/corona-api_datatypes.hpp" +#include "coronan/corona-api_datatypes.h" #include #include diff --git a/apps/qt/include/mainwindow.h b/apps/qt/include/mainwindow.h index 980b8e2..94909ac 100644 --- a/apps/qt/include/mainwindow.h +++ b/apps/qt/include/mainwindow.h @@ -1,7 +1,7 @@ #pragma once -#include "coronan/corona-api_datatypes.hpp" -#include "country_data_model.hpp" -#include "country_overview_table_model.hpp" +#include "coronan/corona-api_datatypes.h" +#include "country_data_model.h" +#include "country_overview_table_model.h" #include #include diff --git a/apps/qt/main.cpp b/apps/qt/main.cpp index b6fce9a..f6e858e 100644 --- a/apps/qt/main.cpp +++ b/apps/qt/main.cpp @@ -1,6 +1,6 @@ -#include "coronan/config.hpp" -#include "coronan/http_client.hpp" -#include "coronan/ssl_client.hpp" +#include "coronan/http_client.h" +#include "coronan/ssl_client.h" +#include "coronan/version.h" #include "mainwindow.h" #include diff --git a/apps/qt/mainwindow.cpp b/apps/qt/mainwindow.cpp index 3d81566..b1e4895 100644 --- a/apps/qt/mainwindow.cpp +++ b/apps/qt/mainwindow.cpp @@ -1,7 +1,7 @@ #include "mainwindow.h" -#include "coronan/corona-api_client.hpp" -#include "country_chart_view.hpp" +#include "coronan/corona-api_client.h" +#include "country_chart_view.h" #include "ui_mainwindow.h" #include diff --git a/configured_files/CMakeLists.txt b/configured_files/CMakeLists.txt index f1c029b..017a9e6 100644 --- a/configured_files/CMakeLists.txt +++ b/configured_files/CMakeLists.txt @@ -1 +1,7 @@ -configure_file("config.hpp.in" "${CMAKE_CURRENT_LIST_DIR}/../include/coronan/config.hpp" ESCAPE_QUOTES) +configure_file("version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/generated/coronan/version.h" ESCAPE_QUOTES) + +add_library(coronan-version INTERFACE) + +add_library(coronan::version ALIAS coronan-version) + +target_include_directories(coronan-version INTERFACE ${CMAKE_CURRENT_BINARY_DIR}/generated) diff --git a/configured_files/config.hpp.in b/configured_files/version.h.in similarity index 90% rename from configured_files/config.hpp.in rename to configured_files/version.h.in index e76dd88..ad0a52b 100644 --- a/configured_files/config.hpp.in +++ b/configured_files/version.h.in @@ -1,5 +1,8 @@ #pragma once +// Generated by CMake. Do not edit. +#pragma once + // Generated by CMake. Do not edit. #include diff --git a/coronan.code-workspace b/coronan.code-workspace index 77f1f7b..1247e55 100644 --- a/coronan.code-workspace +++ b/coronan.code-workspace @@ -37,7 +37,7 @@ "[cpp]": { "editor.defaultFormatter": "xaver.clang-format" }, - "editor.formatOnSave": true, + "editor.formatOnSave": false, "editor.inlayHints.enabled": "offUnlessPressed", "editor.quickSuggestions": { "other": true, diff --git a/format_source_files.sh b/format_source_files.sh index 9ef9145..aee14ce 100755 --- a/format_source_files.sh +++ b/format_source_files.sh @@ -4,5 +4,5 @@ set -e SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -find "${SELF_DIR}" -name '*.hpp' -o -name '*.h' -o -name '*.cpp' | xargs clang-format -i -style=file +find "${SELF_DIR}" -name '*.h' -o -name '*.h' -o -name '*.cpp' | xargs clang-format -i -style=file find "${SELF_DIR}" -name 'CMakeLists.txt' -o -name '*.cmake' | xargs cmake-format -i diff --git a/include/coronan/corona-api_client.hpp b/include/coronan/corona-api_client.h similarity index 98% rename from include/coronan/corona-api_client.hpp rename to include/coronan/corona-api_client.h index fe23d6f..a302046 100644 --- a/include/coronan/corona-api_client.hpp +++ b/include/coronan/corona-api_client.h @@ -1,8 +1,8 @@ #pragma once -#include "coronan/corona-api_parser.hpp" -#include "coronan/http_client.hpp" -#include "coronan/ssl_client.hpp" +#include "coronan/corona-api_parser.h" +#include "coronan/http_client.h" +#include "coronan/ssl_client.h" #include #include diff --git a/include/coronan/corona-api_datatypes.hpp b/include/coronan/corona-api_datatypes.h similarity index 100% rename from include/coronan/corona-api_datatypes.hpp rename to include/coronan/corona-api_datatypes.h diff --git a/include/coronan/corona-api_parser.hpp b/include/coronan/corona-api_parser.h similarity index 97% rename from include/coronan/corona-api_parser.hpp rename to include/coronan/corona-api_parser.h index ff81e56..136294d 100644 --- a/include/coronan/corona-api_parser.hpp +++ b/include/coronan/corona-api_parser.h @@ -1,6 +1,6 @@ #pragma once -#include "coronan/corona-api_datatypes.hpp" +#include "coronan/corona-api_datatypes.h" #include #include diff --git a/include/coronan/http_client.hpp b/include/coronan/http_client.h similarity index 100% rename from include/coronan/http_client.hpp rename to include/coronan/http_client.h diff --git a/include/coronan/ssl_client.hpp b/include/coronan/ssl_client.h similarity index 100% rename from include/coronan/ssl_client.hpp rename to include/coronan/ssl_client.h diff --git a/include/coronan/ssl_context.hpp b/include/coronan/ssl_context.h similarity index 100% rename from include/coronan/ssl_context.hpp rename to include/coronan/ssl_context.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b942033..cd98165 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,12 +7,12 @@ project( ) set(HEADER_LIST - "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/http_client.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/corona-api_datatypes.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/corona-api_parser.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/corona-api_client.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/ssl_client.hpp" - "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/ssl_context.hpp" + "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/http_client.h" + "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/corona-api_datatypes.h" + "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/corona-api_parser.h" + "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/corona-api_client.h" + "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/ssl_client.h" + "${CMAKE_CURRENT_SOURCE_DIR}/../include/coronan/ssl_context.h" ) add_library(coronan STATIC ${HEADER_LIST}) diff --git a/src/corona-api_parser.cpp b/src/corona-api_parser.cpp index 720a2f6..36f32c7 100644 --- a/src/corona-api_parser.cpp +++ b/src/corona-api_parser.cpp @@ -1,4 +1,4 @@ -#include "coronan/corona-api_parser.hpp" +#include "coronan/corona-api_parser.h" #include #include diff --git a/src/http_client.cpp b/src/http_client.cpp index b77e0bd..15b68a1 100644 --- a/src/http_client.cpp +++ b/src/http_client.cpp @@ -1,4 +1,4 @@ -#include "coronan/http_client.hpp" +#include "coronan/http_client.h" #include namespace coronan { diff --git a/src/ssl_client.cpp b/src/ssl_client.cpp index eb82d08..45f1ed3 100644 --- a/src/ssl_client.cpp +++ b/src/ssl_client.cpp @@ -1,7 +1,7 @@ -#include "coronan/ssl_client.hpp" +#include "coronan/ssl_client.h" -#include "coronan/ssl_context.hpp" +#include "coronan/ssl_context.h" #include #include diff --git a/src/ssl_context-linux.cpp b/src/ssl_context-linux.cpp index 7a6dd06..a7462b0 100644 --- a/src/ssl_context-linux.cpp +++ b/src/ssl_context-linux.cpp @@ -1,4 +1,4 @@ -#include "coronan/ssl_context.hpp" +#include "coronan/ssl_context.h" #include diff --git a/src/ssl_context-win.cpp b/src/ssl_context-win.cpp index ff12def..b11ae96 100644 --- a/src/ssl_context-win.cpp +++ b/src/ssl_context-win.cpp @@ -1,4 +1,4 @@ -#include "coronan/ssl_context.hpp" +#include "coronan/ssl_context.h" namespace coronan::ssl_context { diff --git a/tests/corona-api_client_test.cpp b/tests/corona-api_client_test.cpp index 456ec93..178edfc 100644 --- a/tests/corona-api_client_test.cpp +++ b/tests/corona-api_client_test.cpp @@ -1,4 +1,4 @@ -#include "coronan/corona-api_client.hpp" +#include "coronan/corona-api_client.h" #include #include diff --git a/tests/corona-api_json_parser_test.cpp b/tests/corona-api_json_parser_test.cpp index 2c15d58..29469e8 100644 --- a/tests/corona-api_json_parser_test.cpp +++ b/tests/corona-api_json_parser_test.cpp @@ -1,4 +1,4 @@ -#include "coronan/corona-api_parser.hpp" +#include "coronan/corona-api_parser.h" #include diff --git a/tests/http_client_test.cpp b/tests/http_client_test.cpp index e7cf63f..da57b45 100644 --- a/tests/http_client_test.cpp +++ b/tests/http_client_test.cpp @@ -1,4 +1,4 @@ -#include "coronan/http_client.hpp" +#include "coronan/http_client.h" #include #include From 285d43a9dafaea30c9af4cc8d78654defa7df196 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Wed, 26 Nov 2025 20:56:49 +0100 Subject: [PATCH 13/16] ci: fixed qt path on appveyor --- .github/workflows/sonarqube-scan.yml | 6 +++--- README.md | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sonarqube-scan.yml b/.github/workflows/sonarqube-scan.yml index a125252..cc0829c 100644 --- a/.github/workflows/sonarqube-scan.yml +++ b/.github/workflows/sonarqube-scan.yml @@ -59,17 +59,17 @@ jobs: - name: CMake configure run: cmake -S . -B ./build -G Ninja -DENABLE_COVERAGE=${{ env.WITH_COVERAGE }} -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} - name: Run Build Wrapper - run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} cmake --build build/ --config ${{ env.BUILD_TYPE }} + run: build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} ninja -C ./build - name: Collect coverage into one XML report if: env.WITH_COVERAGE == 'ON' run: | gcovr --sonarqube > coverage.xml - name: SonarQube Scan - uses: SonarSource/sonarqube-scan-action@v4 + uses: sonarsource/sonarqube-scan-action@v6 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on SonarQube, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) with: # Additional arguments for the sonarcloud scanner args: > - --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" + --define sonar.cfamily.compile-commands=${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json --define sonar.coverageReportPaths=coverage.xml diff --git a/README.md b/README.md index b69940e..0cf6e1b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ [![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-dark.svg)](https://sonarcloud.io/summary/overall?id=bbvch_Coronann) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=alert_status)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=bugs)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=code_smells)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=coverage)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) From 85490cd6b71c5a848a22b185c12e4ce93ca15753 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Wed, 26 Nov 2025 21:53:18 +0100 Subject: [PATCH 14/16] ci: fixed qt path on appveyor --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d1d00dc..493e2ee 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,12 +10,11 @@ cache: environment: PYTHON: c:\Python39-x64\python.exe - Qt6_DIR: c:\Qt\6.8.1\msvc2022_64 + Qt6_DIR: c:\Qt\6.9.3\msvc2022_64 install: - cmd: |- choco install doxygen.install - choco install qt6-base-dev set PATH=%PATH%;C:\Users\appveyor\AppData\Roaming\Python\Python39\Scripts "%PYTHON%" -m pip install --user -r %APPVEYOR_BUILD_FOLDER%\py-requirements.txt conan profile detect From 00f990e0d8bab4d16e357272bc4805a967890798 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Wed, 11 Mar 2026 00:31:48 +0100 Subject: [PATCH 15/16] clean-up dockerfile --- .devcontainer/Dockerfile | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 0a09ad4..8c8a1bd 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -12,20 +12,11 @@ RUN apt-get update \ && apt-get -qq install -y --no-install-recommends \ make \ build-essential \ - ninja-build \ cmake \ - ccache \ - clang-18 \ - clang-tidy-18 \ - clang-format-18 \ - clangd-18 \ dpkg \ pkg-config \ - doxygen \ - lcov \ git \ python3-full \ - gcc-14 \ file \ ssh-client \ && apt-get clean \ From 8bacd20d0d9b0e1228b94935f37095e9e084b190 Mon Sep 17 00:00:00 2001 From: Michel Estermann Date: Thu, 12 Mar 2026 00:16:13 +0100 Subject: [PATCH 16/16] Added more pre-commit hooks --- .clang-format | 1 - .cmake-format.yaml | 82 -- .devcontainer/devcontainer.json | 110 +-- ...x-sanatizer.yml => ci-linux-sanitizer.yml} | 2 +- .markdownlint.yaml | 9 + .pre-commit-config.yaml | 53 +- .vscode/c_cpp_properties.json | 32 +- .vscode/extensions.json | 30 +- .vscode/launch.json | 70 +- .vscode/settings.json | 30 +- .vscode/tasks.json | 244 ++--- CMakePresets.json | 892 +++++++++--------- README.md | 228 +++-- apps/cli/src/argument_parser.cpp | 2 +- apps/cli/tests/argument_parser_test.cpp | 44 +- apps/qt/CMakeLists.txt | 2 +- apps/qt/cmake/Qt.cmake | 1 - apps/qt/country_data_model.cpp | 4 +- apps/qt/main.cpp | 4 +- apps/qt/mainwindow.cpp | 2 +- build.sh | 21 +- cmake/CPackConfig.cmake | 6 +- cmake/Doxygen.cmake | 2 +- docs/CMakeLists.txt | 2 +- format_source_files.sh | 6 +- include/coronan/corona-api_datatypes.h | 2 +- include/coronan/ssl_client.h | 4 +- tests/corona-api_json_parser_test.cpp | 2 +- typos.toml | 7 + 29 files changed, 937 insertions(+), 957 deletions(-) rename .github/workflows/{ci-linux-sanatizer.yml => ci-linux-sanitizer.yml} (99%) create mode 100644 .markdownlint.yaml create mode 100644 typos.toml diff --git a/.clang-format b/.clang-format index e27e485..c3c6278 100644 --- a/.clang-format +++ b/.clang-format @@ -1,5 +1,4 @@ --- -Language: Cpp # BasedOnStyle: LLVM AccessModifierOffset: -2 AlignAfterOpenBracket: Align diff --git a/.cmake-format.yaml b/.cmake-format.yaml index 33e4f28..dc81638 100644 --- a/.cmake-format.yaml +++ b/.cmake-format.yaml @@ -1,92 +1,10 @@ --- parse: additional_commands: - _add_layer_library: - pargs: 2+ - kwargs: - FORBIDDEN: '*' - LINK_LIBS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - INCLUDE_DIRS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - add_infrastructure_library: - pargs: 2+ - kwargs: - LINK_LIBS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - INCLUDE_DIRS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - add_application_library: - pargs: 2+ - kwargs: - LINK_LIBS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - INCLUDE_DIRS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - add_domain_library: - pargs: 2+ - kwargs: - LINK_LIBS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - INCLUDE_DIRS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - add_libs_library: - pargs: 2+ - kwargs: - LINK_LIBS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - INCLUDE_DIRS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - add_utils_library: - pargs: 2+ - kwargs: - LINK_LIBS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - INCLUDE_DIRS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' - add_mock_library: - pargs: 2+ - kwargs: - MOCKS: '*' - add_interface_library: - pargs: 2 enable_coverage: pargs: 1 enable_doxygen: pargs: 1 - generate_arc42_documentation: - pargs: 1 - add_unit_test: - pargs: 2+ - kwargs: - LINK_LIBS: - kwargs: - PUBLIC: '*' - PRIVATE: '*' enable_sanitizers: pargs: 1 enable_static_analysis: diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 933ac77..46df28b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,56 +1,60 @@ { - "name": "C++ noVNC", - "build": { - "context": "..", - "dockerfile": "Dockerfile", - "args": { - "CLANG_VERSION": "19", - "GCC_VERSION": "14", - "BASE_IMAGE": "mcr.microsoft.com/devcontainers/base:ubuntu" - } - }, - "mounts": [ - "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind" - ], - "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/Coronan,type=bind", - "updateRemoteUserUID": true, - "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", - "postAttachCommand": "pre-commit install -f --hook-type pre-commit && conan profile detect --force", - "customizations": { - "vscode": { - "extensions": [ - "ms-vscode.cpptools", - "ms-vscode.cpptools-extension-pack", - "ms-vscode.cmake-tools", - "xaver.clang-format", - "ms-python.python", - "ms-python.autopep8", - "jeff-hykin.better-cpp-syntax", - "matepek.vscode-catch2-test-adapter", - "mhutchie.git-graph", - "cs128.cs128-clang-tidy", - "donjayamanne.githistory", - "webfreak.debug", - "jnoortheen.nix-ide", - "hbenl.vscode-test-explorer", - "ms-azuretools.vscode-docker", - "actboy168.tasks", - "streetsidesoftware.code-spell-checker", - "github.vscode-pull-request-github" - ] - } - }, - "features": { - "ghcr.io/devcontainers/features/nix:1": {}, - "ghcr.io/ChristopherMacGown/devcontainer-features/direnv:1": {} - }, - "forwardPorts": [ - 6080 - ], - "portsAttributes": { - "6080": { - "label": "noVNC", - "onAutoForward": "openPreview" - } + "name": "C++ noVNC", + "build": { + "context": "..", + "dockerfile": "Dockerfile", + "args": { + "CLANG_VERSION": "19", + "GCC_VERSION": "14", + "BASE_IMAGE": "mcr.microsoft.com/devcontainers/base:ubuntu" } + }, + "mounts": [ + "source=${localEnv:HOME}/.ssh,target=/home/vscode/.ssh,type=bind" + ], + "workspaceMount": "source=${localWorkspaceFolder},target=/workspaces/Coronan,type=bind", + "updateRemoteUserUID": true, + "postStartCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "postAttachCommand": "pre-commit install -f --hook-type pre-commit && conan profile detect --force", + "containerEnv": { + "DISPLAY": ":0" + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "ms-vscode.cmake-tools", + "xaver.clang-format", + "ms-python.python", + "ms-python.autopep8", + "jeff-hykin.better-cpp-syntax", + "matepek.vscode-catch2-test-adapter", + "mhutchie.git-graph", + "cs128.cs128-clang-tidy", + "donjayamanne.githistory", + "webfreak.debug", + "jnoortheen.nix-ide", + "hbenl.vscode-test-explorer", + "ms-azuretools.vscode-docker", + "actboy168.tasks", + "streetsidesoftware.code-spell-checker", + "github.vscode-pull-request-github" + ] + } + }, + "features": { + "ghcr.io/devcontainers/features/nix:1": {}, + "ghcr.io/ChristopherMacGown/devcontainer-features/direnv:1": {} + }, + "forwardPorts": [ + 5901, + 6080 + ], + "portsAttributes": { + "6080": { + "label": "noVNC", + "onAutoForward": "openPreview" + } + } } diff --git a/.github/workflows/ci-linux-sanatizer.yml b/.github/workflows/ci-linux-sanitizer.yml similarity index 99% rename from .github/workflows/ci-linux-sanatizer.yml rename to .github/workflows/ci-linux-sanitizer.yml index 2c068ec..8d7bac9 100644 --- a/.github/workflows/ci-linux-sanatizer.yml +++ b/.github/workflows/ci-linux-sanitizer.yml @@ -1,5 +1,5 @@ --- -name: Linux Sanatizer Builds +name: Linux Sanitizer Builds on: push: diff --git a/.markdownlint.yaml b/.markdownlint.yaml new file mode 100644 index 0000000..ee94d42 --- /dev/null +++ b/.markdownlint.yaml @@ -0,0 +1,9 @@ +--- +# Disable first-line-heading +MD041: false +# Disable line checking +MD013: false +# Disable checking for the multiple headings with the same content. +MD024: false +# Allow inline HTML, useful for positioning images. +MD033: false diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 64d532d..a8ccbeb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,31 +4,78 @@ repos: rev: v6.0.0 hooks: - id: check-added-large-files + stages: [pre-commit] - id: check-case-conflict + stages: [pre-commit] - id: check-merge-conflict + stages: [pre-commit] - id: check-symlinks + stages: [pre-commit] - id: check-yaml + stages: [pre-commit] - id: check-json + stages: [pre-commit] - id: check-toml + stages: [pre-commit] - id: check-executables-have-shebangs + stages: [pre-commit] + - id: check-shebang-scripts-are-executable + stages: [pre-commit] - id: end-of-file-fixer + stages: [pre-commit] - id: mixed-line-ending + stages: [pre-commit] - id: trailing-whitespace - - repo: https://github.com/pocc/pre-commit-hooks - rev: v1.3.5 + stages: [pre-commit] + args: [--markdown-linebreak-ext=md] + - id: detect-private-key + stages: [pre-commit] + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v22.1.0 hooks: - id: clang-format - args: [--style=file, -i] + stages: [pre-commit] - repo: https://github.com/iconmaster5326/cmake-format-pre-commit-hook rev: v0.6.13 hooks: - id: cmake-format + stages: [pre-commit] - repo: https://github.com/adrienverge/yamllint.git rev: v1.37.1 hooks: - id: yamllint + stages: [pre-commit] args: [--format, parsable, -d, relaxed] - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt rev: 0.2.3 hooks: - id: yamlfmt + stages: [pre-commit] + # typos uses typos.toml to find and fix typos + - repo: https://github.com/crate-ci/typos + rev: v1.44.0 + hooks: + - id: typos + stages: [pre-commit] + - repo: https://github.com/shellcheck-py/shellcheck-py + rev: v0.11.0.1 + hooks: + - id: shellcheck + stages: [pre-commit] + exclude: \.envrc + args: [--severity=warning] + - repo: https://github.com/scop/pre-commit-shfmt + rev: v3.12.0-2 + hooks: + - id: shfmt + stages: [pre-commit] + args: [--indent=4, --simplify, --write] + # markdownlint-cli uses .markdownlint.yaml to lint markdown files + - repo: https://github.com/igorshubovych/markdownlint-cli + rev: v0.48.0 + hooks: + - id: markdownlint-docker + stages: [pre-commit] + args: [--fix] + +default_install_hook_types: [pre-commit] diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 3e0a481..a2b19d9 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -1,18 +1,18 @@ { - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**" - ], - "defines": [], - "compilerPath": "/usr/bin/clang", - "cStandard": "c17", - "cppStandard": "c++17", - "intelliSenseMode": "linux-clang-x64", - "compileCommands": "${workspaceFolder}/build/compile_commands.json", - "configurationProvider": "ms-vscode.cmake-tools" - } - ], - "version": 4 + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/clang", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "linux-clang-x64", + "compileCommands": "${workspaceFolder}/build/compile_commands.json", + "configurationProvider": "ms-vscode.cmake-tools" + } + ], + "version": 4 } diff --git a/.vscode/extensions.json b/.vscode/extensions.json index f18f1b8..0515580 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,17 +1,17 @@ { - "recommendations": [ - "llvm-vs-code-extensions.vscode-clangd", - "vadimcn.vscode-lldb", - "ms-vscode.cpptools", - "ms-vscode.cmake-tools", - "twxs.cmake", - "jeff-hykin.better-cpp-syntax", - "ms-python.python", - "ms-python.autopep8", - "xaver.clang-format", - "matepek.vscode-catch2-test-adapter", - "jnoortheen.nix-ide", - "notskm.clang-tidy" - ], - "unwantedRecommendations": [] + "recommendations": [ + "llvm-vs-code-extensions.vscode-clangd", + "vadimcn.vscode-lldb", + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "twxs.cmake", + "jeff-hykin.better-cpp-syntax", + "ms-python.python", + "ms-python.autopep8", + "xaver.clang-format", + "matepek.vscode-catch2-test-adapter", + "jnoortheen.nix-ide", + "notskm.clang-tidy" + ], + "unwantedRecommendations": [] } diff --git a/.vscode/launch.json b/.vscode/launch.json index 57e84c4..32ce52e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,37 +1,37 @@ { - "version": "0.2.0", - "configurations": [ - { - "name": "Debug Unittests (GDB)", - "type": "gdb", - "request": "launch", - "target": "./build/tests/Debug/unittests", - "cwd": "${workspaceRoot}", - "valuesFormatting": "parseText" - }, - { - "name": "Debug coronan cli (GDB)", - "type": "gdb", - "request": "launch", - "target": "./build/apps/Debug/cli/coronan", - "cwd": "${workspaceRoot}", - "valuesFormatting": "parseText" - }, - { - "name": "Debug coronan Qt App (GDB)", - "type": "gdb", - "request": "launch", - "target": "./build/apps/Debug/qt/coronanApp", - "cwd": "${workspaceRoot}", - "valuesFormatting": "parseText" - }, - { - "name": "CMake Tools target (GDB)", - "type": "gdb", - "request": "launch", - "target": "${command:cmake.launchTargetPath}", - "cwd": "${workspaceRoot}", - "valuesFormatting": "parseText" - } - ] + "version": "0.2.0", + "configurations": [ + { + "name": "Debug Unittests (GDB)", + "type": "gdb", + "request": "launch", + "target": "./build/tests/Debug/unittests", + "cwd": "${workspaceRoot}", + "valuesFormatting": "parseText" + }, + { + "name": "Debug coronan cli (GDB)", + "type": "gdb", + "request": "launch", + "target": "./build/apps/Debug/cli/coronan", + "cwd": "${workspaceRoot}", + "valuesFormatting": "parseText" + }, + { + "name": "Debug coronan Qt App (GDB)", + "type": "gdb", + "request": "launch", + "target": "./build/apps/Debug/qt/coronanApp", + "cwd": "${workspaceRoot}", + "valuesFormatting": "parseText" + }, + { + "name": "CMake Tools target (GDB)", + "type": "gdb", + "request": "launch", + "target": "${command:cmake.launchTargetPath}", + "cwd": "${workspaceRoot}", + "valuesFormatting": "parseText" + } + ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index edccdec..64e21b6 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,17 +1,17 @@ { - "restructuredtext.confPath": "${workspaceFolder}/docs", - "gcovViewer.buildDirectories": [ - "/workspace/Coronan/build" - ], - "testMate.cpp.test.executables": "{build,Build,BUILD,out,Out,OUT}/tests/{Debug,release}/unittests", - "editor.bracketPairColorization.enabled": true, - "editor.guides.bracketPairs": "active", - "cSpell.words": [ - "cmake", - "coronan", - "cppcheck", - "Doxygen", - "gitpod", - "intermodular" - ] + "restructuredtext.confPath": "${workspaceFolder}/docs", + "gcovViewer.buildDirectories": [ + "/workspace/Coronan/build" + ], + "testMate.cpp.test.executables": "{build,Build,BUILD,out,Out,OUT}/tests/{Debug,release}/unittests", + "editor.bracketPairColorization.enabled": true, + "editor.guides.bracketPairs": "active", + "cSpell.words": [ + "cmake", + "coronan", + "cppcheck", + "Doxygen", + "gitpod", + "intermodular" + ] } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 152d8ae..1e6a755 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,135 +1,135 @@ { - "version": "2.0.0", - "tasks": [ + "version": "2.0.0", + "tasks": [ + { + "label": "conan install", + "command": "conan", + "args": [ + "install", + ".", + "--build=missing", + "--settings", + "build_type=${input:buildType}", + "--settings", + "compiler=${input:compiler}", + "--settings", + "compiler.version=${input:compilerversion}", + "--settings", + "compiler.cppstd=gnu17", + "--settings", + "compiler.libcxx=libstdc++11", + "--update" + ], + "group": { + "kind": "build", + "isDefault": false + }, + "options": { + "cwd": "${workspaceFolder}/" + }, + "type": "shell", + "presentation": { + "clear": true + } + }, + { + "label": "build", + "command": "cmake --build build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": { + "base": "$gcc" + }, + "options": { + "cwd": "${workspaceFolder}/" + }, + "type": "shell", + "presentation": { + "clear": true + } + }, + { + "label": "clean", + "command": "/usr/bin/rm -rf build", + "group": "build", + "problemMatcher": [], + "type": "shell" + }, + { + "label": "unittests", + "command": "cmake --build --preset=run-unittests", + "group": { + "isDefault": true, + "kind": "test" + }, + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [], + "type": "shell" + }, + { + "label": "format files", + "command": "./format_source_files.sh", + "problemMatcher": [], + "type": "shell" + }, + { + "label": "run pre-commit hooks", + "command": "pre-commit run --all-files", + "problemMatcher": [], + "type": "shell" + } + ], + "inputs": [ + { + "id": "buildType", + "type": "pickString", + "description": "Choose an option", + "options": [ + "Debug", + "Release" + ] + }, + { + "id": "compiler", + "type": "pickString", + "description": "Choose an option", + "options": [ { - "label": "conan install", - "command": "conan", - "args": [ - "install", - ".", - "--build=missing", - "--settings", - "build_type=${input:buildType}", - "--settings", - "compiler=${input:compiler}", - "--settings", - "compiler.version=${input:compilerversion}", - "--settings", - "compiler.cppstd=gnu17", - "--settings", - "compiler.libcxx=libstdc++11", - "--update" - ], - "group": { - "kind": "build", - "isDefault": false - }, - "options": { - "cwd": "${workspaceFolder}/" - }, - "type": "shell", - "presentation": { - "clear": true - } + "label": "GCC", + "value": "gcc" }, { - "label": "build", - "command": "cmake --build build", - "group": { - "kind": "build", - "isDefault": true - }, - "problemMatcher": { - "base": "$gcc" - }, - "options": { - "cwd": "${workspaceFolder}/" - }, - "type": "shell", - "presentation": { - "clear": true - } - }, - { - "label": "clean", - "command": "/usr/bin/rm -rf build", - "group": "build", - "problemMatcher": [], - "type": "shell" - }, - { - "label": "unittests", - "command": "cmake --build --preset=run-unittests", - "group": { - "isDefault": true, - "kind": "test" - }, - "options": { - "cwd": "${workspaceFolder}" - }, - "problemMatcher": [], - "type": "shell" - }, + "label": "Clang", + "value": "clang" + } + ] + }, + { + "id": "compilerversion", + "type": "pickString", + "description": "Choose an option", + "options": [ { - "label": "format files", - "command": "./format_source_files.sh", - "problemMatcher": [], - "type": "shell" + "label": "13 (gcc)", + "value": "13" }, { - "label": "run pre-commit hooks", - "command": "pre-commit run --all-files", - "problemMatcher": [], - "type": "shell" - } - ], - "inputs": [ - { - "id": "buildType", - "type": "pickString", - "description": "Choose an option", - "options": [ - "Debug", - "Release" - ] + "label": "14 (gcc)", + "value": "14" }, { - "id": "compiler", - "type": "pickString", - "description": "Choose an option", - "options": [ - { - "label": "GCC", - "value": "gcc" - }, - { - "label": "Clang", - "value": "clang" - } - ] + "label": "18 (clang)", + "value": "18" }, { - "id": "compilerversion", - "type": "pickString", - "description": "Choose an option", - "options": [ - { - "label": "13 (gcc)", - "value": "13" - }, - { - "label": "14 (gcc)", - "value": "14" - }, - { - "label": "18 (clang)", - "value": "18" - }, - { - "label": "19 (clang)", - "value": "19" - } - ] + "label": "19 (clang)", + "value": "19" } - ] + ] + } + ] } diff --git a/CMakePresets.json b/CMakePresets.json index 3decfdd..1a2cc1e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,452 +1,452 @@ { - "version": 6, - "cmakeMinimumRequired": { - "major": 3, - "minor": 25, - "patch": 0 - }, - "configurePresets": [ - { - "name": "base", - "binaryDir": "${sourceDir}/build", - "cacheVariables": { - "ENABLE_TESTING": { - "type": "BOOL", - "value": true - } - }, - "hidden": true - }, - { - "name": "debug", - "description": "Configure debug build", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_PREFIX_PATH": { - "type": "FILEPATH", - "value": "${sourceDir}/build/Debug/generators" - } - }, - "hidden": true - }, - { - "name": "pch", - "description": "Enable precompiled headers", - "cacheVariables": { - "ENABLE_PCH": { - "type": "BOOL", - "value": true - }, - "ENABLE_CLANG_TIDY": { - "type": "BOOL", - "value": false - } - }, - "hidden": true - }, - { - "name": "coverage", - "description": "Configure coverage", - "inherits": [ - "debug" - ], - "cacheVariables": { - "ENABLE_COVERAGE": { - "type": "BOOL", - "value": true - } - }, - "hidden": true - }, - { - "name": "release", - "description": "Configure release build", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_PREFIX_PATH": { - "type": "FILEPATH", - "value": "${sourceDir}/build/Release/generators" - } - }, - "hidden": true - }, - { - "name": "linux-gcc", - "description": "Configure gnu (Ninja)", - "generator": "Ninja Multi-Config", - "inherits": [ - "base" - ], - "cacheVariables": { - "CMAKE_CXX_COMPILER": "g++", - "CMAKE_C_COMPILER": "gcc" - }, - "hidden": true - }, - { - "name": "linux-clang", - "description": "Configure clang (Ninja)", - "generator": "Ninja Multi-Config", - "inherits": [ - "base" - ], - "cacheVariables": { - "CMAKE_CXX_COMPILER": "clang++", - "CMAKE_C_COMPILER": "clang" - }, - "hidden": true - }, - { - "name": "linux-gcc-coverage", - "displayName": "Coverage (gnu)", - "description": "Configure Coverage (gnu)", - "hidden": false, - "inherits": [ - "linux-gcc", - "coverage" - ] - }, - { - "name": "linux-gcc-debug", - "displayName": "Debug (gnu)", - "description": "Configure Debug (gnu)", - "hidden": false, - "inherits": [ - "linux-gcc", - "debug", - "pch" - ] - }, - { - "name": "linux-gcc-release", - "displayName": "Release (gnu)", - "description": "Configure Release (gnu)", - "hidden": false, - "inherits": [ - "linux-gcc", - "release", - "pch" - ] - }, - { - "name": "linux-clang-coverage", - "displayName": "Coverage (clang)", - "description": "Configure Coverage (clang)", - "hidden": false, - "inherits": [ - "linux-clang", - "coverage" - ] - }, - { - "name": "linux-clang-debug", - "displayName": "Debug (clang)", - "description": "Configure Debug (clang)", - "hidden": false, - "inherits": [ - "linux-clang", - "debug", - "pch" - ] - }, - { - "name": "linux-clang-release", - "displayName": "Release (clang)", - "description": "Configure Release (clang)", - "hidden": false, - "inherits": [ - "linux-clang", - "release", - "pch" - ] - }, - { - "name": "linux-clang-address-sanitizers", - "description": "Configure clang build with address sanitizers", - "displayName": "Address sanitizers", - "hidden": false, - "inherits": [ - "linux-clang", - "debug" - ], - "cacheVariables": { - "ENABLE_SANITIZERS": { - "type": "BOOL", - "value": true - }, - "ENABLE_SANITIZER_ADDRESS": { - "type": "BOOL", - "value": true - }, - "ENABLE_SANITIZER_LEAK": { - "type": "BOOL", - "value": true - }, - "ENABLE_SANITIZER_UNDEFINED_BEHAVIOR": { - "type": "BOOL", - "value": true - } - } - }, - { - "name": "linux-clang-memory-sanitizers", - "description": "Configure clang build with memory sanitizers", - "displayName": "Memory sanitizers", - "hidden": false, - "inherits": [ - "linux-clang", - "debug" - ], - "cacheVariables": { - "ENABLE_SANITIZERS": { - "type": "BOOL", - "value": true - }, - "ENABLE_SANITIZER_MEMORY": { - "type": "BOOL", - "value": true - } - } - }, - { - "name": "visual-studio-2022", - "description": "Configure Visual Studio 2022 build", - "generator": "Visual Studio 17 2022", - "inherits": [ - "base" - ], - "hidden": true - }, - { - "name": "visual-studio-2022-debug", - "displayName": "Visual Studio 2022 (Debug)", - "description": "Configure Visual Studio 2022 Debug build", - "hidden": false, - "inherits": [ - "visual-studio-2022", - "debug" - ] - }, - { - "name": "visual-studio-2022-release", - "displayName": "Visual Studio 2022 (Release)", - "description": "Configure Visual Studio 2022 Release build", - "hidden": false, - "inherits": [ - "visual-studio-2022", - "release" - ] + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "base", + "binaryDir": "${sourceDir}/build", + "cacheVariables": { + "ENABLE_TESTING": { + "type": "BOOL", + "value": true } - ], - "buildPresets": [ - { - "name": "gcc-debug", - "description": "gcc debug build.", - "displayName": "Debug", - "configurePreset": "linux-gcc-debug", - "configuration": "Debug", - "jobs": 16 - }, - { - "name": "gcc-coverage", - "description": "gcc debug with coverage.", - "displayName": "Coverage", - "configurePreset": "linux-gcc-coverage", - "configuration": "Debug", - "jobs": 16 - }, - { - "name": "gcc-release", - "description": "gcc release build.", - "displayName": "Release", - "configurePreset": "linux-gcc-release", - "configuration": "Release", - "jobs": 16 - }, - { - "name": "clang-debug", - "description": "clang debug build.", - "displayName": "Debug", - "configurePreset": "linux-clang-debug", - "configuration": "Debug", - "jobs": 16 - }, - { - "name": "clang-coverage", - "description": "clang debug with coverage.", - "displayName": "Coverage", - "configurePreset": "linux-clang-coverage", - "configuration": "Debug", - "jobs": 16 - }, - { - "name": "clang-release", - "description": "clang release build.", - "displayName": "Release", - "configurePreset": "linux-clang-release", - "configuration": "Release", - "jobs": 16 - }, - { - "name": "clang-address-sanitizers", - "description": "clang address sanitizers build.", - "displayName": "Address Sanitizers", - "configurePreset": "linux-clang-address-sanitizers", - "configuration": "Debug", - "jobs": 16 - }, - { - "name": "clang-memory-sanitizers", - "description": "clang memory sanitizers build.", - "displayName": "Memory Sanitizers", - "configurePreset": "linux-clang-memory-sanitizers", - "configuration": "Debug", - "jobs": 16 - }, - { - "name": "visual-studio-debug", - "description": "Visual Studio 2022 Debug build.", - "displayName": "Debug (Visual Studio)", - "configurePreset": "visual-studio-2022-debug", - "configuration": "Debug", - "jobs": 16 - }, - { - "name": "visual-studio-release", - "description": "Visual Studio 2022 Release build.", - "displayName": "Release (Visual Studio)", - "configurePreset": "visual-studio-2022-release", - "configuration": "Release", - "jobs": 16 - }, - { - "name": "run-unittests", - "description": "Unittests", - "displayName": "run unit tests", - "inherits": "gcc-coverage", - "targets": [ - "run_unittests" - ] - }, - { - "name": "doc", - "description": "gcc docu build.", - "displayName": "Documentation (linux)", - "configurePreset": "linux-gcc-release", - "configuration": "Release", - "jobs": 16, - "targets": [ - "doxygen-docs" - ] - }, - { - "name": "doc-windows", - "description": "windows docu build.", - "displayName": "Documentation (win)", - "configurePreset": "visual-studio-2022-release", - "configuration": "Release", - "jobs": 16, - "targets": [ - "doxygen-docs" - ] + }, + "hidden": true + }, + { + "name": "debug", + "description": "Configure debug build", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_PREFIX_PATH": { + "type": "FILEPATH", + "value": "${sourceDir}/build/Debug/generators" } - ], - "testPresets": [ - { - "name": "unittest-coverage-gcc", - "description": "Unittest with coverage (gcc)", - "displayName": "Unittest Coverage", - "configurePreset": "linux-gcc-coverage" - }, - { - "name": "unittest-gcc", - "description": "Unittest (gcc)", - "displayName": "Unittest", - "configurePreset": "linux-gcc-debug" - }, - { - "name": "unittest-coverage-clang", - "description": "Unittest with coverage (clang)", - "displayName": "Unittest Coverage", - "configurePreset": "linux-clang-coverage" - }, - { - "name": "unittest-clang", - "description": "Unittest (clang)", - "displayName": "Unittest", - "configurePreset": "linux-clang-debug" - }, - { - "name": "unittest-vs-2022", - "description": "Unittest (Visual Studio", - "displayName": "Unittest", - "configurePreset": "visual-studio-2022-debug" + }, + "hidden": true + }, + { + "name": "pch", + "description": "Enable precompiled headers", + "cacheVariables": { + "ENABLE_PCH": { + "type": "BOOL", + "value": true + }, + "ENABLE_CLANG_TIDY": { + "type": "BOOL", + "value": false } - ], - "packagePresets": [ - { - "name": "tgz-gcc", - "displayName": "Tar GZip", - "configurePreset": "linux-gcc-release", - "generators": [ - "TGZ" - ] - }, - { - "name": "tgz-clang", - "displayName": "Tar GZip", - "configurePreset": "linux-clang-release", - "generators": [ - "TGZ" - ] - }, - { - "name": "debian-gcc", - "displayName": "Debian package", - "configurePreset": "linux-gcc-release", - "generators": [ - "DEB" - ] - }, - { - "name": "debian-clang", - "displayName": "Debian package", - "configurePreset": "linux-clang-release", - "generators": [ - "DEB" - ] - }, - { - "name": "ifw-gcc", - "displayName": "Qt installer", - "configurePreset": "linux-gcc-release", - "generators": [ - "IFW" - ] - }, - { - "name": "ifw-gclang", - "displayName": "Qt installer", - "configurePreset": "linux-clang-release", - "generators": [ - "IFW" - ] - }, - { - "name": "ifw-visual-studio-2022", - "displayName": "Windows IFW", - "configurePreset": "visual-studio-2022-release", - "generators": [ - "IFW" - ] - }, - { - "name": "wix-visual-studio-2022", - "displayName": "Windows Wix", - "configurePreset": "visual-studio-2022-release", - "generators": [ - "WIX" - ] + }, + "hidden": true + }, + { + "name": "coverage", + "description": "Configure coverage", + "inherits": [ + "debug" + ], + "cacheVariables": { + "ENABLE_COVERAGE": { + "type": "BOOL", + "value": true + } + }, + "hidden": true + }, + { + "name": "release", + "description": "Configure release build", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_PREFIX_PATH": { + "type": "FILEPATH", + "value": "${sourceDir}/build/Release/generators" } - ] + }, + "hidden": true + }, + { + "name": "linux-gcc", + "description": "Configure gnu (Ninja)", + "generator": "Ninja Multi-Config", + "inherits": [ + "base" + ], + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_C_COMPILER": "gcc" + }, + "hidden": true + }, + { + "name": "linux-clang", + "description": "Configure clang (Ninja)", + "generator": "Ninja Multi-Config", + "inherits": [ + "base" + ], + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_C_COMPILER": "clang" + }, + "hidden": true + }, + { + "name": "linux-gcc-coverage", + "displayName": "Coverage (gnu)", + "description": "Configure Coverage (gnu)", + "hidden": false, + "inherits": [ + "linux-gcc", + "coverage" + ] + }, + { + "name": "linux-gcc-debug", + "displayName": "Debug (gnu)", + "description": "Configure Debug (gnu)", + "hidden": false, + "inherits": [ + "linux-gcc", + "debug", + "pch" + ] + }, + { + "name": "linux-gcc-release", + "displayName": "Release (gnu)", + "description": "Configure Release (gnu)", + "hidden": false, + "inherits": [ + "linux-gcc", + "release", + "pch" + ] + }, + { + "name": "linux-clang-coverage", + "displayName": "Coverage (clang)", + "description": "Configure Coverage (clang)", + "hidden": false, + "inherits": [ + "linux-clang", + "coverage" + ] + }, + { + "name": "linux-clang-debug", + "displayName": "Debug (clang)", + "description": "Configure Debug (clang)", + "hidden": false, + "inherits": [ + "linux-clang", + "debug", + "pch" + ] + }, + { + "name": "linux-clang-release", + "displayName": "Release (clang)", + "description": "Configure Release (clang)", + "hidden": false, + "inherits": [ + "linux-clang", + "release", + "pch" + ] + }, + { + "name": "linux-clang-address-sanitizers", + "description": "Configure clang build with address sanitizers", + "displayName": "Address sanitizers", + "hidden": false, + "inherits": [ + "linux-clang", + "debug" + ], + "cacheVariables": { + "ENABLE_SANITIZERS": { + "type": "BOOL", + "value": true + }, + "ENABLE_SANITIZER_ADDRESS": { + "type": "BOOL", + "value": true + }, + "ENABLE_SANITIZER_LEAK": { + "type": "BOOL", + "value": true + }, + "ENABLE_SANITIZER_UNDEFINED_BEHAVIOR": { + "type": "BOOL", + "value": true + } + } + }, + { + "name": "linux-clang-memory-sanitizers", + "description": "Configure clang build with memory sanitizers", + "displayName": "Memory sanitizers", + "hidden": false, + "inherits": [ + "linux-clang", + "debug" + ], + "cacheVariables": { + "ENABLE_SANITIZERS": { + "type": "BOOL", + "value": true + }, + "ENABLE_SANITIZER_MEMORY": { + "type": "BOOL", + "value": true + } + } + }, + { + "name": "visual-studio-2022", + "description": "Configure Visual Studio 2022 build", + "generator": "Visual Studio 17 2022", + "inherits": [ + "base" + ], + "hidden": true + }, + { + "name": "visual-studio-2022-debug", + "displayName": "Visual Studio 2022 (Debug)", + "description": "Configure Visual Studio 2022 Debug build", + "hidden": false, + "inherits": [ + "visual-studio-2022", + "debug" + ] + }, + { + "name": "visual-studio-2022-release", + "displayName": "Visual Studio 2022 (Release)", + "description": "Configure Visual Studio 2022 Release build", + "hidden": false, + "inherits": [ + "visual-studio-2022", + "release" + ] + } + ], + "buildPresets": [ + { + "name": "gcc-debug", + "description": "gcc debug build.", + "displayName": "Debug", + "configurePreset": "linux-gcc-debug", + "configuration": "Debug", + "jobs": 16 + }, + { + "name": "gcc-coverage", + "description": "gcc debug with coverage.", + "displayName": "Coverage", + "configurePreset": "linux-gcc-coverage", + "configuration": "Debug", + "jobs": 16 + }, + { + "name": "gcc-release", + "description": "gcc release build.", + "displayName": "Release", + "configurePreset": "linux-gcc-release", + "configuration": "Release", + "jobs": 16 + }, + { + "name": "clang-debug", + "description": "clang debug build.", + "displayName": "Debug", + "configurePreset": "linux-clang-debug", + "configuration": "Debug", + "jobs": 16 + }, + { + "name": "clang-coverage", + "description": "clang debug with coverage.", + "displayName": "Coverage", + "configurePreset": "linux-clang-coverage", + "configuration": "Debug", + "jobs": 16 + }, + { + "name": "clang-release", + "description": "clang release build.", + "displayName": "Release", + "configurePreset": "linux-clang-release", + "configuration": "Release", + "jobs": 16 + }, + { + "name": "clang-address-sanitizers", + "description": "clang address sanitizers build.", + "displayName": "Address Sanitizers", + "configurePreset": "linux-clang-address-sanitizers", + "configuration": "Debug", + "jobs": 16 + }, + { + "name": "clang-memory-sanitizers", + "description": "clang memory sanitizers build.", + "displayName": "Memory Sanitizers", + "configurePreset": "linux-clang-memory-sanitizers", + "configuration": "Debug", + "jobs": 16 + }, + { + "name": "visual-studio-debug", + "description": "Visual Studio 2022 Debug build.", + "displayName": "Debug (Visual Studio)", + "configurePreset": "visual-studio-2022-debug", + "configuration": "Debug", + "jobs": 16 + }, + { + "name": "visual-studio-release", + "description": "Visual Studio 2022 Release build.", + "displayName": "Release (Visual Studio)", + "configurePreset": "visual-studio-2022-release", + "configuration": "Release", + "jobs": 16 + }, + { + "name": "run-unittests", + "description": "Unittests", + "displayName": "run unit tests", + "inherits": "gcc-coverage", + "targets": [ + "run_unittests" + ] + }, + { + "name": "doc", + "description": "gcc docu build.", + "displayName": "Documentation (linux)", + "configurePreset": "linux-gcc-release", + "configuration": "Release", + "jobs": 16, + "targets": [ + "doxygen-docs" + ] + }, + { + "name": "doc-windows", + "description": "windows docu build.", + "displayName": "Documentation (win)", + "configurePreset": "visual-studio-2022-release", + "configuration": "Release", + "jobs": 16, + "targets": [ + "doxygen-docs" + ] + } + ], + "testPresets": [ + { + "name": "unittest-coverage-gcc", + "description": "Unittest with coverage (gcc)", + "displayName": "Unittest Coverage", + "configurePreset": "linux-gcc-coverage" + }, + { + "name": "unittest-gcc", + "description": "Unittest (gcc)", + "displayName": "Unittest", + "configurePreset": "linux-gcc-debug" + }, + { + "name": "unittest-coverage-clang", + "description": "Unittest with coverage (clang)", + "displayName": "Unittest Coverage", + "configurePreset": "linux-clang-coverage" + }, + { + "name": "unittest-clang", + "description": "Unittest (clang)", + "displayName": "Unittest", + "configurePreset": "linux-clang-debug" + }, + { + "name": "unittest-vs-2022", + "description": "Unittest (Visual Studio", + "displayName": "Unittest", + "configurePreset": "visual-studio-2022-debug" + } + ], + "packagePresets": [ + { + "name": "tgz-gcc", + "displayName": "Tar GZip", + "configurePreset": "linux-gcc-release", + "generators": [ + "TGZ" + ] + }, + { + "name": "tgz-clang", + "displayName": "Tar GZip", + "configurePreset": "linux-clang-release", + "generators": [ + "TGZ" + ] + }, + { + "name": "debian-gcc", + "displayName": "Debian package", + "configurePreset": "linux-gcc-release", + "generators": [ + "DEB" + ] + }, + { + "name": "debian-clang", + "displayName": "Debian package", + "configurePreset": "linux-clang-release", + "generators": [ + "DEB" + ] + }, + { + "name": "ifw-gcc", + "displayName": "Qt installer", + "configurePreset": "linux-gcc-release", + "generators": [ + "IFW" + ] + }, + { + "name": "ifw-gclang", + "displayName": "Qt installer", + "configurePreset": "linux-clang-release", + "generators": [ + "IFW" + ] + }, + { + "name": "ifw-visual-studio-2022", + "displayName": "Windows IFW", + "configurePreset": "visual-studio-2022-release", + "generators": [ + "IFW" + ] + }, + { + "name": "wix-visual-studio-2022", + "displayName": "Windows Wix", + "configurePreset": "visual-studio-2022-release", + "generators": [ + "WIX" + ] + } + ] } diff --git a/README.md b/README.md index 0cf6e1b..900fdf8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,6 @@ ![version](https://img.shields.io/badge/version-v1.0.0-blue) ![GitHub last commit](https://img.shields.io/github/last-commit/bbvch/Coronan) - [![Linux Builds](https://github.com/bbvch/Coronan/actions/workflows/ci-linux.yml/badge.svg)](https://github.com/bbvch/Coronan/actions/workflows/ci-linux.yml) [![Nix Builds](https://github.com/bbvch/Coronan/actions/workflows/nix.yml/badge.svg)](https://github.com/bbvch/Coronan/actions/workflows/nix.yml) @@ -34,12 +33,10 @@ [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=coverage)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=bbvch_Coronan&metric=duplicated_lines_density)](https://sonarcloud.io/summary/overall?id=bbvch_Coronan) - - [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/bbvch/Coronan) - ### IMPORTANT NOTE + Co\[ro\]nan was written during the pandemic of the Corona Virus. The [The About Corona Covid-19 API](https://about-corona.net/documentation) used for the first version is no longer available. However with [COVID-19 Statistics API](https://covid-api.com/) an alternative was found. Unfortunately the [COVID-19 Statistics API](https://covid-api.com/api/) does have a different data structure, and retrieving data is much slower, because the API does not support timeline data, i.e. every data for specific date requires a GET. But at least the application works again. And the name didn't have to change. @@ -49,13 +46,10 @@ Co\[ro\]nan was written during the pandemic of the Corona Virus. The [The About Co\[ro\]nan is an example C++20 CLI and Qt project using [conan](https://conan.io/) and [CMake](https://cmake.org/). It reads the latest data of Corona (Covid-19) cases for a country from the [COVID-19 Statistics API](https://covid-api.com/). - _The COVID-19 Statistics API_ provides statistics via REST API from the [Johns Hopkins CSSE](https://github.com/CSSEGISandData/COVID-19). - ![Screenshot of the qt application](images/Screenshot-qt.png) - ## Table of content
@@ -75,100 +69,101 @@ _The COVID-19 Statistics API_ provides statistics via REST API from the [Johns H ## Project Features This projects is a C++ project template. It includes everything a "Modern" C++ project possibly needs: -* C++ 20 Standard - * [GCC](https://gcc.gnu.org/) _(>= gcc-12)_ - * [Clang](https://clang.llvm.org/) _(>= clang-13)_ - * Visual Studio 2022 -* [conan](https://conan.io/) package Manager +- C++ 20 Standard + - [GCC](https://gcc.gnu.org/) _(>= gcc-12)_ + - [Clang](https://clang.llvm.org/) _(>= clang-13)_ + - Visual Studio 2022 + +- [conan](https://conan.io/) package Manager -* Dependencies: - * to install: - * [Qt6](https://www.qt.io/) _(minimal version required: 6.4)_ - * with conan: - * [Poco](https://pocoproject.org/) Networking library - * [RapidJSON](https://rapidjson.org/) - * [Lyra](https://github.com/bfgroup/Lyra) command line arguments parser - * [{fmt}](https://github.com/fmtlib/fmt) formatting library _(std::print is C++23 and therefore not used yet)_ - * [date](https://github.com/HowardHinnant/date) date and time library _(std::chrono::year_month_day is not fully supported in older c++20 compilers (gcc 12, 13 and clang 13-16) therefor it is not used yet)_ - * [Catch2](https://github.com/catchorg/Catch2) _(for unittests)__ +- Dependencies: + - to install: + - [Qt6](https://www.qt.io/) _(minimal version required: 6.4)_ + - with conan: + - [Poco](https://pocoproject.org/) Networking library + - [RapidJSON](https://rapidjson.org/) + - [Lyra](https://github.com/bfgroup/Lyra) command line arguments parser + - [{fmt}](https://github.com/fmtlib/fmt) formatting library _(std::print is C++23 and therefore not used yet)_ + - [date](https://github.com/HowardHinnant/date) date and time library _(std::chrono::year_month_day is not fully supported in older c++20 compilers (gcc 12, 13 and clang 13-16) therefor it is not used yet)_ + - [Catch2](https://github.com/catchorg/Catch2) _(for unittests)__ -* Unittests with Coverage using [Catch2](https://github.com/catchorg/Catch2) +- Unittests with Coverage using [Catch2](https://github.com/catchorg/Catch2) -* CMake with [CMakePresets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) _(CMake >= 3.23)_ +- CMake with [CMakePresets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) _(CMake >= 3.23)_ -* CPack packaging: - * tar gzip archive - * Debian package - * [Qt Installer Framework](https://doc.qt.io/qtinstallerframework/) - * [WIX](https://wixtoolset.org/) +- CPack packaging: + - tar gzip archive + - Debian package + - [Qt Installer Framework](https://doc.qt.io/qtinstallerframework/) + - [WIX](https://wixtoolset.org/) -* Build Caching support: - * [ccache](https://ccache.dev/) - * [sccache](https://github.com/mozilla/sccache) +- Build Caching support: + - [ccache](https://ccache.dev/) + - [sccache](https://github.com/mozilla/sccache) -* Static Analyzer support: - * [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) - * [cppcheck](http://cppcheck.sourceforge.net/) - * [include-what-you-use](https://include-what-you-use.org/) - * [link-what-you-use](https://cmake.org/cmake/help/latest/prop_tgt/LINK_WHAT_YOU_USE.html) +- Static Analyzer support: + - [clang-tidy](https://clang.llvm.org/extra/clang-tidy/) + - [cppcheck](http://cppcheck.sourceforge.net/) + - [include-what-you-use](https://include-what-you-use.org/) + - [link-what-you-use](https://cmake.org/cmake/help/latest/prop_tgt/LINK_WHAT_YOU_USE.html) -* Sanitizers support: - * [Address Sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html) - * [Leak Sanitizer](https://clang.llvm.org/docs/LeakSanitizer.html) - * [Undefined Behavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html) - * [Thread Sanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html) - * [Memory Sanitizer](https://clang.llvm.org/docs/MemorySanitizer.html) +- Sanitizers support: + - [Address Sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html) + - [Leak Sanitizer](https://clang.llvm.org/docs/LeakSanitizer.html) + - [Undefined Behavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html) + - [Thread Sanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html) + - [Memory Sanitizer](https://clang.llvm.org/docs/MemorySanitizer.html) -* Documentation Generation using - * [Doxygen](https://www.doxygen.nl/index.html) using the _"doxygen-awesome-sidebar-only"_ theme by - * [doxygen-awesome-css](https://github.com/jothepro/doxygen-awesome-css) by default +- Documentation Generation using + - [Doxygen](https://www.doxygen.nl/index.html) using the _"doxygen-awesome-sidebar-only"_ theme by + - [doxygen-awesome-css](https://github.com/jothepro/doxygen-awesome-css) by default -* Code formatting: - * [clang-format](https://clang.llvm.org/docs/ClangFormat.html) for C++ files - * [cmake-format](https://pypi.org/project/cmake-format/) for CMake files +- Code formatting: + - [clang-format](https://clang.llvm.org/docs/ClangFormat.html) for C++ files + - [cmake-format](https://pypi.org/project/cmake-format/) for CMake files -* [Pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks) support +- [Pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks) support -* [Nix](https://nixos.org) environment support +- [Nix](https://nixos.org) environment support -* [gitpod](https://www.gitpod.io/) support +- [gitpod](https://www.gitpod.io/) support -* Continuous integration (CI): - * GitHub Action +- Continuous integration (CI): + - GitHub Action - * Mac OS X - * 13 _(AppleClang 14)_ - * 14 _(AppleClang 15)_ - * 15 _(AppleClang 15)_ + - Mac OS X + - 13 _(AppleClang 14)_ + - 14 _(AppleClang 15)_ + - 15 _(AppleClang 15)_ - * Ubuntu 22.04 - * GCC 12 - * Clang 13, 14 & 15 + - Ubuntu 22.04 + - GCC 12 + - Clang 13, 14 & 15 - * Ubuntu 24.04 - * GCC 13 & 14 - * Clang 16, 17 & 18 + - Ubuntu 24.04 + - GCC 13 & 14 + - Clang 16, 17 & 18 - * Windows - * Visual Studio 2022 + - Windows + - Visual Studio 2022 - * Nix - * GCC 14 - * Clang 18 + - Nix + - GCC 14 + - Clang 18 - * [Codacy Security Scan](https://github.com/marketplace/actions/codacy-analysis-cli) + - [Codacy Security Scan](https://github.com/marketplace/actions/codacy-analysis-cli) - * [CodeQL Static Analysis](https://github.com/github/codeql-action) + - [CodeQL Static Analysis](https://github.com/github/codeql-action) - * [Coverity Scan Static Analysis](https://scan.coverity.com/) + - [Coverity Scan Static Analysis](https://scan.coverity.com/) - * [Codecov](https://codecov.io) Coverage Reporter + - [Codecov](https://codecov.io) Coverage Reporter - * [Sonar Cloud Static Analysis](https://www.sonarsource.com/products/sonarcloud/) + - [Sonar Cloud Static Analysis](https://www.sonarsource.com/products/sonarcloud/) - * [AppVeyor](https://www.appveyor.com/) - * Windows Visual Studio 2019 + - [AppVeyor](https://www.appveyor.com/) + - Windows Visual Studio 2019 ## Development @@ -198,20 +193,22 @@ __CMake__: You can also build it yourself using CMake and conan -* __Install dependencies with conan__ +- __Install dependencies with conan__ ```bash conan install . --build=missing --settings build_type=Debug ``` + Because the conan [cmake_layout](https://docs.conan.io/2/reference/tools/cmake/cmake_layout.html#) and the [`CMakeDeps`](https://docs.conan.io/2/reference/tools/cmake/cmakedeps.html) generator is used, the necessary cmake files used with `find_packages()` are generated into `build\\generators`. `CMAKE_PREFIX_PATH` is adapted accordingly in the root `CMakeLists.txt`. -* __Without CMake Presets__ +- __Without CMake Presets__ ```bash cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Debug cmake --build ./build ``` -* __With CMake Presets__ + +- __With CMake Presets__ ```bash cmake -S . --preset=linux-gcc-debug @@ -228,46 +225,46 @@ _Note: Delete the build directory before formatting, otherwise all CMake files i ### CMake options -* `DOWNLOAD_QT6`: Download and build Qt6 otherwise use installed. _Default: `OFF`_ -* `ENABLE_TESTING`: Build (and run) unittests. _Default: `ON`_ -* `ENABLE_BUILD_WITH_TIME_TRACE`: Enable [Clang Time Trace Feature](https://www.snsystems.com/technology/tech-blog/clang-time-trace-feature). _Default: `OFF`_ -* `ENABLE_PCH`: Enable [Precompiled Headers](https://en.wikipedia.org/wiki/Precompiled_header). _Default: `OFF`_ -* `ENABLE_CACHE`: Enable caching if available, e.g. [ccache](https://ccache.dev/) or [sccache](https://github.com/mozilla/sccache). _Default: `ON`_ -* `ENABLE_COVERAGE`: Enable coverage reporting for gcc/clang. _Default: `OFF`_ -* `ENABLE_DOXYGEN`: Enable doxygen documentation build ([Doxygen](https://www.doxygen.nl/index.html) must be installed). _Default: `ON` if Doxygen is installed `OFF` otherwise._ -* `ENABLE_SANITIZERS`: Enable supported sanitizers. _Default: `OFF`_ - * `ENABLE_SANITIZER_ADDRESS`: Enable [address sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html). _Default: `ON` if supported by the compiler and `ENABLE_SANITIZERS` is `ON` otherwise `OFF`._ - * `ENABLE_SANITIZER_LEAK`: Enable [leak sanitizer](https://clang.llvm.org/docs/LeakSanitizer.html). _Default: `OFF`_ - * `ENABLE_SANITIZER_UNDEFINED_BEHAVIOR`: Enable [undefined behavior sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html). _Default: `ON` if supported by the compiler and `ENABLE_SANITIZERS` is `ON` otherwise `OFF`._ - * `ENABLE_SANITIZER_THREAD`: Enable [thread sanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html). _Default: `OFF`_ - * `ENABLE_SANITIZER_MEMORY`: Enable [memory sanitizer](https://clang.llvm.org/docs/MemorySanitizer.html). _Default: `OFF`_ -* `ENABLE_IPO`: Enable intermodular optimization, aka [Link Time Optimization (LTO)](https://llvm.org/docs/LinkTimeOptimization.html). _Default: `OFF`_ -* `ENABLE_CPPCHECK`: Enable static analysis with [cppcheck](http://cppcheck.sourceforge.net/). _Default: `ON` if cppcheck is installed `OFF` otherwise._ -* `ENABLE_CLANG_TIDY`: Enable static analysis with [clang-tidy](https://clang.llvm.org/extra/clang-tidy/). _Default: `ON` if clang-tidy is installed `OFF` otherwise._ -* `ENABLE_INCLUDE_WHAT_YOU_USE`: Enable static analysis with [include-what-you-use](https://include-what-you-use.org/). _Default: `ON` if include-what-you-use is installed `OFF` otherwise_. -* `ENABLE_LINK_WHAT_YOU_USE` : Enable _link what you use_ cmake built-in static analysis. _Default: `OFF` -* `WARNINGS_AS_ERRORS`: Treat compiler warnings as errors. _Default: `OFF` +- `DOWNLOAD_QT6`: Download and build Qt6 otherwise use installed. _Default: `OFF`_ +- `ENABLE_TESTING`: Build (and run) unittests. _Default: `ON`_ +- `ENABLE_BUILD_WITH_TIME_TRACE`: Enable [Clang Time Trace Feature](https://www.snsystems.com/technology/tech-blog/clang-time-trace-feature). _Default: `OFF`_ +- `ENABLE_PCH`: Enable [Precompiled Headers](https://en.wikipedia.org/wiki/Precompiled_header). _Default: `OFF`_ +- `ENABLE_CACHE`: Enable caching if available, e.g. [ccache](https://ccache.dev/) or [sccache](https://github.com/mozilla/sccache). _Default: `ON`_ +- `ENABLE_COVERAGE`: Enable coverage reporting for gcc/clang. _Default: `OFF`_ +- `ENABLE_DOXYGEN`: Enable doxygen documentation build ([Doxygen](https://www.doxygen.nl/index.html) must be installed). _Default: `ON` if Doxygen is installed `OFF` otherwise._ +- `ENABLE_SANITIZERS`: Enable supported sanitizers. _Default: `OFF`_ + - `ENABLE_SANITIZER_ADDRESS`: Enable [address sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html). _Default: `ON` if supported by the compiler and `ENABLE_SANITIZERS` is `ON` otherwise `OFF`._ + - `ENABLE_SANITIZER_LEAK`: Enable [leak sanitizer](https://clang.llvm.org/docs/LeakSanitizer.html). _Default: `OFF`_ + - `ENABLE_SANITIZER_UNDEFINED_BEHAVIOR`: Enable [undefined behavior sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html). _Default: `ON` if supported by the compiler and `ENABLE_SANITIZERS` is `ON` otherwise `OFF`._ + - `ENABLE_SANITIZER_THREAD`: Enable [thread sanitizer](https://clang.llvm.org/docs/ThreadSanitizer.html). _Default: `OFF`_ + - `ENABLE_SANITIZER_MEMORY`: Enable [memory sanitizer](https://clang.llvm.org/docs/MemorySanitizer.html). _Default: `OFF`_ +- `ENABLE_IPO`: Enable intermodular optimization, aka [Link Time Optimization (LTO)](https://llvm.org/docs/LinkTimeOptimization.html). _Default: `OFF`_ +- `ENABLE_CPPCHECK`: Enable static analysis with [cppcheck](http://cppcheck.sourceforge.net/). _Default: `ON` if cppcheck is installed `OFF` otherwise._ +- `ENABLE_CLANG_TIDY`: Enable static analysis with [clang-tidy](https://clang.llvm.org/extra/clang-tidy/). _Default: `ON` if clang-tidy is installed `OFF` otherwise._ +- `ENABLE_INCLUDE_WHAT_YOU_USE`: Enable static analysis with [include-what-you-use](https://include-what-you-use.org/). _Default: `ON` if include-what-you-use is installed `OFF` otherwise_. +- `ENABLE_LINK_WHAT_YOU_USE` : Enable _link what you use_ cmake built-in static analysis. _Default: `OFF` +- `WARNINGS_AS_ERRORS`: Treat compiler warnings as errors. _Default: `OFF` ## Pre-Commit Hooks The following [Pre-commit-hooks](https://github.com/pre-commit/pre-commit-hooks) are used to check and format files before committing: -* `check-added-large-files`: Prevent giant files (> 500kB) from being committed. -* `fix-byte-order-marker`: Forbid files which have a UTF-8 byte-order marker -* `check-case-conflict`: Check for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT. -* `check-merge-conflict`: Check for files that contain merge conflict strings. -* `check-symlinks`: Checks for symlinks which do not point to anything. -* `check-yaml`: Attempts to load all yaml files to verify syntax. -* `check-json`: Attempts to load all json files to verify syntax. -* `check-toml`: Attempts to load all TOML files to verify syntax. -* `check-executables-have-shebangs`: Checks that non-binary executables have a proper shebang. -* `end-of-file-fixer`: Makes sure files end in a newline and only a newline. -* `mixed-line-ending`: Replaces or checks mixed line ending. -* `trailing-whitespace`: Trims trailing whitespace in markdown -* `clang-format`: Format C++ files using clang-format -* `cmake-format`: Format CMake files using cmake-format -* `yamllint`: Linter for yaml files -* `yamlfmt`: Format yaml files +- `check-added-large-files`: Prevent giant files (> 500kB) from being committed. +- `fix-byte-order-marker`: Forbid files which have a UTF-8 byte-order marker +- `check-case-conflict`: Check for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT. +- `check-merge-conflict`: Check for files that contain merge conflict strings. +- `check-symlinks`: Checks for symlinks which do not point to anything. +- `check-yaml`: Attempts to load all yaml files to verify syntax. +- `check-json`: Attempts to load all json files to verify syntax. +- `check-toml`: Attempts to load all TOML files to verify syntax. +- `check-executables-have-shebangs`: Checks that non-binary executables have a proper shebang. +- `end-of-file-fixer`: Makes sure files end in a newline and only a newline. +- `mixed-line-ending`: Replaces or checks mixed line ending. +- `trailing-whitespace`: Trims trailing whitespace in markdown +- `clang-format`: Format C++ files using clang-format +- `cmake-format`: Format CMake files using cmake-format +- `yamllint`: Linter for yaml files +- `yamlfmt`: Format yaml files Please install pre-commit hooks before committing any code. @@ -276,13 +273,14 @@ pre-commit install -f --hook-type pre-commit ``` To manually check all files run: + ```bash pre-commit run --all-files ``` ## gitpod -To start right away without installing anything on your local machine, you can simply use the button in the Project State section at the top of this README. +To start right away without installing anything on your local machine, you can simply use the Open in Gitpod button in the Project State section at the top of this README. ## direnv & nix diff --git a/apps/cli/src/argument_parser.cpp b/apps/cli/src/argument_parser.cpp index 994ce8c..0def5b7 100644 --- a/apps/cli/src/argument_parser.cpp +++ b/apps/cli/src/argument_parser.cpp @@ -49,7 +49,7 @@ parse_commandline_arguments(lyra::args const& args) if (auto const result = command_line_parser.parse(args); !result) { - fmt::print(stderr, "Error in comman line: {}\n", result.message()); + fmt::print(stderr, "Error in commandline: {}\n", result.message()); fmt::print("{}\n", usage.str()); return EXIT_FAILURE; } diff --git a/apps/cli/tests/argument_parser_test.cpp b/apps/cli/tests/argument_parser_test.cpp index 605b388..44834ca 100644 --- a/apps/cli/tests/argument_parser_test.cpp +++ b/apps/cli/tests/argument_parser_test.cpp @@ -8,7 +8,7 @@ using namespace date; TEST_CASE("argument parser called with ", "[HTTPClient]") { - using SuccessfullParse = std::tuple, std::optional>; + using SuccessfulParse = std::tuple, std::optional>; SECTION("-h (help) exits with success") { @@ -32,8 +32,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHE"); REQUIRE_FALSE(start_date.has_value()); REQUIRE_FALSE(end_date.has_value()); @@ -44,8 +44,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name", "-c", "CHN"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHN"); REQUIRE_FALSE(start_date.has_value()); REQUIRE_FALSE(end_date.has_value()); @@ -56,8 +56,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name", "--country", "CHN"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHN"); REQUIRE_FALSE(start_date.has_value()); REQUIRE_FALSE(end_date.has_value()); @@ -68,8 +68,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name", "-s", "2020-01-01"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHE"); REQUIRE(start_date.has_value()); REQUIRE(start_date == year_month_day{2020_y / January / 1_d}); @@ -81,8 +81,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name", "--start_date", "2020-01-01"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHE"); REQUIRE(start_date.has_value()); REQUIRE(start_date == year_month_day{2020_y / January / 1_d}); @@ -95,8 +95,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name", "--start_date", "2020-01-01", "-c", "CHN"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHN"); REQUIRE(start_date.has_value()); REQUIRE(start_date == year_month_day{2020_y / January / 1_d}); @@ -116,8 +116,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name", "-e", "2020-01-01"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHE"); REQUIRE(end_date.has_value()); REQUIRE(end_date == year_month_day{2020_y / January / 1_d}); @@ -129,8 +129,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name", "--end_date", "2020-01-01"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHE"); REQUIRE(end_date.has_value()); REQUIRE(end_date == year_month_day{2020_y / January / 1_d}); @@ -143,8 +143,8 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") const auto result = coronan_cli::parse_commandline_arguments({"program_name", "--end_date", "2020-01-01", "-c", "CHN"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHN"); REQUIRE(end_date.has_value()); REQUIRE(end_date == year_month_day{2020_y / January / 1_d}); @@ -159,14 +159,14 @@ TEST_CASE("argument parser called with ", "[HTTPClient]") REQUIRE(std::get(result) == EXIT_FAILURE); } - SECTION("-passing all argumnets return country code, start date and end date") + SECTION("-passing all arguments return country code, start date and end date") { const auto result = coronan_cli::parse_commandline_arguments( {"program_name", "--start_date", "2019-01-01", "--end_date", "2020-01-01", "-c", "CHN"}); - REQUIRE(std::holds_alternative(result)); - const auto& [country, start_date, end_date] = std::get(result); + REQUIRE(std::holds_alternative(result)); + const auto& [country, start_date, end_date] = std::get(result); REQUIRE(country == "CHN"); REQUIRE(start_date.has_value()); REQUIRE(start_date == year_month_day{2019_y / January / 1_d}); diff --git a/apps/qt/CMakeLists.txt b/apps/qt/CMakeLists.txt index 423349e..bb3d422 100644 --- a/apps/qt/CMakeLists.txt +++ b/apps/qt/CMakeLists.txt @@ -47,7 +47,7 @@ set(HEADER_LIST "${CMAKE_CURRENT_SOURCE_DIR}/include/country_data_model.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/country_chart_view.h" "${CMAKE_CURRENT_SOURCE_DIR}/include/mainwindow.h" ) -# AUTOMOC and AUTOUIC dows not work when Qt is built from source +# AUTOMOC and AUTOUIC does not work when Qt is built from source if(DOWNLOAD_QT6) qt6_wrap_ui(APP_UI_FILES ${CMAKE_CURRENT_LIST_DIR}/mainwindow.ui) qt6_wrap_cpp(MOC_FILES ${HEADER_LIST}) diff --git a/apps/qt/cmake/Qt.cmake b/apps/qt/cmake/Qt.cmake index 95075eb..3c47a76 100644 --- a/apps/qt/cmake/Qt.cmake +++ b/apps/qt/cmake/Qt.cmake @@ -27,7 +27,6 @@ set(QT_BUILD_EXAMPLES OFF) set(QT_BUILD_EXAMPLES_BY_DEFAULT OFF) set(QT_BUILD_TESTS OFF) set(QT_BUILD_DOCS OFF) - set(QT_MODULES Core Widgets Charts) set(CMAKE_CXX_STANDARD 20) diff --git a/apps/qt/country_data_model.cpp b/apps/qt/country_data_model.cpp index ba3bcb1..e60edc8 100644 --- a/apps/qt/country_data_model.cpp +++ b/apps/qt/country_data_model.cpp @@ -20,7 +20,7 @@ void CountryDataModel::populate_data(coronan::CountryData const& country_data) if (not country_data.timeline.empty()) { - // Unfortunatelly QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) + // Unfortunately QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) // does not fully support C++ 20 even for Qt >= 6.4 auto const start_qdate = QDate(static_cast(country_data.timeline.front().date.year()), static_cast(unsigned(country_data.timeline.front().date.month())), @@ -38,7 +38,7 @@ void CountryDataModel::populate_data(coronan::CountryData const& country_data) for (auto const& data_point : country_data.timeline) { CountryTimelineData timeline_data; - // Unfortunatelly QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) + // Unfortunately QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) // does not fully support C++ 20 even for Qt >= 6.4 auto const qdate = QDate(static_cast(data_point.date.year()), static_cast(unsigned(data_point.date.month())), diff --git a/apps/qt/main.cpp b/apps/qt/main.cpp index f6e858e..1dff4af 100644 --- a/apps/qt/main.cpp +++ b/apps/qt/main.cpp @@ -16,8 +16,8 @@ int main(int argc, char* argv[]) try { window.show(); - auto const titel = "Co[ro]nan " + std::string{coronan::config::project_version} + " by bbv Software Services AG"; - window.setWindowTitle(titel.c_str()); + auto const title = "Co[ro]nan " + std::string{coronan::config::project_version} + " by bbv Software Services AG"; + window.setWindowTitle(title.c_str()); auto const window_width = 1600; auto const window_height = 1200; window.resize(window_width, window_height); diff --git a/apps/qt/mainwindow.cpp b/apps/qt/mainwindow.cpp index b1e4895..5882515 100644 --- a/apps/qt/mainwindow.cpp +++ b/apps/qt/mainwindow.cpp @@ -60,7 +60,7 @@ void CoronanWidget::populate_date_boxes() { auto const latest_country_data = coronan::CoronaAPIClient{}.request_country_data(default_country_code, std::nullopt); auto const latest_date = latest_country_data.latest.date; - // Unfortunatelly QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) does + // Unfortunately QDate(std::chrono::year_month_weekday_last date) can not be used when the compiler (libstdc++) does // not fully support C++ 20 even for Qt >= 6.4 auto const latest_qdate = QDate(static_cast(latest_date.year()), // static_cast(unsigned(latest_date.month())), // diff --git a/build.sh b/build.sh index 8a0e380..0d4268d 100755 --- a/build.sh +++ b/build.sh @@ -15,9 +15,8 @@ LIBCXX="libstdc++11" CLEAR_BUILD=false CONAN=conan - print_usage() { -cat << EOM + cat </dev/null 2>&1 && pwd )" +SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" -find "${SELF_DIR}" -name '*.h' -o -name '*.h' -o -name '*.cpp' | xargs clang-format -i -style=file -find "${SELF_DIR}" -name 'CMakeLists.txt' -o -name '*.cmake' | xargs cmake-format -i +find "${SELF_DIR}" \( -name '*.h' -o -name '*.cpp' \) -print0 | xargs -0 clang-format -i -style=file +find "${SELF_DIR}" \( -name 'CMakeLists.txt' -o -name '*.cmake' \) -print0 | xargs -0 cmake-format -i diff --git a/include/coronan/corona-api_datatypes.h b/include/coronan/corona-api_datatypes.h index f73e287..7ee36bd 100644 --- a/include/coronan/corona-api_datatypes.h +++ b/include/coronan/corona-api_datatypes.h @@ -63,7 +63,7 @@ struct CountryData * Holds the latest available covid-19 case data of the country */ - CovidData latest{}; /**< Lates actual cases */ + CovidData latest{}; /**< Latest actual cases */ std::vector timeline; /**< Timeline data (list of daily data) */ }; diff --git a/include/coronan/ssl_client.h b/include/coronan/ssl_client.h index 4cd15a3..d1fe9a1 100644 --- a/include/coronan/ssl_client.h +++ b/include/coronan/ssl_client.h @@ -18,8 +18,8 @@ class SSLClient final { public: /** - * Return a SSLClient with an accept all certifcates handler - * @return SSLClient which must be hold by the caler until no longer needed. + * Return a SSLClient with an accept all certificates handler + * @return SSLClient which must be hold by the caller until no longer needed. */ [[nodiscard]] static std::unique_ptr create_with_accept_certificate_handler(); diff --git a/tests/corona-api_json_parser_test.cpp b/tests/corona-api_json_parser_test.cpp index 29469e8..d60b216 100644 --- a/tests/corona-api_json_parser_test.cpp +++ b/tests/corona-api_json_parser_test.cpp @@ -32,7 +32,7 @@ TEST_CASE("The corona-api parser parsing an invalid json", "[corona-api parser]" } } -TEST_CASE("The corona-api parser parsing an region total json with invalide date", "[corona-api parser]") +TEST_CASE("The corona-api parser parsing an region total json with invalid date", "[corona-api parser]") { static constexpr auto test_json = "{ \ \"data\": { \ diff --git a/typos.toml b/typos.toml new file mode 100644 index 0000000..41c2887 --- /dev/null +++ b/typos.toml @@ -0,0 +1,7 @@ +[default] +locale = "en-us" +check-filename = true +check-file = true + +[default.extend-words] +THA = "THA"