diff --git a/.github/actions/install-dependencies/action.yml b/.github/actions/install-dependencies/action.yml new file mode 100644 index 0000000..50aa6d6 --- /dev/null +++ b/.github/actions/install-dependencies/action.yml @@ -0,0 +1,10 @@ +name: Set up dependencies +description: Set up dependencies for the project +runs: + using: composite + steps: + - name: Install dependencies + shell: bash + run: | + sudo apt-get update + sudo apt-get install -y libgtest-dev valgrind llvm gcovr graphviz diff --git a/.github/workflows/apidocs.yml b/.github/workflows/apidocs.yml new file mode 100644 index 0000000..5268c31 --- /dev/null +++ b/.github/workflows/apidocs.yml @@ -0,0 +1,54 @@ +name: Deploy API Docs to Pages + +on: + push: + branches: + - master + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy: + name: Deploy + permissions: + contents: read + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Check out the source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + + - name: Install Doxygen + uses: ssciwr/doxygen-install@527824132256e685f03ec80c0851fe79937eb1d6 # v1.6.3 + with: + version: "1.12.0" + + - name: Generate API Docs + run: | + cmake -B build + cmake --build build --target docs + + - name: Setup Pages + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 + + - name: Upload artifact + uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 + with: + path: apidocs + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 diff --git a/.github/workflows/ci-vcpkg.yml b/.github/workflows/ci-vcpkg.yml new file mode 100644 index 0000000..91683f5 --- /dev/null +++ b/.github/workflows/ci-vcpkg.yml @@ -0,0 +1,67 @@ +name: Build and Test (vcpkg) + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: Build and Test (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + include: + - os: windows-latest + triplet: x64-windows-release + - os: macos-latest + triplet: arm64-osx-release + - os: ubuntu-latest + triplet: x64-linux-release + runs-on: ${{ matrix.os }} + permissions: + contents: read + env: + VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }} + VCPKG_DEFAULT_HOST_TRIPLET: ${{ matrix.triplet }} + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true + fetch-depth: 0 + + - name: Set up cmake and ninja + uses: lukka/get-cmake@5f6e04f5267c8133f1273bf2103583fc72c46b17 # v3.31.5 + + - name: Set up vcpkg + uses: lukka/run-vcpkg@5e0cab206a5ea620130caf672fce3e4a6b5666a1 # v11.5 + + # - name: Fix for AppleClang + # run: | + # sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer + # if: runner.os == 'macOS' + + - name: Build and test + run: | + cmake --preset debug-vcpkg -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF + cmake --build --preset debug-vcpkg + ctest --preset debug-vcpkg + + - name: Install + run: sudo cmake --install build + if: runner.os != 'Windows' + + - name: Install (Windows) + run: cmake --install build --config Debug + if: runner.os == 'Windows' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..05c8742 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,97 @@ +name: Build and Test + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + prepare: + name: Prepare list of configurations + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + presets: ${{ steps.set-matrix.outputs.presets }} + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + disable-sudo: true + egress-policy: block + allowed-endpoints: > + github.com:443 + + - name: Check out the source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set matrix + id: set-matrix + run: echo presets="$(jq '.configurePresets[] | select(.hidden == false) | {name, description}' CMakePresets.json | jq --slurp -c .)" >> "${GITHUB_OUTPUT}" + + build: + needs: prepare + name: Build and Test (${{ matrix.preset.description }}) + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + preset: ${{ fromJson(needs.prepare.outputs.presets) }} + permissions: + contents: read + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + allowed-endpoints: > + api.github.com:443 + azure.archive.ubuntu.com:80 + esm.ubuntu.com:443 + github.com:443 + motd.ubuntu.com:443 + objects.githubusercontent.com:443 + packages.microsoft.com:443 + + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true + fetch-depth: 0 + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + + - name: Build and test + run: | + cmake --preset ${{ matrix.preset.name }} -DBUILD_DOCS=OFF + cmake --build --preset ${{ matrix.preset.name }} -j $(nproc) + ctest --preset ${{ matrix.preset.name }} + + build-ext: + name: Build and Test (external dependencies) + runs-on: ubuntu-24.04 + permissions: + contents: read + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: block + allowed-endpoints: > + github.com:443 + + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Build and test + run: | + cmake --preset default -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF + cmake --build --preset default -j $(nproc) + ctest --preset default + sudo cmake --install build diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml new file mode 100644 index 0000000..3121841 --- /dev/null +++ b/.github/workflows/clang-tidy.yml @@ -0,0 +1,43 @@ +name: clang-tidy + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + clang-tidy: + name: Run clang-tidy + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: block + allowed-endpoints: > + api.github.com:443 + azure.archive.ubuntu.com:80 + esm.ubuntu.com:443 + github.com:443 + motd.ubuntu.com:443 + objects.githubusercontent.com:443 + packages.microsoft.com:443 + + - name: Check out the source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + + - name: Configure + run: cmake -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON + + - name: Run clang-tidy + run: clang-tidy -p build $(jq -r '.[].file' build/compile_commands.json) --warnings-as-errors='*' diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..f12060f --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,60 @@ +name: CodeQL + +on: + push: + branches: + - master + pull_request: + branches: + - master + schedule: + - cron: '1 23 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-24.04 + timeout-minutes: 60 + permissions: + security-events: write + actions: read + contents: read + strategy: + fail-fast: false + matrix: + language: + - c-cpp + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: block + allowed-endpoints: > + api.github.com:443 + azure.archive.ubuntu.com:80 + esm.ubuntu.com:443 + github.com:443 + motd.ubuntu.com:443 + objects.githubusercontent.com:443 + packages.microsoft.com:443 + + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Initialize CodeQL + uses: github/codeql-action/init@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 + with: + languages: ${{ matrix.language }} + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + + - name: Build + run: | + cmake -B build -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF + cmake --build build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9 + with: + category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/ctest.yml b/.github/workflows/ctest.yml new file mode 100644 index 0000000..8a591fc --- /dev/null +++ b/.github/workflows/ctest.yml @@ -0,0 +1,106 @@ +name: Test + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + prepare: + name: Prepare list of configurations + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + scripts: ${{ steps.set-matrix.outputs.scripts }} + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + disable-sudo: true + egress-policy: block + allowed-endpoints: > + github.com:443 + + - name: Check out the source code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Set matrix + id: set-matrix + run: echo scripts="$(for i in ctest/*.ctest.cmake; do echo '"'$(basename $i .ctest.cmake)'"'; done | jq --slurp -c)" >> "${GITHUB_OUTPUT}" + + test: + needs: prepare + name: Test (${{ matrix.script }}) + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + script: ${{ fromJson(needs.prepare.outputs.scripts) }} + permissions: + contents: read + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: block + allowed-endpoints: > + api.github.com:443 + azure.archive.ubuntu.com:80 + esm.ubuntu.com:443 + github.com:443 + motd.ubuntu.com:443 + objects.githubusercontent.com:443 + packages.microsoft.com:443 + + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + + - name: Run tests + run: ctest -V -S "ctest/${{ matrix.script }}.ctest.cmake" + + - name: Upload test tesults + if: always() + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: Test Results (${{ matrix.script }}) + path: | + build/junit.xml + build/Testing/Temporary/MemoryChecker.*.log + + publish: + needs: test + name: Publish Results + runs-on: ubuntu-latest + if: always() + permissions: + contents: read + checks: write + pull-requests: write + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + disable-sudo: true + egress-policy: block + allowed-endpoints: > + api.github.com:443 + + - name: Download test results + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 + with: + path: test-results + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@170bf24d20d201b842d7a52403b73ed297e6645b # v2.18.0 + with: + files: test-results/**/junit.xml + check_run: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..83d4bcf --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,44 @@ +name: Lint C++ code + +on: + push: + branches: + - master + pull_request: + workflow_dispatch: + +permissions: + contents: none + +jobs: + lint: + name: clang-format (${{ matrix.path }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + path: + - examples + - src + - test + permissions: + contents: read + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + disable-sudo: true + egress-policy: block + allowed-endpoints: > + ghcr.io:443 + github.com:443 + pkg-containers.githubusercontent.com:443 + + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: clang-format Check + uses: jidicula/clang-format-action@d05cecd4a1a5b7e64c22f5a468456135a43f13f6 # v4.14.0 + with: + clang-format-version: 19 + check-path: ${{ matrix.path }} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml new file mode 100644 index 0000000..2a45374 --- /dev/null +++ b/.github/workflows/sonarcloud.yml @@ -0,0 +1,74 @@ +name: SonarCloud +on: + push: + branches: + - master + pull_request: + types: + - opened + - synchronize + - reopened + +permissions: + contents: read + +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + env: + BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory + permissions: + contents: read + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + allowed-endpoints: + analysis-sensorcache-eu-central-1-prod.s3.amazonaws.com:443 + api.github.com:443 + api.nuget.org:443 + api.sonarcloud.io:443 + azure.archive.ubuntu.com:80 + binaries.sonarsource.com:443 + cli.codecov.io:443 + esm.ubuntu.com:443 + github.com:443 + ingest.codecov.io:443 + keybase.io:443 + motd.ubuntu.com:443 + o26192.ingest.us.sentry.io:443 + packages.microsoft.com:443 + scanner.sonarcloud.io:443 + sonarcloud.io:443 + storage.googleapis.com:443 + + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + + - name: Generate compilation database + run: cmake -B build -DCMAKE_BUILD_TYPE=Coverage -DCMAKE_CXX_COMPILER=clang++ + + - name: Generate coverage report + run: cmake --build build --target coverage -j $(nproc) + + - name: Run sonar-scanner + uses: SonarSource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 # v4.2.1 + with: + args: > + --define sonar.cfamily.compile-commands=build/compile_commands.json + --define sonar.coverageReportPaths=build/coverage/coverage.xml + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: build/coverage/coverage.lcov diff --git a/.github/workflows/update-vcpkg-baseline.yml b/.github/workflows/update-vcpkg-baseline.yml new file mode 100644 index 0000000..229a5a5 --- /dev/null +++ b/.github/workflows/update-vcpkg-baseline.yml @@ -0,0 +1,52 @@ +name: Update vcpkg baseline + +on: + push: + paths: + - 'vcpkg' + workflow_dispatch: + +permissions: + contents: read + +jobs: + update-baseline: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: Check out code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + submodules: true + + - name: Get latest vcpkg baseline + id: vcpkg-baseline + run: | + BASELINE="$(git submodule status vcpkg | awk '{print $1}')" + echo "baseline=${BASELINE}" >> ${GITHUB_OUTPUT} + + - name: Update vcpkg-configuration.json + run: | + jq --arg baseline "${{ steps.vcpkg-baseline.outputs.baseline }}" '.["default-registry"].baseline = $baseline' vcpkg-configuration.json > tmp.$$.json && mv tmp.$$.json vcpkg-configuration.json + if ! git diff --quiet vcpkg-configuration.json; then + echo "KEEP_GOING=yes" >> "${GITHUB_ENV}" + fi + + - name: Create Pull Request + uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6 + with: + commit-message: "chore(deps): update default registry's baseline to `${{ steps.vcpkg-baseline.outputs.baseline }}`" + title: "chore(deps): update default registry's baseline to `${{ steps.vcpkg-baseline.outputs.baseline }}`" + body: | + This PR updates default registry's baseline to `${{ steps.vcpkg-baseline.outputs.baseline }}`. + branch: "update-vcpkg-baseline-${{ steps.vcpkg-baseline.outputs.baseline }}" + labels: dependencies + token: ${{ secrets.REPOSITORY_ACCESS_TOKEN }} + if: env.KEEP_GOING == 'yes' diff --git a/ctest/asan.ctest.cmake b/ctest/asan.ctest.cmake index 3f6fc60..9ba66d6 100644 --- a/ctest/asan.ctest.cmake +++ b/ctest/asan.ctest.cmake @@ -4,7 +4,7 @@ set(CTEST_CONFIGURATION_TYPE "ASAN") set(CTEST_MEMORYCHECK_TYPE "AddressSanitizer") ctest_start(Experimental) -set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_BENCHMARKS=OFF) +set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF) ctest_configure(OPTIONS "${options}") ctest_build() ctest_memcheck( diff --git a/ctest/coverage.ctest.cmake b/ctest/coverage.ctest.cmake index fcc9762..4f03221 100644 --- a/ctest/coverage.ctest.cmake +++ b/ctest/coverage.ctest.cmake @@ -8,7 +8,7 @@ if(CTEST_COVERAGE_COMMAND) endif() ctest_start(Experimental) -set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_BENCHMARKS=OFF) +set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF) ctest_configure(OPTIONS "${options}") ctest_build() ctest_test( diff --git a/ctest/lsan.ctest.cmake b/ctest/lsan.ctest.cmake index 1306996..ece4946 100644 --- a/ctest/lsan.ctest.cmake +++ b/ctest/lsan.ctest.cmake @@ -4,7 +4,7 @@ set(CTEST_CONFIGURATION_TYPE "LSAN") set(CTEST_MEMORYCHECK_TYPE "LeakSanitizer") ctest_start(Experimental) -set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_BENCHMARKS=OFF) +set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF) ctest_configure(OPTIONS "${options}") ctest_build() ctest_memcheck( diff --git a/ctest/ubsan.ctest.cmake b/ctest/ubsan.ctest.cmake index f83d6fb..96ed8c7 100644 --- a/ctest/ubsan.ctest.cmake +++ b/ctest/ubsan.ctest.cmake @@ -4,7 +4,7 @@ set(CTEST_CONFIGURATION_TYPE "UBSAN") set(CTEST_MEMORYCHECK_TYPE "UndefinedBehaviorSanitizer") ctest_start(Experimental) -set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_BENCHMARKS=OFF) +set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF) ctest_configure(OPTIONS "${options}") ctest_build() ctest_memcheck( diff --git a/ctest/valgrind.ctest.cmake b/ctest/valgrind.ctest.cmake index cd6371d..707f748 100644 --- a/ctest/valgrind.ctest.cmake +++ b/ctest/valgrind.ctest.cmake @@ -8,7 +8,7 @@ set(CTEST_MEMORYCHECK_TYPE "Valgrind") ctest_start(Experimental) if(CTEST_MEMORYCHECK_COMMAND) - set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_BENCHMARKS=OFF) + set(options -DCMAKE_CXX_COMPILER=clang++ -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=OFF) ctest_configure(OPTIONS "${options}") ctest_build() ctest_memcheck( diff --git a/test/.clang-tidy b/test/.clang-tidy index 6e0786b..8c2ce80 100644 --- a/test/.clang-tidy +++ b/test/.clang-tidy @@ -2,4 +2,6 @@ InheritParentConfig: true Checks: > -readability-function-cognitive-complexity, - -cppcoreguidelines-special-member-functions + -cppcoreguidelines-special-member-functions, + -clang-analyzer-cplusplus.Move, + -clang-analyzer-deadcode.DeadStores diff --git a/test/exit_action.cpp b/test/exit_action.cpp index c6c4b53..2e85e24 100644 --- a/test/exit_action.cpp +++ b/test/exit_action.cpp @@ -56,7 +56,7 @@ TEST(ExitAction, LambdaMove) EXPECT_EQ(i, 1); { - auto _2 = std::move(_1); + auto _2 = std::move(_1); // NOLINT(bugprone-use-after-move) EXPECT_EQ(i, 1); } @@ -186,7 +186,7 @@ TEST(ExitAction, Movable) EXPECT_EQ(i, 1); { - auto _2 = std::move(_1); + auto _2 = std::move(_1); // NOLINT(bugprone-use-after-move) EXPECT_EQ(i, 1); } diff --git a/test/fail_action.cpp b/test/fail_action.cpp index 1ba7b2a..effec5b 100644 --- a/test/fail_action.cpp +++ b/test/fail_action.cpp @@ -70,7 +70,7 @@ TEST(FailAction, LeaveScopeWithException) { j = 0; try { - G g; + const G g; throw std::exception(); } catch (...) { @@ -118,7 +118,7 @@ TEST(FailAction, LambdaMove) EXPECT_EQ(i, 1); try { - auto _2 = std::move(_1); + auto _2 = std::move(_1); // NOLINT(bugprone-use-after-move) EXPECT_EQ(i, 1); throw std::runtime_error("error"); } @@ -129,7 +129,7 @@ TEST(FailAction, LambdaMove) EXPECT_EQ(i, 1); { - auto _3 = std::move(_1); + auto _3 = std::move(_1); // NOLINT(bugprone-use-after-move) EXPECT_EQ(i, 1); } } diff --git a/test/success_action.cpp b/test/success_action.cpp index dd58efb..b8251cf 100644 --- a/test/success_action.cpp +++ b/test/success_action.cpp @@ -70,7 +70,7 @@ TEST(SuccessAction, LeaveScopeWithoutException) { j = 0; try { - G g; + const G g; throw std::exception(); } catch (...) { @@ -110,7 +110,7 @@ TEST(SuccessAction, LambdaMove) EXPECT_EQ(i, 1); { - auto _2 = std::move(_1); + auto _2 = std::move(_1); // NOLINT(bugprone-use-after-move) EXPECT_EQ(i, 1); } @@ -118,7 +118,7 @@ TEST(SuccessAction, LambdaMove) { try { - auto _3 = std::move(_1); + auto _3 = std::move(_1); // NOLINT(bugprone-use-after-move) EXPECT_EQ(i, 1); throw std::runtime_error("error"); }