Skip to content

clang-format-18 false negative when using function-try block #250

Open
@Alexolut

Description

@Alexolut

I have code like this, formatted locally with clang-format. I use function-try-block here:

void TestFunc(const std::string& data) try {
    do_something();
    do_something_more();
} catch (const std::exception& ex) {
    log_error(ex);
}

cpp-linter has complaints on this code, pointing to the line with catch (99):

Notice: File filename.cpp does not conform to Custom style guidelines. (lines 99)

At the same time I don't see any diff suggestions in PR despite I have format-review: true and if I intentionally add wrongly-formatted changes on other lines - I will see only diff for those lines (but line with catch still won't be in diff for some reason).

Full list of options that I use:

        uses: cpp-linter/[email protected]
        id: linter
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          style: file
          tidy-checks: '-*'
          version: '18'
          step-summary: true
          lines-changed-only: true
          format-review: true
          passive-reviews: true
          thread-comments: update

Looks like everything is OK with formatting, but cpp-linter mark that code as not-formatted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions