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/.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/.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/Dockerfile b/.devcontainer/Dockerfile index d5eb1b0..8c8a1bd 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,30 +1,25 @@ -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 \ - 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 \ && rm -rf /var/lib/apt/lists/* # Install locales package and generate en_US.UTF-8 locale @@ -132,3 +127,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..46df28b 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,40 +1,60 @@ { - "name": "C++", - "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" - ], - "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" - ] - } - } + "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/.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-sanitizer.yml similarity index 98% rename from .github/workflows/ci-linux-sanatizer.yml rename to .github/workflows/ci-linux-sanitizer.yml index a3d0365..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: @@ -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 2cb2e96..88368ca 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 @@ -124,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 }} @@ -168,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/.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/.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/.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 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 7c38055..a8ccbeb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,35 +1,81 @@ --- 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 + 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.0 + 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 77e91bc..1e6a755 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 - }, - "problemMatcher": { - "base": "$gcc" - }, - "options": { - "cwd": "${workspaceFolder}/" - }, - "type": "shell", - "presentation": { - "clear": true - } + "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 }, - { - "label": "clean", - "command": "/usr/bin/rm -rf build", - "group": "build", - "problemMatcher": [], - "type": "shell" + "options": { + "cwd": "${workspaceFolder}/" }, - { - "label": "unittests", - "command": "cmake --build --preset=run-unittests", - "group": { - "isDefault": true, - "kind": "test" - }, - "options": { - "cwd": "${workspaceFolder}" - }, - "problemMatcher": [], - "type": "shell" + "type": "shell", + "presentation": { + "clear": true + } + }, + { + "label": "build", + "command": "cmake --build build", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": { + "base": "$gcc" }, - { - "label": "format files", - "command": "./format_source_files.sh", - "problemMatcher": [], - "type": "shell" + "options": { + "cwd": "${workspaceFolder}/" }, - { - "label": "run pre-commit hooks", - "command": "pre-commit run --all-files", - "problemMatcher": [], - "type": "shell" + "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": "GCC", + "value": "gcc" + }, + { + "label": "Clang", + "value": "clang" + } + ] + }, + { + "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" + } + ] + } + ] +} diff --git a/CMakePresets.json b/CMakePresets.json index b7385da..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 (gcc)", - "description": "Configure Release (gcc)", - "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 06095da..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) @@ -26,19 +25,18 @@ [![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) - -[![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) - +[![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) +[![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. @@ -48,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
@@ -74,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 @@ -197,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 + 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 @@ -227,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. @@ -275,17 +273,18 @@ 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 -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.: 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..0def5b7 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 @@ -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/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..44834ca 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 @@ -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 ee84952..bb3d422 100644 --- a/apps/qt/CMakeLists.txt +++ b/apps/qt/CMakeLists.txt @@ -43,11 +43,11 @@ 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 +# 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}) @@ -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/cmake/Qt.cmake b/apps/qt/cmake/Qt.cmake index 0688d90..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) @@ -37,7 +36,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_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 74c7ab1..e60edc8 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; @@ -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" + // 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(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)}; @@ -42,11 +38,11 @@ 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(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/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..1dff4af 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 @@ -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 e04701d..5882515 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 @@ -60,11 +60,11 @@ 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(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/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 diff --git a/build.sh b/build.sh index a051393..0d4268d 100755 --- a/build.sh +++ b/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e @@ -11,12 +11,12 @@ BUILD_TARGET="--target all" CXX_COMPILER="g++" C_COMPILER="gcc" COMPILER_VERSION="$(g++ -dumpversion)" +LIBCXX="libstdc++11" CLEAR_BUILD=false CONAN=conan - print_usage() { -cat << EOM + cat < 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/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/docs/CMakeLists.txt b/docs/CMakeLists.txt index 3c49c73..3b9720f 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -5,7 +5,7 @@ if(EXISTS "${PROJECT_SOURCE_DIR}/README.md") set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "${PROJECT_SOURCE_DIR}/README.md") endif() -# enable doxygen documentaion with the "awesome-sidebar" theme +# enable doxygen documentation with the "awesome-sidebar" theme enable_doxygen("awesome-sidebar") add_custom_command( diff --git a/format_source_files.sh b/format_source_files.sh index c5ea518..a09d7ae 100755 --- a/format_source_files.sh +++ b/format_source_files.sh @@ -1,8 +1,8 @@ -#!/bin/bash +#!/usr/bin/env bash set -e -SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +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 '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_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 97% rename from include/coronan/corona-api_datatypes.hpp rename to include/coronan/corona-api_datatypes.h index f73e287..7ee36bd 100644 --- a/include/coronan/corona-api_datatypes.hpp +++ 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/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 87% rename from include/coronan/ssl_client.hpp rename to include/coronan/ssl_client.h index 4cd15a3..d1fe9a1 100644 --- a/include/coronan/ssl_client.hpp +++ 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/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/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 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-lock.toml b/nix/nix-lock.toml similarity index 60% rename from nix-lock.toml rename to nix/nix-lock.toml index bcd5d2f..f2d0a82 100644 --- a/nix-lock.toml +++ b/nix/nix-lock.toml @@ -4,6 +4,6 @@ rev = "63dacb46bf939521bdc93981b4cbb7ecb58427a0" sha256 = "1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx" [cmake] -ref = "3.31.4" -rev = "3.31.4" -sha256 = "09bz1y5jr4n2ln9q6zlm44ar78f0yxcl7qvjwrrmrfpmfpz0n4x6" +ref = "3.31.10" +rev = "3.31.10" +sha256 = "0a9y7nqr27rl8acvjyj8s57q87bdjxa9w2g5mphsh7ylsvgzl1ng" diff --git a/shell.nix b/nix/shell.nix similarity index 85% rename from shell.nix rename to nix/shell.nix index 06d3275..73bb969 100644 --- a/shell.nix +++ b/nix/shell.nix @@ -5,10 +5,6 @@ let clang = clang_18; 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 @@ -47,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 ''; } diff --git a/sources.nix b/nix/sources.nix similarity index 100% rename from sources.nix rename to nix/sources.nix 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 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..d60b216 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 @@ -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/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 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"