diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..1eed15a2 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,12 @@ +Checks: + - '-*' + - 'bugprone-*' + - 'clang-analyzer-*' + - 'cppcoreguidelines-*' + - 'misc-*' + - 'modernize-*' + - 'performance-*' + - '-misc-include-cleaner' + - '-misc-non-private-member-variables-in-classes' + - '-modernize-use-trailing-return-type' +FormatStyle: 'file' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 060be896..3340670e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: concurrency: # Cancel in-progress jobs for the same pull request - group: ${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: @@ -70,7 +70,7 @@ jobs: env: CC: ${{ matrix.env_cc }} CXX: ${{ matrix.env_cxx }} - SCWX_VERSION: v0.4.6 + SCWX_VERSION: v0.4.7 runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml new file mode 100644 index 00000000..acdcd586 --- /dev/null +++ b/.github/workflows/clang-format-check.yml @@ -0,0 +1,40 @@ +name: clang-format-check + +on: + workflow_dispatch: + pull_request: + branches: + - 'develop' + +concurrency: + # Cancel in-progress jobs for the same pull request + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + format: + runs-on: ubuntu-24.04 + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: false + + - name: Update References + shell: bash + run: | + git fetch origin develop + + - name: Setup Ubuntu Environment + shell: bash + run: | + sudo apt-get install clang-format-17 + + - name: Check Formatting + shell: bash + run: | + MERGE_BASE=$(git merge-base origin/develop ${{ github.event.pull_request.head.sha || github.ref }}) + echo "Comparing against ${MERGE_BASE}" + git clang-format-17 --diff --style=file -v ${MERGE_BASE} diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml new file mode 100644 index 00000000..0182e383 --- /dev/null +++ b/.github/workflows/clang-tidy-review.yml @@ -0,0 +1,140 @@ +name: clang-tidy-review + +on: + pull_request: + branches: + - 'develop' + +concurrency: + # Cancel in-progress jobs for the same pull request + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + include: + - name: linux64_clang-tidy + os: ubuntu-24.04 + build_type: Release + env_cc: clang-17 + env_cxx: clang++-17 + qt_version: 6.8.0 + qt_arch_aqt: linux_gcc_64 + qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport + qt_tools: '' + conan_arch: x86_64 + conan_compiler: clang + conan_compiler_version: 17 + conan_compiler_libcxx: --settings compiler.libcxx=libstdc++11 + conan_compiler_runtime: '' + conan_package_manager: --conf tools.system.package_manager:mode=install --conf tools.system.package_manager:sudo=True + compiler_packages: clang-17 clang-tidy-17 + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.env_cc }} + CXX: ${{ matrix.env_cxx }} + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + path: source + submodules: recursive + + - name: Checkout clang-tidy-review Repository + uses: actions/checkout@v4 + with: + repository: ZedThree/clang-tidy-review + ref: v0.20.1 + path: clang-tidy-review + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: ${{ matrix.qt_version }} + arch: ${{ matrix.qt_arch_aqt }} + modules: ${{ matrix.qt_modules }} + tools: ${{ matrix.qt_tools }} + + - name: Setup Ubuntu Environment + if: ${{ startsWith(matrix.os, 'ubuntu') }} + shell: bash + run: | + sudo apt-get install doxygen \ + libfuse2 \ + ninja-build \ + ${{ matrix.compiler_packages }} + + - name: Setup Python Environment + shell: pwsh + run: | + pip install geopandas ` + GitPython + pip install --break-system-packages clang-tidy-review/post/clang_tidy_review + + - name: Install Conan Packages + shell: pwsh + run: | + pip install "conan<2.0" + conan profile new default --detect + conan install ./source/ ` + --remote conancenter ` + --build missing ` + --settings arch=${{ matrix.conan_arch }} ` + --settings build_type=${{ matrix.build_type }} ` + --settings compiler="${{ matrix.conan_compiler }}" ` + --settings compiler.version=${{ matrix.conan_compiler_version }} ` + ${{ matrix.conan_compiler_libcxx }} ` + ${{ matrix.conan_compiler_runtime }} ` + ${{ matrix.conan_package_manager }} + + - name: Autogenerate + shell: pwsh + run: | + mkdir build + cd build + cmake ../source/ ` + -G Ninja ` + -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" ` + -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/supercell-wx" ` + -DCMAKE_EXPORT_COMPILE_COMMANDS=on + ninja scwx-qt_generate_counties_db ` + scwx-qt_generate_versions ` + scwx-qt_update_radar_sites ` + scwx-qt_autogen + + - name: Code Review + id: review + shell: bash + run: | + cd source + review --clang_tidy_binary=clang-tidy-17 \ + --token=${{ github.token }} \ + --repo='${{ github.repository }}' \ + --pr='${{ github.event.pull_request.number }}' \ + --build_dir='../build' \ + --base_dir='${{ github.workspace }}/source' \ + --clang_tidy_checks='' \ + --config_file='.clang-tidy' \ + --include='*.[ch],*.[ch]xx,*.[ch]pp,*.[ch]++,*.cc,*.hh' \ + --exclude='' \ + --apt-packages='' \ + --cmake-command='' \ + --max-comments=25 \ + --lgtm-comment-body='' \ + --split_workflow=false \ + --annotations=false \ + --parallel=0 + rsync -avzh --ignore-missing-args clang-tidy-review-output.json ../ + rsync -avzh --ignore-missing-args clang-tidy-review-metadata.json ../ + rsync -avzh --ignore-missing-args clang_fixes.json ../ + + - name: Upload Review + uses: ZedThree/clang-tidy-review/upload@v0.20.1 + + - name: Status Check + if: steps.review.outputs.total_comments > 0 + run: exit 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index f3e5d690..3df5ba4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.24) set(PROJECT_NAME supercell-wx) project(${PROJECT_NAME} - VERSION 0.4.6 + VERSION 0.4.7 DESCRIPTION "Supercell Wx is a free, open source advanced weather radar viewer." HOMEPAGE_URL "https://github.com/dpaulat/supercell-wx" LANGUAGES C CXX) @@ -27,7 +27,7 @@ set_property(DIRECTORY set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_ALL_NO_LIB") set(SCWX_DIR ${PROJECT_SOURCE_DIR}) -set(SCWX_VERSION "0.4.6") +set(SCWX_VERSION "0.4.7") option(SCWX_ADDRESS_SANITIZER "Build with Address Sanitizer" OFF) diff --git a/scwx-qt/scwx-qt.cmake b/scwx-qt/scwx-qt.cmake index da5bae9e..1c654b0e 100644 --- a/scwx-qt/scwx-qt.cmake +++ b/scwx-qt/scwx-qt.cmake @@ -21,9 +21,7 @@ find_package(Python COMPONENTS Interpreter) find_package(SQLite3) find_package(QT NAMES Qt6 - COMPONENTS BuildInternals - Core - Gui + COMPONENTS Gui LinguistTools Multimedia Network @@ -37,9 +35,7 @@ find_package(QT NAMES Qt6 REQUIRED) find_package(Qt${QT_VERSION_MAJOR} - COMPONENTS BuildInternals - Core - Gui + COMPONENTS Gui LinguistTools Multimedia Network @@ -510,6 +506,7 @@ source_group("I18N Files" FILES ${TS_FILES}) add_library(scwx-qt OBJECT ${PROJECT_SOURCES}) set_property(TARGET scwx-qt PROPERTY AUTOMOC ON) +set_property(TARGET scwx-qt PROPERTY AUTOGEN_ORIGIN_DEPENDS OFF) add_custom_command(OUTPUT ${COUNTIES_SQLITE_DB} COMMAND ${Python_EXECUTABLE} diff --git a/scwx-qt/source/scwx/qt/manager/log_manager.cpp b/scwx-qt/source/scwx/qt/manager/log_manager.cpp index 457c8d28..7ab18e56 100644 --- a/scwx-qt/source/scwx/qt/manager/log_manager.cpp +++ b/scwx-qt/source/scwx/qt/manager/log_manager.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include diff --git a/scwx-qt/source/scwx/qt/ui/setup/setup_wizard.cpp b/scwx-qt/source/scwx/qt/ui/setup/setup_wizard.cpp index 92be250f..9b265bd4 100644 --- a/scwx-qt/source/scwx/qt/ui/setup/setup_wizard.cpp +++ b/scwx-qt/source/scwx/qt/ui/setup/setup_wizard.cpp @@ -22,6 +22,9 @@ class SetupWizard::Impl public: explicit Impl() = default; ~Impl() = default; + + bool mapProviderPageIsRequired_ {MapProviderPage::IsRequired()}; + bool audioCodecPageIsRequired_ {AudioCodecPage::IsRequired()}; }; SetupWizard::SetupWizard(QWidget* parent) : @@ -66,14 +69,14 @@ int SetupWizard::nextId() const { case static_cast(Page::MapProvider): case static_cast(Page::MapLayout): - if (MapProviderPage::IsRequired()) + if (p->mapProviderPageIsRequired_) { return nextId; } break; case static_cast(Page::AudioCodec): - if (AudioCodecPage::IsRequired()) + if (p->audioCodecPageIsRequired_) { return nextId; }