Added clang-format info to ReadMe.md (#832)

This commit is contained in:
Robin Kuzmin 2021-09-24 17:07:06 -07:00 коммит произвёл GitHub
Родитель 41f0eb6663
Коммит 027a32343e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 15 добавлений и 4 удалений

Просмотреть файл

@ -170,15 +170,25 @@ CMake doesn't support using LLVM's IR files as input so instead we invoke Clang
## Coding style and conventions
Please enable file-based clang-format and run it before submitting your changes for review (in VS Code: Alt+Shift+F on
a file). It will take care of spaces, indentations and many other formatting issues automatically and safely.
If during compilation you see an error like this
```
##vso[task.logissue type=error;]Formatting check failed. The following files need to be formatted before compiling:
```
then this means that the edits you made violate the
[coding style](https://github.com/microsoft/qsharp-runtime/blob/main/src/Qir/.clang-format)
enforced by clang-format utility. To format the file install the
Clang-Format extension to your editor ([example for VSCode](https://clang.llvm.org/docs/ClangFormat.html#visual-studio-code-integration)),
open the file, press the corresponding formatting hot keys (for VSCode it is \<Alt+Shift+f\>), and save the file.
See more links in [.clang-format](https://github.com/microsoft/qsharp-runtime/blob/main/src/Qir/.clang-format) file.
Most of our coding style and conventions are enforced via clang-tidy. The project is currently set up to treat
clang-tidy warnings as build errors and we'd like to keep it this way. If you absolutely need to violate the style,
mark the problematic line with `// NOLINT`. To suppress style checks in a whole folder, add .clang-tidy file into the
folder with checks reduced to `Checks: '-*,bugprone-*'`.
Clang-tidy checks reference: [https://releases.llvm.org/10.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/list.html]
Clang-tidy checks reference: [https://clang.llvm.org/extra/clang-tidy/checks/list.html]
Conventions not covered by .clang-format and .clang-tidy:

Просмотреть файл

@ -41,7 +41,8 @@ if (-not $IsMacOS) { # We do not control the clang-format version on MacOS, an
if ("$filesRequireFormatting" -ne "")
{
Write-Host "##vso[task.logissue type=error;]Formatting check failed. The following files need to be formatted before compiling: "
Write-Host "(You may use the Clang-Format extension in VSCode, clang-format in command line, or see https://clang.llvm.org/docs/ClangFormat.html)"
Write-Host ("(See https://github.com/microsoft/qsharp-runtime/tree/main/src/Qir/Runtime#coding-style-and-conventions " +
"or https://github.com/microsoft/qsharp-runtime/blob/main/src/Qir/.clang-format)")
$filesRequireFormatting | Format-Table
& $clangFormatCommand --version
throw "Formatting check failed for QIR Runtime sources"