PowerToys/doc/devdocs/style.md
Dustin L. Howett fa3a5f80a1
Prepare for renaming master -> main (#13235)
This commit replaces all references to PowerToys' master branch
with "main" in documentation, code and build rules.

- [x] **Linked issue:** #5433
- [x] **Communication:** I've discussed this with core contributors in
  the issue. 
- [ ] **Tests:** Added/updated and all pass (not applicable)
- [ ] **Installer:** Added/updated and all pass (not applicable)
- [ ] **Localization:** All end user facing strings can be localized
  (not applicable)
- [x] **Docs:** Updated
- [x] **Binaries:** Any new files are added to WXS / YML
   - [x] No new binaries
2021-11-01 12:21:47 -05:00

1.5 KiB

Coding Style

Philosophy

  1. If it's inserting something into the existing classes/functions, try to follow the existing style as closely as possible.
  2. If it's brand new code or refactoring a complete class or area of the code, please follow as Modern C++ of a style as you can and reference the C++ Core Guidelines as much as you possibly can.

Formatting

  • We use .clang-format style file to enable automatic code formatting. You can easily format source files from Visual Studio. For example, CTRL+K CTRL+D formats the current document.
  • If you prefer another text editor or have ClangFormat disabled in Visual Studio, you could invoke format_sources powershell script from command line. It gets a list of all currently modified files from git and invokes clang-format on them. Please note that you should also have clang-format.exe in %PATH% for it to work. The script can infer the path of clang-format.exe version which is shipped with Visual Studio at %VCINSTALLDIR%\Tools\Llvm\bin\, if you launch it from the Native Tools Command Prompt for VS.
  • CI doesn't enforce code formatting yet, since we're gradually applying code formatting to the codebase, but please adhere to our formatting style for any new code.