Skip to content

Code suggestions do not respect .clang-format #162

Description

@jmillan

PR suggestions generated by clang-tidy-review are taken from the exported fixes ('--export-fixes' option). For example:

- DiagnosticName:  misc-const-correctness
    DiagnosticMessage:
      Message:         'variable ''isSyncPacket'' of type ''bool'' can be declared ''const'''
      FilePath:        '/Users/jmillan/src/mediasoup/worker/src/RTC/SvcConsumer.cpp'
      FileOffset:      19028
      Replacements:
        - FilePath:        '/Users/jmillan/src/mediasoup/worker/src/RTC/SvcConsumer.cpp'
          Offset:          19033
          Length:          0
          ReplacementText: 'const '
    Level:           Warning
    BuildDirectory:  '/Users/jmillan/src/mediasoup/worker/out/Release/build'

These fixes do not consider the format defined in .clang-format, even though .clang-tidy indicates so via FormatStyle: file.

This is a known limitation as indicated here.

The problem is that the current flow is broken:

  1. Create a PR.
  2. clang-tidy-review github action runs.
  3. It suggests a code change (with wrong format)
  4. Suggestion is committed.
  5. GH actions are restarted.
  6. The GH action running clang-format fails.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions