Skip to content

Clang-tidy detects issues in code, but WarningsAsErrors pervents cpp-linter from reporting them #347

@FelipeGdM

Description

@FelipeGdM

What events trigger your workflow?

name: cpp-linter-all
on:
  pull_request:
  push:

permissions:
  pull-requests: write
  contents: write

jobs:
  cpp-linter:
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v5

      - name: Install dependencies
        run: sudo apt-get update && sudo apt-get install -y libc6 wget lsb-release build-essential software-properties-common gnupg cmake qtbase5-dev qt5-qmake libqt5opengl5-dev libprotobuf-dev mesa-common-dev libglu1-mesa-dev protobuf-compiler

      - name: Generate build files
        run: mkdir build && cd build && cmake .. && make proto_msgs_autogen VSSReferee_autogen
        # ... optionally setup build env to create a compilation database

      - uses: cpp-linter/cpp-linter-action@v2
        id: linter
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          ignore: '.github|build|src|!src/world/entities/vision'
          style: ''  # disable clang-format checks.
          tidy-checks: '' # Use .clang-tidy config file.
          step-summary: true
          thread-comments: false
          no-lgtm: false
          files-changed-only: false
          database: 'build/'
          verbosity: 'debug'

      - name: Debug output variables
        run: |
          echo "Checks failed: ${{ steps.linter.outputs.checks-failed }}"
          echo "Tidy checks failed: ${{ steps.linter.outputs.clang-tidy-checks-failed }}"
          echo "Files analyzed: ${{ steps.linter.outputs }}"

      - name: Fail fast?!
        if: steps.linter.outputs.clang-tidy-checks-failed > 0
        run: exit 1

What OS does your workflow use?

runs-on: ubuntu-22.04

How is cpp-linter-action configured?

- uses: cpp-linter/cpp-linter-action@v2
        id: linter
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          ignore: '.github|build|src|!src/world/entities/vision'
          style: ''  # disable clang-format checks.
          tidy-checks: '' # Use .clang-tidy config file.
          step-summary: true
          thread-comments: false
          no-lgtm: false
          files-changed-only: false
          database: 'build/'
          verbosity: 'debug'

What was the unexpected behavior?

A lot of errors are detected by clang-tidy, but the output message is "No problems need attention."

The action fails to count the total amount of errors

Final lines of log

DEBUG:CPP Linter:clang-tidy made the following summary:
13115 warnings generated.
Suppressed 13112 warnings (13112 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
3 warnings treated as errors

Value of steps.linter.outputs.checks-failed and steps.linter.outputs.clang-tidy-checks-failed

Checks failed: 0
Tidy checks failed: 0

The complete run is available at https://github.com/futebol-mini/VSSReferee/actions/runs/18019987310

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions