Do you want to share your content on R-bloggers? Click here if you have a blog, or here If you don’t.
If this message is useful for you, I kindly request a minimum donation Buy a coffee for me. It will be used to continue my open source efforts. The complete explanation is here: A personal message from an Open Source employee.
You can send me questions for the blog using This form And subscribe to receive an e -mail when there is a new message.
I tried to recall the CPP11 -Package For about a year. I thought it was useful for my doctorate project and I wanted to help with its maintenance. However, a big challenge I found was the C ++ code style that was used in the package.
Earlier in 2025 I switched to Manjaro Linux and no longer offers binaries for clang 12, the version used in CPP11. Building clang-format-12 Required that I would download and compilate clang of the source code of the LLVM project, which was time -consuming.
Some PRs sent to CPP11 will fail when they do not strictly follow the Clang 12 -obligation style, because the actions for all non-leash. For reasons outside of my knowledge, the use of duty tools for VScode or Positron does not always produce the same results as do this:
clang_format=`which clang-format`
format: $(shell find . -name '*.hpp') $(shell find . -name '*.cpp')
@${clang_format} -i $?So I decided to make my own extension that clang would apply to C ++ code and change a pushed commit if the fluff does not yield the same results as the non -modified files. In this way I could send PRS to CPP11 without worrying about the code style, and it would save the compilation time for many users like me.
I have the clang format Repository to automate the compiling process clang-format-11” clang-format-12… and clang-format-19 of the LLVM broncode, and made the compiled binaries available for every 64-bit Linux distribution for local use or in Github promotions workflows.
Here is one Sample repository That shows how you can use the Clang format extension with any Github repository.
How it works:
- The user pushes a code with layout problems
- Github actions run on the Push/PR
- Will use this extension
clang-format-11”clang-format-12…, Orclang-format-19As asked to repair the layout and make the changes to the repository
When the code is made up correctly, the promotion will do nothing.
Easy Example Workflow to use the extension to repair code and automatically recover:
name: Auto-format C++ Code
on:
push:
branches: [ main, master, develop ]
pull_request:
branches: [ main, master, develop ]
permissions:
contents: write
pull-requests: write
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: true
- name: Format C++ code
uses: pachadotdev/clang-format@main
with:
version: '18'
auto-commit: true
commit-message: 'style: auto-format C++ code with clang-format-18'After pushing you should see:
- âś… Promotion is running successfully
- đź”§ code is made correctly
- 📝 Automatic commit with formatted changes
- 🎉 Clean, consistent code style
The Sample repository Shows more examples and other use cases for Pull requests.
Related
#Github #Actions #Extension #tool #apply #Clang #format #code #RBloggers


