 4d078fdb03
			
		
	
	
	
	
	4d078fdb03* remove 'basically' from docs * remove 'simply' from docs * remove most uses of 'just' from docs
		
			
				
	
	
	
	
		
			1.5 KiB
			
		
	
	
	
	
	
	
	
			
		
		
	
	Using clang-format on C++ Code
clang-format is a tool to
automatically format C/C++/Objective-C code, so that developers don't need to
worry about style issues during code reviews.
It is highly recommended to format your changed C++ code before opening pull requests, which will save you and the reviewers' time.
You can install clang-format and git-clang-format via
npm install -g clang-format.
To automatically format a file according to Electron C++ code style, run
clang-format -i path/to/electron/file.cc. It should work on macOS/Linux/Windows.
The workflow to format your changed code:
- Make codes changes in Electron repository.
- Run git add your_changed_file.cc.
- Run git-clang-format, and you will probably see modifications inyour_changed_file.cc, these modifications are generated fromclang-format.
- Run git add your_changed_file.cc, and commit your change.
- Now the branch is ready to be opened as a pull request.
If you want to format the changed code on your latest git commit (HEAD), you can
run git-clang-format HEAD~1. See git-clang-format -h for more details.
Editor Integration
You can also integrate clang-format directly into your favorite editors.
For further guidance on setting up editor integration, see these pages: