Skip to content

Comments

C++ formatting suggestions on PRs#3829

Open
pshriwise wants to merge 3 commits intoopenmc-dev:developfrom
pshriwise:cpp-format-suggestions
Open

C++ formatting suggestions on PRs#3829
pshriwise wants to merge 3 commits intoopenmc-dev:developfrom
pshriwise:cpp-format-suggestions

Conversation

@pshriwise
Copy link
Contributor

Description

The C++ linter check has been a hassle for a number of contributors due to differing behavior for various versions of clang-format that sometimes aren't covered by our style file.

This PR adds the option for inline suggestions from the cpp-linter actions in a PR when the cpp-format-suggest label is applied to the PR.

When the C++ formatting check fails and the label isn't present, a comment is added by the workflow with instructions on how to get inline suggestions for format fixes. By adding the -label event trigger to the workflow, all one has to do to get these suggestions is add the label.

I can't really demonstrate this here until it's merged but here's a PR in my fork where I've been playing around with the updated workflow: pshriwise#33

Fixes #2746

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format (version 15) on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@gonuke
Copy link
Contributor

gonuke commented Feb 20, 2026

I'm not sure I see from your local testing how this is different from what it does now? It was already providing an annotation that indicated which lines were breaking the test, but not how it was failing or how to correct it. In your testing on your fork, I don't see different - or am I looking in the wrong place?

@gonuke
Copy link
Contributor

gonuke commented Feb 20, 2026

I'm not sure I see from your local testing how this is different from what it does now? It was already providing an annotation that indicated which lines were breaking the test, but not how it was failing or how to correct it. In your testing on your fork, I don't see different - or am I looking in the wrong place?

I spoke too soon... I see it now as code comments

@gonuke
Copy link
Contributor

gonuke commented Feb 20, 2026

Related - while I'm sure it's a class A hassle to do it - is there a plan or protocol for updating clang-format versions? V15 is now 3 years old and increasingly difficult to get on new development environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatting difficulties with clang-format

2 participants