-
- Downloads
Format include directive blocks and ordering with clang-format
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first). First
run `clang-format` with the config file:
---
SortIncludes: false
...
Commit the result temporarily. Then run `clang-format` again with:
---
SortIncludes: true
IncludeCategories:
- Regex: 'sys/types.h'
Priority: -1
...
Commit the result temporarily. Start a new branch and cherry-pick the
second commit. Manually resolve conflicts to preserve indentation of
re-ordered includes. This cleans up the include ordering without
changing any other style.
Use the following command to run `clang-format`:
$ git ls-files -z -- \
'*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
egrep -z -v '^Source/cm_sha2' |
egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
egrep -z -v '^Utilities/(KW|cm).*/' |
egrep -z -v '^Tests/Module/GenerateExportHeader' |
egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
xargs -0 clang-format -i
This selects source files that do not come from a third-party.
Inspired-by:
Daniel Pfeifer <daniel@pfeifer-mail.de>
Showing
- Modules/CheckForPthreads.c 1 addition, 1 deletionModules/CheckForPthreads.c
- Source/CPack/IFW/cmCPackIFWGenerator.cxx 8 additions, 8 deletionsSource/CPack/IFW/cmCPackIFWGenerator.cxx
- Source/CPack/IFW/cmCPackIFWGenerator.h 1 addition, 1 deletionSource/CPack/IFW/cmCPackIFWGenerator.h
- Source/CPack/OSXScriptLauncher.cxx 2 additions, 2 deletionsSource/CPack/OSXScriptLauncher.cxx
- Source/CPack/WiX/cmCPackWIXGenerator.cxx 6 additions, 6 deletionsSource/CPack/WiX/cmCPackWIXGenerator.cxx
- Source/CPack/WiX/cmCPackWIXGenerator.h 1 addition, 1 deletionSource/CPack/WiX/cmCPackWIXGenerator.h
- Source/CPack/WiX/cmWIXAccessControlList.h 1 addition, 1 deletionSource/CPack/WiX/cmWIXAccessControlList.h
- Source/CPack/WiX/cmWIXFilesSourceWriter.h 1 addition, 1 deletionSource/CPack/WiX/cmWIXFilesSourceWriter.h
- Source/CPack/WiX/cmWIXPatch.h 1 addition, 1 deletionSource/CPack/WiX/cmWIXPatch.h
- Source/CPack/WiX/cmWIXShortcut.h 1 addition, 1 deletionSource/CPack/WiX/cmWIXShortcut.h
- Source/CPack/WiX/cmWIXSourceWriter.h 1 addition, 1 deletionSource/CPack/WiX/cmWIXSourceWriter.h
- Source/CPack/cmCPackArchiveGenerator.cxx 6 additions, 6 deletionsSource/CPack/cmCPackArchiveGenerator.cxx
- Source/CPack/cmCPackComponentGroup.cxx 1 addition, 1 deletionSource/CPack/cmCPackComponentGroup.cxx
- Source/CPack/cmCPackCygwinBinaryGenerator.cxx 4 additions, 4 deletionsSource/CPack/cmCPackCygwinBinaryGenerator.cxx
- Source/CPack/cmCPackCygwinSourceGenerator.cxx 5 additions, 5 deletionsSource/CPack/cmCPackCygwinSourceGenerator.cxx
- Source/CPack/cmCPackDebGenerator.cxx 6 additions, 6 deletionsSource/CPack/cmCPackDebGenerator.cxx
- Source/CPack/cmCPackDragNDropGenerator.cxx 2 additions, 2 deletionsSource/CPack/cmCPackDragNDropGenerator.cxx
- Source/CPack/cmCPackGenerator.cxx 7 additions, 7 deletionsSource/CPack/cmCPackGenerator.cxx
- Source/CPack/cmCPackGeneratorFactory.cxx 9 additions, 9 deletionsSource/CPack/cmCPackGeneratorFactory.cxx
- Source/CPack/cmCPackNSISGenerator.cxx 6 additions, 6 deletionsSource/CPack/cmCPackNSISGenerator.cxx
Loading
Please register or sign in to comment