diff --git a/.github/workflows/v2-preview.yml b/.github/workflows/v2-preview.yml new file mode 100644 index 0000000..3347d25 --- /dev/null +++ b/.github/workflows/v2-preview.yml @@ -0,0 +1,48 @@ +# Temporary: produces the cpp-linter v2 (cpp-linter-rs) preview screenshots +# for the cpp-linter-rs README. Remove after the screenshots are taken. +name: v2 preview + +on: + pull_request: + branches: [master] + +permissions: + contents: read + pull-requests: write + +jobs: + cpp-linter: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + + - name: Install cpp-linter v2 + env: + GH_TOKEN: ${{ github.token }} + run: >- + gh release download cpp-linter/v2.0.0-rc.25 + -R cpp-linter/cpp-linter-rs + --pattern cpp-linter-x86_64-unknown-linux-gnu.tar.gz + --output - | tar xz -C "$RUNNER_TEMP" + + - name: Generate compilation database + run: cmake -Bbuild src + + - name: Run cpp-linter + id: linter + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: >- + "$RUNNER_TEMP/cpp-linter" + --style=file + --tidy-checks="" + --version=21 + --ignore=build + --database=build + --extra-arg="-std=c++14 -Wall" + --thread-comments=update + --pr-review=true + --file-annotations=true + --step-summary=true diff --git a/src/demo.cpp b/src/demo.cpp index 0c1db60..c83a545 100644 --- a/src/demo.cpp +++ b/src/demo.cpp @@ -6,6 +6,13 @@ // using size_t from cstddef size_t dummyFunc(size_t i) { return i; } +namespace { +bool hasName(const char* name) +{ + return name; +} +} // namespace + int main() { for (;;) @@ -13,5 +20,5 @@ int main() printf("Hello world!\n"); - return 0; + return hasName("demo") ? 0 : 42; }