Skip to content

One line changes don't detected as problematic in lines-changed-only=true mode #416

@Alexolut

Description

@Alexolut

What events trigger your workflow?

on:
  workflow_call:

What OS does your workflow use?

runs-on: ubuntu-latest

How is cpp-linter-action configured?

- name: Format check
        uses: cpp-linter/cpp-linter-action@v2.17.0
        id: linter
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          style: file
          tidy-checks: '-*'
          version: '22'
          step-summary: true
          lines-changed-only: true
          format-review: true
          passive-reviews: true
          thread-comments: update
          verbosity: debug

What was the unexpected behavior?

In case I have changed only single line (or several lines but not adjacent). For example, lines 42 and 100 in .cpp file. Broken formatting will not be detected on such lines. Checks return zero statuses:

INFO:CPP Linter:0 clang-format-checks-failed
INFO:CPP Linter:0 clang-tidy-checks-failed
INFO:CPP Linter:0 checks-failed

If I do changes in 2 or more adjacent lines (e.g. 42 and 43) invalid formatting will be detected correctly.

Works fine when only single line is changed but lines-changed-only set to diff.

Seems the problem arises when we have same numbers on --lines option to clang-format. E.g.:

--lines=42:42 --lines=100:100

Checked with old clang-format 18.1.8 as well. Same issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions