From 92633e5ff27008f4abcc631b9a8eb46665adef1f Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Tue, 1 Mar 2022 21:37:11 +0100 Subject: [PATCH] try this reviewer (#668) * try this reviewer * test the reviewer with a very bad piece of code * it can't handle spaces * run cmake to find all the files * file go brr haha * cmake needs qt installed * rename file once again * use windows * also doesn't like brackets * can't use windows * install qt the linux way * try using cmake this way * cmon cmake * install qt before running cmake * forgot catch2 * need to install as root * add build dir * delete test file * fix 3 warnings * enable clazy * Revert "fix 3 warnings" This reverts commit 7e64d4a546c397b5b69554ccf6765bf0a068f695. * disable 3 warnings * add a bracket for readability * install clazy before * get qt 5 real * try lukkas cmake modules * dupe courtroom again to test clang-tidy * courtroom.cpp was a mistake * remove magic number warning --- .github/labeler.yml | 8 --- .github/workflows/clang-tidy-review.yml | 70 +++++++++++++++++++++++++ src/courtroom.cpp | 3 +- 3 files changed, 72 insertions(+), 9 deletions(-) delete mode 100644 .github/labeler.yml create mode 100644 .github/workflows/clang-tidy-review.yml diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 56c4cc7..0000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,8 +0,0 @@ -translation: - - resource/translations/* - -content: - - base/**/* - -good_luck: - - src/courtroom.cpp diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml new file mode 100644 index 0000000..4701f6b --- /dev/null +++ b/.github/workflows/clang-tidy-review.yml @@ -0,0 +1,70 @@ +name: clang-tidy-review + +on: [pull_request] + +jobs: + compile: + name: ${{matrix.buildname}} + runs-on: ${{matrix.os}} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + buildname: 'clang-tidy' + triplet: x64-linux + compiler: clang_64 + qt: '5.15.2' + + steps: + - uses: actions/checkout@v2 + + - name: Restore Qt cache + uses: actions/cache@v2.1.7 + id: cache-qt + with: + path: ${{github.workspace}}/Qt/${{matrix.qt}} + key: ${{matrix.os}}-qt-${{matrix.qt}}-cache + + - name: Install Qt + uses: jurplel/install-qt-action@v2 + with: + version: ${{matrix.qt}} + dir: ${{github.workspace}} + cached: ${{steps.cache-qt.outputs.cache-hit}} + aqtversion: '==1.1.2' + + - name: Install Catch2 + shell: bash + run: | + curl -L https://github.com/catchorg/Catch2/archive/v2.13.4.tar.gz -o catch2.tar.gz + tar xvf catch2.tar.gz + cd Catch2-2.13.4 + cmake -Bbuild -H. -DBUILD_TESTING=OFF + sudo cmake --build build/ --target install + + - name: Use CMake 3.20.1 + uses: lukka/get-cmake@v3.20.1 + + - name: Generate compile_commands.json + uses: lukka/run-cmake@v3 + with: + cmakeListsOrSettingsJson: CMakeListsTxtAdvanced + cmakeListsTxtPath: '${{github.workspace}}/CMakeLists.txt' + buildDirectory: '${{github.workspace}}/build' + cmakeAppendedArgs: >- + -DCMAKE_GLOBAL_AUTOGEN_TARGET=ON + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + -DENABLE_CLAZY:BOOL=ON + buildWithCMakeArgs: >- + --target autogen + + - uses: ZedThree/clang-tidy-review@v0.8.2 + id: review + with: + build_dir: 'build' + clang_tidy_checks: '-*,performance-*,readability-*,bugprone-*,clang-analyzer-*,cppcoreguidelines-*,mpi-*,misc-*,-cppcoreguidelines-owning-memory,-cppcoreguidelines-pro-bounds-constant-array-index,-cppcoreguidelines-init-variables,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-avoid-magic-numbers' + apt_packages: 'pkg-config,libzip-dev,libglu1-mesa-dev,libpulse-dev' + # If there are any comments, fail the check + - if: steps.review.outputs.total_comments > 0 + run: exit 1 diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6047cfa..d8a48a6 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -725,8 +725,9 @@ void Courtroom::set_widgets() log_margin = ao_app->get_log_margin(); log_timestamp = ao_app->get_log_timestamp(); log_timestamp_format = ao_app->get_log_timestamp_format(); - if (regenerate) + if (regenerate) { regenerate_ic_chatlog(); + } set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); ui_ic_chatlog->setFrameShape(QFrame::NoFrame);