Unformat
generates .clang-format file from example codebase
Install / Use
/learn @johnmcfarlane/UnformatREADME
Unformat
Python3 utility to generate a .clang-format file from example code-base.
Description
Given the path to a C, C++ or Objective-C project, attempts to generate the perfect .clang-format file. It does this by producing configuration files with random variations and measuring how much code they would change. Finally the configuration file with the least change is output.
Dependencies
Tested under Python 3.5 using clang-format 3.9 and clang-format 3.8.
Python modules you'll need to install:
To add dependencies to a Ubuntu or Debian system:
sudo apt install clang-format python3-levenshtein python3-yaml
Examples
If Unformat is cloned into /home/abc/unformat and C++ source code is in /home/abc/my_project,
python3 /home/abc/unformat --root /home/abc/my_project /home/abc/my_project/**/*.h /home/abc/my_project/**/*.cpp
will search for the best .clang-format file.
It will start searching from /home/abc/my_project/.clang-format
and will write new configurations to that location as they are found.
(Note you must have
globstar enabled
to make use of recursive (**) wildcards.)
The search may continue indefinitely. Press Ctrl-C to stop early. Any intermediate results will be written out.
Links
To submit feedback and bug reports, please file an issue.
For another solution to this problem, check out whatstyle.
Related Skills
node-connect
343.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
92.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
343.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
343.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
